Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
c35f62d
feat(iam): define hashed invitation token invariants
BeforeLights Aug 3, 2026
92b18ed
feat(iam): publish invitation invariants in domain aggregate
BeforeLights Aug 3, 2026
46b6939
feat(iam): add invitation issue and redemption service
BeforeLights Aug 3, 2026
9f14db2
feat(iam): add scoped invitation repository adapter
BeforeLights Aug 3, 2026
2a65756
feat(iam): persist invitation token records
BeforeLights Aug 3, 2026
5ce9fe3
docs(iam): record invitation token evidence
BeforeLights Aug 3, 2026
bf311ec
feat(iam): add keyed invitation crypto adapters
BeforeLights Aug 3, 2026
ab4d22c
feat(iam): expose invitation HTTP composition
BeforeLights Aug 3, 2026
003f7c9
feat(iam): add durable principal email lookup
BeforeLights Aug 3, 2026
b7701a7
feat(iam): add atomic account registration service
BeforeLights Aug 3, 2026
a6a6168
feat(iam): persist account registration atomically
BeforeLights Aug 3, 2026
4fd6236
fix(repo): normalize invitation formatting
BeforeLights Aug 3, 2026
a8ec43e
feat(iam): expose account registration endpoint
BeforeLights Aug 3, 2026
26dd0ee
feat(iam): add bounded recovery challenge invariants
BeforeLights Aug 3, 2026
371ccdf
feat(iam): add recovery service and transactional state effects
BeforeLights Aug 3, 2026
857aa05
feat(iam): persist recovery security state atomically
BeforeLights Aug 3, 2026
66abc06
feat(iam): expose account recovery endpoints
BeforeLights Aug 3, 2026
20888ec
feat(iam): clear recovery gate after MFA verification
BeforeLights Aug 3, 2026
c7faf68
feat(iam): propagate MFA recovery re-enrollment state
BeforeLights Aug 3, 2026
42bb322
fix(iam): compare and set recovery challenge revisions
BeforeLights Aug 3, 2026
1269428
feat(iam): add bounded recovery admission
BeforeLights Aug 3, 2026
33882d9
fix(iam): avoid password hashing for invalid recovery tokens
BeforeLights Aug 3, 2026
c6b7228
feat(iam): enforce recovery mfa gate on approvals
BeforeLights Aug 3, 2026
94b8766
feat(iam): guard high-risk step-up during mfa reenrollment
BeforeLights Aug 3, 2026
e60170f
feat(iam): add shared recovery admission adapter
BeforeLights Aug 3, 2026
8f0a7c2
feat(iam): compose shared recovery admission
BeforeLights Aug 3, 2026
32d8687
feat(iam): bind recovery admission to redis eval
BeforeLights Aug 3, 2026
20b592e
feat(iam): provide context-aware mfa step-up
BeforeLights Aug 3, 2026
1302f88
feat(iam): bound recovery completion attempts
BeforeLights Aug 3, 2026
fe8380d
feat(iam): separate recovery completion admission
BeforeLights Aug 3, 2026
fee9579
fix(repo): align iam mocks with async lint contract
BeforeLights Aug 3, 2026
65afa44
Merge pull request #43 from DatabreezeService/feat/iam-recovery
BeforeLights Aug 3, 2026
265923b
feat(iam): define service account identity contract
BeforeLights Aug 3, 2026
9c238e8
feat(iam): scope service account permissions
BeforeLights Aug 3, 2026
1db0186
feat(iam): add service account repository port
BeforeLights Aug 3, 2026
4a23c05
feat(iam): authorize service account lifecycle
BeforeLights Aug 3, 2026
9ebad8f
feat(iam): generate one-time service account secrets
BeforeLights Aug 3, 2026
87530e7
feat(iam): persist service account records
BeforeLights Aug 3, 2026
73b4d99
feat(iam): add service account prisma adapter
BeforeLights Aug 3, 2026
e32ea58
feat(iam): expose service account lifecycle api
BeforeLights Aug 3, 2026
7bf5ba0
feat(iam): resolve service accounts by secret digest
BeforeLights Aug 3, 2026
d02aa7e
feat(iam): authenticate service account credentials
BeforeLights Aug 3, 2026
03ef9db
feat(audit): register service account lifecycle actions
BeforeLights Aug 3, 2026
528f0c9
feat(iam): publish service account api contract
BeforeLights Aug 3, 2026
f015b11
feat(audit): add signed seal attestations
BeforeLights Aug 3, 2026
34b79bc
feat(bua): issue bounded entitlement leases
BeforeLights Aug 3, 2026
796a681
feat(bua): persist offline entitlement leases
BeforeLights Aug 3, 2026
52d1607
feat(bua): persist entitlement lease schema
BeforeLights Aug 3, 2026
4d057e4
feat(bua): add entitlement lease repository
BeforeLights Aug 3, 2026
5c25a81
feat(bua): issue and verify entitlement leases
BeforeLights Aug 3, 2026
ecfbb25
feat(bua): expose entitlement lease api
BeforeLights Aug 3, 2026
89f7bfb
feat(bua): add provider-neutral lease signing
BeforeLights Aug 3, 2026
82b0e22
fix(bua): bind lease acceptance to canonical payload
BeforeLights Aug 3, 2026
ea59eb1
feat(audit): define seal attestation repository port
BeforeLights Aug 3, 2026
3705546
feat(audit): add in-memory seal attestations
BeforeLights Aug 3, 2026
304eecf
feat(audit): persist seal attestation schema
BeforeLights Aug 3, 2026
2834320
feat(audit): add Prisma seal attestation adapter
BeforeLights Aug 3, 2026
fb9d5c2
feat(audit): issue and verify seal attestations
BeforeLights Aug 3, 2026
4b40c9b
feat(audit): compose attestation providers
BeforeLights Aug 3, 2026
a100a75
feat(audit): expose attestation api
BeforeLights Aug 3, 2026
cb0dd27
fix(bua): validate entitlement snapshot plans
BeforeLights Aug 3, 2026
e4ad354
feat(bua): compose HMAC lease signing
BeforeLights Aug 3, 2026
d9a8386
docs(traceability): record IAM AUD BUA security slice
BeforeLights Aug 3, 2026
c9ebd1f
fix(traceability): keep audit ownership precise
BeforeLights Aug 3, 2026
99141b9
chore: format IAM and entitlement security slice
BeforeLights Aug 3, 2026
c2442ad
fix(iam): satisfy service account lint guard
BeforeLights Aug 3, 2026
20ceddd
test(api): track security migration and route contracts
BeforeLights Aug 3, 2026
df4d0a2
fix(deps): pin patched fast-uri release
BeforeLights Aug 3, 2026
b32584d
Merge pull request #45 from DatabreezeService/feat/iam-security-compl…
BeforeLights Aug 3, 2026
597dc5d
fix(iam): persist recovery challenges before delivery
BeforeLights Aug 4, 2026
eb2d3c9
fix(iam): compose service accounts from derived repository
BeforeLights Aug 4, 2026
bfdcd5d
fix(iam): enforce strong digest keys
BeforeLights Aug 4, 2026
8860135
fix(iam): reject recovery for inactive users
BeforeLights Aug 4, 2026
ea70d9f
fix(iam): guard service-account replacement scope
BeforeLights Aug 4, 2026
2946e92
fix(iam): persist invitations before delivery
BeforeLights Aug 4, 2026
75af992
fix(iam): map invitation invariant conflicts
BeforeLights Aug 4, 2026
7910db8
fix(iam): enforce one active invitation per membership
BeforeLights Aug 4, 2026
a723292
fix(iam): validate service-account permissions before issuance
BeforeLights Aug 4, 2026
b54f0b4
fix(bua): use server time for lease verification
BeforeLights Aug 4, 2026
716229a
fix(iam): make MFA reenrollment state explicit
BeforeLights Aug 4, 2026
03a2101
fix(security): fail closed on signer errors and MFA clear
BeforeLights Aug 4, 2026
c6c5cee
fix(api): preserve integer and UTC timestamp contracts
BeforeLights Aug 4, 2026
c4a08a2
fix(bua): compare immutable leases by fields
BeforeLights Aug 4, 2026
418b56a
fix(aud): use targeted scoped seal lookups
BeforeLights Aug 4, 2026
3f1c4e9
fix(aud): return typed attestation replays
BeforeLights Aug 4, 2026
05149f6
fix(iam): make registration outcomes indistinguishable
BeforeLights Aug 4, 2026
c61bb1c
fix(iam): throttle registration before password hashing
BeforeLights Aug 4, 2026
fa15e4b
fix(iam): honor service-account create idempotency
BeforeLights Aug 4, 2026
40af06b
test(iam): exercise registration transaction rollback
BeforeLights Aug 4, 2026
397087b
test(prisma): fix migration assertion escaping
BeforeLights Aug 4, 2026
5f1bc30
docs(iam): refresh invitation slice checkpoint
BeforeLights Aug 4, 2026
8b48661
test(iam): verify registration admission composition
BeforeLights Aug 4, 2026
108cc0a
test(iam): prove registration rollback after staged write
BeforeLights Aug 4, 2026
000554c
fix(iam): distinguish revoked invitation tokens
BeforeLights Aug 4, 2026
417885e
docs(iam): refresh registration slice evidence
BeforeLights Aug 4, 2026
6231dfd
test(iam): fail closed on unreadable account replay
BeforeLights Aug 4, 2026
e1ff67f
test(iam): verify registration admission digest boundaries
BeforeLights Aug 4, 2026
277e699
test(iam): cover replay envelope bounds
BeforeLights Aug 4, 2026
0bdd655
test(iam): correct registration timestamp assertions
BeforeLights Aug 4, 2026
ba41a8b
test(iam): preserve service-account create replay
BeforeLights Aug 4, 2026
e957e43
test(iam): keep admission fixtures lint-clean
BeforeLights Aug 4, 2026
2a49f79
Merge pull request #47 from DatabreezeService/fix/coderabbit-iam-crit…
BeforeLights Aug 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/operations/iam-010-invitation-token-2026-08-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# IAM-010 durable invitation token slice — 2026-08-03

## Scope

This evidence record covers the durable persistence boundary for the IAM-010 invitation-token
slice. It is a partial implementation record, not a release approval or a claim that Plan 020 is
complete.

## Delivered

- `2a65756` adds the `iam.invitation_tokens` Prisma model and centrally ordered migration.
- Only the token digest and recipient-email digest are persisted; the raw bearer value is accepted
only by the delivery port and is never returned by the application result or stored in a row.
- `PrismaIamInvitationRepositoryAdapter` maps persisted rows through domain validation, enforces
tenant scope visibility, rejects sibling-token reads, prevents multiple active invitations per
membership, and uses compare-and-set revisions for redemption and membership activation.
- The versioned invitation controller and IAM module composition now expose the acceptance flow
through the same replaceable repository and delivery ports; the HTTP boundary never returns the
raw token.
- The Prisma foundation test proves the schema diff and migration inventory include the new table.

## Verification

- `corepack pnpm --filter @databreeze/api exec prisma validate --config prisma.config.ts`
- `corepack pnpm --filter @databreeze/api test` — 352 tests passed.
- `corepack pnpm --filter @databreeze/domain test` — 134 tests passed.
- `git diff --check` passed before commit.

## Explicitly not complete

Transactional AUD append, registration for unknown recipients, resend/revocation administration,
an SMTP/SES delivery adapter, and production PostgreSQL/backup/security evidence remain future
work. IAM-010 therefore remains `partial` and `not-verified` in the requirement manifest.
52 changes: 52 additions & 0 deletions docs/operations/iam-bua-security-slice-2026-08-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# IAM, audit, and entitlement security slice — 2026-08-03

## Scope

This evidence record covers the 30-commit `feat/iam-security-completion` batch based on
`origin/dev`. It is implementation evidence only. It does not claim that Plan 020 or any
P0/P1 release gate is complete.

## Delivered

- IAM service-account identities now use bounded permissions, digest-only secrets, one-time
secret issuance, rotation, permanent revocation, last-use monotonicity, tenant-scoped
repositories, Prisma persistence, and versioned lifecycle HTTP contracts.
- AUD action vocabulary includes service-account lifecycle actions. Audit seal attestations
are canonical, independently signed, immutable, tenant-scoped, transaction-aware, and
available through in-memory and Prisma adapters with API verification.
- BUA entitlement snapshots validate their complete provider-independent plan projection.
Signed offline leases are bounded to 24 hours and snapshot expiry, bind revision and
security epoch, persist immutably, verify canonical payloads, and use a replaceable HMAC
signer or injected HSM/KMS-compatible signer.
- BUA and AUD module composition defaults to unavailable signing when key material is absent;
no secret is generated, logged, or committed by the repository.

## Verification

- Domain build and 148 domain tests pass, including canonical lease acceptance, malformed plan
rejection, attestation binding, tenant ancestry, and signature tampering cases.
- Focused API TypeScript compilation, ESLint, Prisma validation, OpenAPI generation/check,
Redocly validation, and focused IAM/AUD/BUA tests pass.
- Prisma migrations are ordered and add only `bua.entitlement_leases` and
`aud.audit_seal_attestations`; no migration was applied to a live environment.
Comment on lines +30 to +31

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the migration list in the evidence record.

