Skip to content

Update Test to 2.9.0 - #2060

Merged
david-rocca merged 58 commits into
stagingfrom
dev
Oct 20, 2026
Merged

david-rocca merged 58 commits into
stagingfrom
dev

Conversation

@david-rocca

Copy link
Copy Markdown
Collaborator

No description provided.

jdalphond-mitre and others added 30 commits October 14, 2026 14:22
… out legacy and registry tests to more easily tell which files are which.
…bsolete OrgRepository factory getter and legacy test mocks.
Update legacy user-capacity setup to use BaseOrg membership rather than
legacy User records. Add coverage that verifies legacy user create, update,
read, and reset-secret responses remain compatible while BaseUser and
BaseOrg remain the sources of truth.
Project legacy user reads and write responses directly from BaseUser and
BaseOrg membership/admin data, eliminating UserRepository and RegistryUser
usage from BaseUserRepository create, update, full update, reset-secret,
delete, lookup, and authorization paths.

Normalize legacy dotted user fields during creation and re-read the owning
BaseOrg before projecting legacy responses so names and ADMIN roles match the
persisted BaseUser/BaseOrg state. Avoid logging one-time user secrets in org
creation audit records.

Release BaseOrg reservation locks before sending post-lock CVE-ID responses,
while retaining finally cleanup for exceptions, so an immediately-following
reservation is not incorrectly rejected as in progress.

Update unit and integration tests for BaseUser-only behavior, legacy write
compatibility, and clearer reservation response assertions.
Registry full user updates preserve ADMIN membership when the user remains
in the same organization. When org_short_name changes, the user is removed
from the source admins list and receives destination membership only.

Extend integration coverage for both same-org updates and organization moves.
Use BaseUserRepository when CVE and CVE-ID controllers resolve the
authenticated requester UUID for audit metadata, removing their remaining
UserRepository factory dependency.

Update affected CVE/CVE-ID unit-test factories to provide BaseUserRepository
and update registry user-move coverage to require destination membership
without destination ADMIN access.
Make BaseOrg the sole source of ADMIN membership by removing the legacy
User collection updates from addAdmin() and removeAdmin(). Legacy user
responses continue to derive active_roles from BaseOrg membership through
the compatibility projection.

Expand admin-role integration coverage to verify that:
- legacy grants remain visible through registry reads,
- registry revokes remain visible through both API formats, and
- registry grants remain visible through legacy reads.
Remove the legacy UserRepository factory import and getter now that all
production callers use BaseUserRepository.

Delete the retired UserRepository implementation and its unit coverage.
Update remaining middleware, user-update, and reservation test helpers to
use BaseOrgRepository and BaseUserRepository exclusively.
Seed canonical BaseOrg/BaseUser fixtures directly, including memberships, admin references, discriminator types, and quotas.

Remove the legacy Org/User migration script and obsolete test setup references.

Update population helpers and affected tests to use Base repositories only.

Retain Monday migration support for existing BaseOrg/BaseUser data.
Return empty active_roles for disabled organizations and remove the
implicit CNA fallback. Include disabled in legacy read projections,
remove obsolete code, and add regression coverage.
Authentication previously validated organization membership, active user
status, and API keys without checking BaseOrg.disabled. Members of disabled
organizations could therefore authenticate and reach role and ownership
checks using the organization’s stored authority.

Update required and optional authentication to:
- Load the organization UUID and disabled flag from BaseOrg.
- Require disabled to be explicitly false before validating the user.
- Reject missing, null, or non-boolean disabled values.
- Clear authenticated state and cached organization/user UUIDs before
  validation to prevent rejected attempts from retaining stale identity.
- Preserve active-user, membership, API-key, role, and ownership checks.

Required authentication returns 401 for non-enabled organizations. Optional
authentication continues with unauthenticated public response behavior.
Disabled Secretariat organizations receive no exemption.

Add regression coverage for:
- Enabled CNA admins and regular members reserving IDs and publishing
  and editing records owned by their organization.
