fix(authz): protect purpose-bound runtime integrity - #65
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@opencode-agent Please review the current unchanged head against protected |
|
@coderabbitai review Please review exact head |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Exact revision =='
git rev-parse HEAD
git status --short
printf '%s\n' '== Merge base with develop =='
git merge-base HEAD develop
printf '%s\n' '== Changed files =='
git diff --name-status develop...HEAD
printf '%s\n' '== Python structure candidates =='
fd -e py . | xargs -r ast-grep outline --items all --type class,function --match 'AuthorizationDecision|Authorization|Decision' 2>/dev/null || true
printf '%s\n' '== Focused diff =='
git diff --find-renames --unified=80 develop...HEAD -- '*.py'Length of output: 44422 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Authorization module, complete numbered source =='
cat -n packages/keyverse-adapter/src/orgmetra_keyverse_adapter/authorization.py
printf '%s\n' '== Direct constructors and consumer references =='
rg -n -C 8 --glob '*.py' \
'(AuthorizationDecision\s*\(|\bAuthorizationDecision\b)' \
packages services
printf '%s\n' '== Existing adapter authorization tests =='
cat -n packages/keyverse-adapter/tests/test_authorization.py
printf '%s\n' '== Persistence-boundary authorization validation =='
sed -n '150,230p' services/people-api/src/orgmetra_people_api/postgres_hire.py
sed -n '1,260p' services/people-api/src/orgmetra_people_api/postgres_mutations.py
printf '%s\n' '== Decision construction test map =='
rg -n -C 5 --glob 'test_*.py' \
'(AuthorizationDecision\s*\(|_decision\s*\(|allowed=False|authorized_fields)' \
packages/keyverse-adapter/tests services/people-api/tests services/job-analysis-api/testsLength of output: 169233
High: Prevent
|
|
@coderabbitai review Please review exact head |
|
Owner-path update after the #268 source repair: canonical #64 is now exact |
|
Owner-order update: canonical #64 has advanced by ordinary forward commits to |
|
Fresh canonical #64 owner handoff: #270 adds a separate post-executable replay-verification invariant after #246/#269. The replay check must not reuse either a semantic command object or an |
|
Owner-path update after #271 revalidation: #64 ordinary-forward head |
|
#272 downstream handoff correction: when #65 eventually non-force adopts protected #64, preserve the PostgreSQL concurrency behavioral contract and evidence-tier boundary, but do not copy the current mutable test harness. Fresh review of #64 exact Also preserve the corrected evidence classification: deterministic synthetic structural rows may establish PostgreSQL mechanism/integration behavior, but they are not real/right-cleared buyer/scientific acceptance data. Do not inherit the superseded #271 Employment lock. |
|
#64 owner handoff — fresh exact source is now |
|
#64 / #272 owner-path handoff update: current #64 exact head |
Scope
Canonical Orgmetra purpose-bound authorization/runtime-integrity lane. Keyverse remains identity/credential/scope authority; Orgmetra remains HR policy/evidence authority. #65 does not copy mutable #63/#64/#141/Assignment source.
Current exact head remains
1caf8f760e81f1cb6954fdf1d0d13a46dbb6c0b1on protecteddevelop@eb9757f8649aaad026a9865508d9aad50c1a7a4f, open · Draft · mechanically mergeable. Its retained #182–#210 authorization hardening and package-rootvalidate_authorization_decision(...)flow remain valid delta.Current hosted RED and owner RCA
Foundation
33932302769, repository-quality job101213236190, is a real exact-head RED. Checkout, runner, Foundation validation and dependency hygiene passed; all 118keyverse-adaptertests passed at 100% statement/branch coverage. The first failing consumer was the older shared HRIS-kernel audit timestamp boundary. That defect is owned and repaired by #63. #65 must not copy mutable #63 source; preserve this RED until #63 becomes protected truth, then non-force adopt and reacquire exact-head acceptance.Owner prerequisites
#63 is exact
42ef99ae272d78aeeeea7aac6cfd533b800a40a4on the same protected base, open · Draft · mechanically mergeable. Exact-head Foundation34089818143, Security34089818168, and SAST34089818051are terminal SUCCESS; CodeQL34089818084is terminal FAILURE in the central exact-head verdict-handoff path rather than a leaf source verdict. Qualifying independent approval is still absent. Do not transfer those partial gates or bypass normal integration.#64 People mutation/hire owner is now exact
818950960c4fe0a4e7b026bd5499fe9cca1002be, open · Draft · mechanically mergeable on protecteddevelop. It retains #229–#233, #246, packaging/runtime-floor repairs, #262 exact operational-UUID boundaries, #264 immutable validated PostgreSQL capability binding, #266–#269 complete command/result alias detachment, and #270 pre-executable replay-verification evidence binding.#271 was invalidated before integration. Assignment already serializes valid same-Employment writers on the current converted-worker row and same-Position writers on the Position root. Ordinary successor
19c6c7e...removed the redundant Employment lock and source-shape regression; #65 must not inherit or reintroduce it.#272 owns executable PostgreSQL behavior evidence. The owner lane uses two independent libpq-backed writers under
READ COMMITTED, requirespg_stat_activity/pg_blocking_pids(...)to expose the real conflict, and distinguishes deterministic synthetic integration fixtures from provenance-backed commercial/scientific evidence. The cleanup chain includes barrier release, server/client cleanup, deadline-bounded joins, verified backend termination on expiry, and fail-closed thread quiescence.Exact predecessor
52257a66f68cf0893f2b351cbc0392b3e52f5bb4repaired the termination receipt itself to require exactly one captured PID + internalapplication_namematch and successfulpg_terminate_backend, represented as exact1|true. Foundation34127782377subsequently produced a real hosted RED: the forced-timeout regression expired the first cleanup join for both writers although only writer B's connection cleanup was deliberately held. Writer A was allowed to quiesce naturally after barrier release and could disappear before the termination lookup, so the new exact receipt correctly rejected that manufactured zero-match termination requirement.Ordinary successor
818950960c4fe0a4e7b026bd5499fe9cca1002berepairs only that regression seam. The timeout probe now identifies the deliberately held writer from its factory and forces first-join expiry only for that writer; the released writer receives the real bounded cleanup join. The held writer remains live so the real PID + internalapplication_nametermination query and exact receipt are still exercised. Production People SQL, transaction semantics, row-lock ordering, RLS, audit/outbox, idempotency, and #65 authorization semantics are unchanged.#64 Foundation
34131641452, job101772911159, is now terminal SUCCESS on exact818950.... Exact checkout and the full People API test tree passed under the pinned Foundation PostgreSQL image, including #272's normal two-session interleavings and forced post-lock cleanup/timeout regression. Security34131642055, SAST34131642172, and CodeQL34131641597remain non-terminal, and qualifying independent approval is absent. Treat the Foundation result as current owner mechanism evidence only; do not transfer it to #65 or infer the remaining gates.The real/right-cleared commercial/scientific evidence tier remains separate. #65 must never amplify the synthetic concurrency fixture into buyer-realistic or scientific evidence without provenance-backed permitted data.
#64 and #65 overlap on
hire.py,mutations.py,postgres_hire.py, andpostgres_mutations.py. After #63 and #64 integrate normally, #65 must non-force adopt protected owner state while preserving #229–#233, #246, packaging/runtime-floor regressions, #262/#264/#266–#270, #272's measured PostgreSQL interleaving + evidence-classification + deterministic cleanup + bounded-wait + verified-owned-backend + exact one-session termination-receipt contract, and the requirement that a forced timeout seam target only a writer intentionally kept live. Preserve inherited acceptance regressions and #65's own detached/revalidatedAuthorizationDecisionsemantics. Do not retarget onto mutable #64 or cherry-pick its source.#141 follows #65 and must later non-force adopt protected owner truth while retaining only its employing-legal-Organization feature delta. Assignment #163/#165 remain downstream consumers. The independent Workforce Validation lane may progress from protected
developwhile these prerequisites run.docs/product-technical-gap-baseline.mdremains single-writer-owned by #100. Durable invariants may flow there through owner handoff; volatile SHAs/run IDs stay in PR/Issue metadata. #271's invalidated lock claim is not a baseline invariant, and #272 synthetic fixtures are integration evidence only.Canonical order remains #63 normal protected integration → #64 remaining exact-head required workflows/governance → #65 non-force protected adoption/reconciliation + fresh exact-head acceptance → #141 → Assignment descendants. No self-approval, administrator bypass, gate weakening, force-push, destructive rebase, mutable-owner source copy, no-op retrigger, or predecessor-evidence transfer.