Lines 30-31 state that the migrations add only bua.entitlement_leases and aud.audit_seal_attestations. The same change set also contains services/api/prisma/migrations/20260803060000_iam_service_accounts/migration.sql, which creates the service-account tables described at lines 11-13. Add that migration to the list so the evidence record matches the applied schema changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/operations/iam-bua-security-slice-2026-08-03.md` around lines 30 - 31,
Update the migration list in the evidence record to include the
20260803060000_iam_service_accounts migration alongside bua.entitlement_leases
and aud.audit_seal_attestations, so it reflects all schema changes in the change
set.

- Traceability entries for IAM-013, AUD-015, AUD-016, BUA-017, and BUA-018 remain `partial`
and `not-verified`. They point to the concrete code, tests, and this evidence record.

## Security and rollback notes

- Lease payloads are canonicalized before signature verification; malformed, stale, expired,
overlong, wrong-scope, and tampered leases fail closed.
- Attestation storage never broadens a caller scope and rejects immutable-identity changes.
- HMAC keys must be at least 32 bytes and should be supplied by a secret manager. HMAC is a
portable default, not a replacement for a production KMS/HSM policy.
- Every commit on the feature branch is independently reversible. The migration commits must
be reverted only with a reviewed down-migration/restore procedure; no destructive rollback
was executed here.

## Remaining gates

Full audit export/legal-hold/retention administration, atomic cross-module audit coordination,
offline authorization snapshots, entitlement reconciliation/usage exports, real PostgreSQL
integration, backup restoration, security assessment, and release evidence remain outstanding.
The feature PR targets `dev` without CodeRabbit; CodeRabbit remains reserved for the later
`dev` to `main` promotion PR and is invoked once there.
33 changes: 33 additions & 0 deletions docs/operations/iam-recovery-2026-08-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# IAM recovery slice — 2026-08-03

This evidence records the partial account-recovery boundary delivered on `feat/iam-recovery`.
It does not claim that IAM-015 or the IAM plan is complete.

## Scope

- Validate a bounded recovery request and return the same accepted response for known and unknown email addresses.
- Generate a short-lived, single-use bearer, deliver the raw value only through the delivery port, and persist only keyed HMAC digests.
- Consume the bearer exactly once and atomically rotate the Argon2id credential, advance the user security epoch, revoke active sessions and MFA factors, and mark MFA re-enrollment required.
- Clear the re-enrollment gate in the same MFA transaction when a newly enrolled factor is successfully verified; failed proofs do not clear it.
- Carry the live gate through credential lookup, session lookup, protected request context, and sign-in/current-session projections without trusting client-supplied state.
- Apply a bounded, replaceable recovery-admission port before account lookup; unknown and throttled addresses receive the same generic response.
- The `RedisRecoveryAdmissionAdapter` implements that port for horizontally scaled deployments. It accepts only keyed digests, namespaces counter keys, requires an injected atomic `INCR`/`PEXPIRE` implementation, and fails closed on malformed input or counter failure. The in-memory adapter remains the alpha default until a Redis client is provisioned.
- Completion attempts use a separate admission port and, when Redis is configured, a distinct `databreeze:iam:recovery:completion:v1:` namespace so email-request and token-brute-force limits cannot collide.
- Keep the public completion response free of bearer material; no session is automatically created.
- Select the Prisma recovery adapter only when persistence is configured, and fail closed when the delivery, digest, or password boundary is missing.

## Evidence

- Recovery state-machine tests: `packages/domain/test/recovery-v1.test.mjs`.
- Abuse-control tests: `services/api/test/features/iam/recovery-admission.test.ts` and `redis-recovery-admission.adapter.test.ts`.
- In-memory transaction/service tests: `services/api/test/features/iam/recovery.service.test.ts`.
- Durable schema adapter and atomic side-effect tests: `services/api/test/features/iam/prisma-recovery-repository.test.ts`.
- MFA re-enrollment transaction tests: `services/api/test/features/iam/mfa.service.test.ts` and `services/api/test/features/iam/prisma-mfa-repository.test.ts`.
- Live principal/context propagation tests: `services/api/test/features/iam/prisma-credential-lookup.test.ts`, `services/api/test/features/iam/prisma-session-lifecycle.test.ts`, and `services/api/test/platform/http/session-tenant-context.test.ts`.
- Composition/controller/HTTP tests: `services/api/test/features/iam/recovery-composition.test.ts`, `recovery-controller.test.ts`, and `recovery-http.test.ts`.
- Public routes: `services/api/openapi/v1.json` (`POST /v1/auth/recovery` and `POST /v1/auth/recovery/complete`).
- Bilingual problem copy: `packages/i18n/src/catalogs-v1.ts` and `packages/i18n/test/catalogs-v1.test.mjs`.

## Verification

The scoped API TypeScript build, recovery tests, i18n tests, OpenAPI generation/check, and Prisma validation passed on 2026-08-03. The requirement remains `partial` and `not-verified` until authenticated MFA re-enrollment enforcement, audit events, rate limits, abuse monitoring, restoration drills, and the complete IAM release gates are delivered.
27 changes: 27 additions & 0 deletions docs/operations/iam-registration-2026-08-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# IAM registration slice — 2026-08-03

This evidence records the partial account-registration boundary delivered on `feat/iam-registration`.
It does not claim that IAM-001 or the IAM plan is complete.

## Scope

- Normalize and validate the email, display name, locale, and password at the application boundary.
- Hash the password through the existing Argon2id password port; raw passwords never enter persistence.
- Create the user, credential, personal organization, workspace, internal project, and owner membership in one transaction.
- Keep duplicate-email responses generic and map persistence races to a safe rejection.
- Return a generic `202 Accepted` body (`{"accepted":true}`) from `POST /v1/auth/register`; the endpoint never returns hierarchy identifiers, bearer material, or an account-existence signal and never automatically creates a session.
- Apply bounded, domain-separated admission before Argon2id hashing: the control plane hashes the normalized client IP and normalized email into separate rate-limit namespaces, and the durable Redis adapter fails closed on counter errors.
- Select the Prisma registration adapter only when durable registration storage and the password boundary are configured; otherwise the endpoint fails closed.

## Evidence

- Service and in-memory transaction tests: `services/api/test/features/iam/registration.service.test.ts`.
- Durable adapter and rollback tests: `services/api/test/features/iam/prisma-registration-repository.test.ts`.
- Composition and controller tests: `services/api/test/features/iam/registration-composition.test.ts` and `services/api/test/features/iam/registration-controller.test.ts`.
- HTTP and problem-details tests: `services/api/test/features/iam/registration-http.test.ts`.
- OpenAPI route: `services/api/openapi/v1.json` (`POST /v1/auth/register`).
- Bilingual error catalog coverage: `packages/i18n/src/catalogs-v1.ts` and `packages/i18n/test/catalogs-v1.test.mjs`.

## Verification

The scoped API TypeScript build, registration tests, i18n tests, OpenAPI generation/check, and Redocly validation passed on 2026-08-04. The rollback test stages the row in the transaction before injecting a persistence failure, proving no partial hierarchy remains. Admission tests prove IP/email throttling occurs before password hashing and persistence. The requirement remains `partial` and `not-verified` until the complete IAM release gates, audit integration, recovery, MFA, and restoration evidence are delivered.
Loading
Loading