- Disabled organizations being denied reservation, publication, and editing.
- Missing or malformed disabled flags failing authentication.
- Optional reads redacting protected information for disabled organizations.
- Inactive users, missing active status, invalid keys, and false membership
  claims being rejected.
- Cross-CNA reservation, publication, and editing remaining forbidden.
- Denied edits leaving existing records unchanged.
- Stale optional authentication context being cleared before user lookup.
Default Secretariat organizations to disabled: false and require that
value in model and JSON schema validation.

Protect organization creation and full updates by checking both existing
and requested authority roles. Reject attempts to remove SECRETARIAT and
disable the organization in the same request.

Keep Secretariat organizations enabled when full updates omit disabled,
and enable organizations promoted to Secretariat through registry or
legacy role updates.

Return HTTP 400 for rejected disable attempts, including review approvals.
Abort rejected approvals so the review remains pending.

Preserve normal CNA disabling and existing authentication checks.

Add unit and integration coverage for defaults, validation, role-change
bypasses, omitted flags, CNA disabling, and pending review rollback.
David T Rocca and others added 22 commits October 14, 2026 14:47
Update integration tests to reflect the agreed legacy role behavior
and use the repository's standard pagination configuration.

- Expect empty authority.active_roles for users whose status is not
  exactly "active", including inactive, missing, null, uppercase, and
  pending values. Apply the same expectation when obsolete User records
  conflict with the authoritative BaseUser status.

- Expect newly created legacy organizations with Secretariat role
  combinations to normalize to ["SECRETARIAT"]. Verify quota updates
  preserve that normalized authority while retaining the complete
  96-fixture quota matrix and list assertions.

- Add focused coverage confirming that the existing MITRE organization
  retains both SECRETARIAT and CNA in registry and legacy GET responses,
  with matching organization UUIDs.

- Pass PAGINATOR_OPTIONS to the disabled-organization repository test so
  aggregation results use the expected itemsList and itemCount labels.
  Retain the fixture-sized limit and primary read preference.

Validation: git diff --cached --check passed.
Apply the BaseOrg model's default when legacy conversion receives an
organization without a disabled flag. Ordinary organizations expose no
active roles, while Secretariat organizations remain enabled. Keep
document, lean, and aggregation reads consistent without modifying
stored data.

Update the disabled-organization role contract tests to verify:
- Granting a role enables the organization with the newly granted role.
- Removing the last active role disables the organization while retaining
  its stored authority and organization type.
- Legacy responses and stored authority reflect their respective states.
- Missing disabled flags follow the same defaults across legacy reads.

Add unit coverage for missing-flag defaults and explicitly mark fixtures
as enabled where their expected legacy responses include active roles.
Add six integration cases covering:
- Stale quota checks in priority, sequential, and non-sequential reservations
- Concurrent organizations allocating at the shared range boundary
- Concurrent year initialization resetting allocated counters
- Live lock contention followed by an immediate retry

Control request ordering with repository barriers while retaining real HTTP
requests and database operations. Verify response bodies, quota headers,
persisted ownership, identifier uniqueness, counters, and lock cleanup.

Use isolated fixtures, bounded waits, and cleanup that drains pending requests.
Document reproduction sequences, expected outcomes, and handoff instructions.

Five regression cases are expected to fail until the inherited races are fixed.
The lock contention and retry case serves as a control.
Disable automatic timestamps when acquiring and releasing reservation locks.
Lock changes are operational state and should not count as organization
modifications, including during rejection and exception cleanup.

Update timestamp integration coverage for:
- Priority, sequential, and non-sequential reservations
- Rejection after acquiring the lock
- Preserved organization dates in legacy and registry responses
- Normal timestamp updates on reserved CVE-ID records

@jdalphond-mitre jdalphond-mitre left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safe enough for test.

There are some minor differences that we found in the data that gets returned, however the endpoint contracts remain the same.

@david-rocca
david-rocca merged commit a02ff28 into staging Oct 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants