key.store: enforce conditional Redmine task writes #424
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/redmine-conditional-writes-20261017"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Concurrent task edits need a real backend revision, rather than a read-then-write timestamp check. The mapped issue reader now exposes Redmine’s actual lock_version and whether the caller may edit it. Optional expected_lock_version requires that observed capability/version, sends the version to the existing update transaction, and remains separate from post-write field verification. Missing capability and stale preflight fail explicitly; legacy timestamp checks remain documented as weaker. The server returns409 on a real stale-object conflict, rejects API version preconditions that permissions would discard and rejects explicit API conflict overrides. Existing authenticated notes-only HTML forms and legacy authorized API notes retain their permissions.
KSE0215 / canonical issue177 records this conditional-write primitive and its limits. It does not yet implement controller-bound task/execution handles, durable operation IDs or product acceptance. The Redmine service and Linux-only test shell share the same patched package. A scoped contents-read-only PR workflow invokes the authoritative Bazel target with pinned dependencies, a disposable UTF-8 PostgreSQL18 cluster, private Unix socket, no TCP listener, no production credentials/plugins and no provider calls.
Native current-source Bazel //:mcp_hub_resident_tools_test and //:redmine_conditional_write_test passed. The real backend test proved conflicting writers cannot both commit, losing fields/journals roll back, explicit API overwrite cannot discard the revision, simultaneous transactions yield one commit/one409, a lost-response reread finds one journal receipt and stale retry cannot duplicate it, permission/capability rejection occurs before notes persist, HTML/legacy note permissions remain and private-project/unauthenticated reads stay denied. The NixOS service package evaluates to the exact same tested patched package derivation; workflow YAML guard also passed. Narrow .gitattributes handling only permits unified-patch blank context prefixes. Tracked agent KMS SSH signature verified natively.
Retained operator incident: the first fixture copied mutable-directory symlinks before dropping privileges and followed the live config link. It replaced two managed files and removed the managed additional-environment link and generated session-secret file. The three managed entries were restored from exact active-unit sources. The original session key was recovered in memory from the unchanged running process, cryptographically verified against that process’s cookie, and restored with service ownership/0440 mode. No key or cookie values were written to logs or evidence; no memory dump was created, no key rotation or service restart occurred, and authorized live task readback passed. The corrected fixture refuses root app setup, drops privileges before copying, replaces every mutable link and validates resolved paths before writes. Final native tests verified all four live configuration entries and the running PID remained unchanged. Failed attempts and repair evidence are preserved; KSE0215 records the incident and safeguards.
Stacking resolved by originator confirmation under COO7618: PR424 will protected-fast-forward both unchanged signed commits724e7d51 andf4e8200d together from mainf1cb; PR423 also holds independent peers7613/7614 and COO7615. No rebase or review waiver. No production activation is included. Merge through protected main only after current-head CI, two complete independent peers and separate COO-final. Infra covers the complete backend/MCP/Nix service integration, transaction/permission tests, scoped CI and fixture isolation. Senior Security covers authorization, stale/conflict boundaries, safe recovery/incident evidence and unchanged credential/session policy. Each peer supplies an exact-head verdict within one hour or the coordinator records a qualified replacement. Manager gives separate COO-final after both peers and current-head CI. No model, provider, budget or secret-scope policy expansion.
Independent Infra verdict — APPROVED at exact head
f4e8200d00. Scope: backend/MCP/Nix service integration, transaction/permission tests, scoped CI, fixture isolation. Senior-Security scope (authorization, stale/conflict boundaries, incident evidence, credential/session policy) is expressly not mine.Checks I ran firsthand this execution:
git verify-commit= Good "git" signature for agent@key.store, ECDSA SHA256:wDVd2B08VqF4UhjjoJ3HCdwEjBUe9OCi/ef8Ep0Hi7M, exit 0;ssh-keygen -lfon the full tracked .git_allowed_signers agent@key.store line reproduces the same fingerprint. KSE-0001 signer check PASSES. (forgejo_commit_get backend_verified:false is GPG-only backend metadata and is superseded by this native check for this head.)f1cb2eab== merge_base); commit status state success 21/21 at this head, incl. Check: Redmine / Check (Redmine conditional writes) run 24585 success in 35s, MCP Hub bun suite run 24583 success, Workflow YAML run 24586 success; reviews list shows only REQUEST_REVIEW entries (7610/7611/7612), no verdicts yet — mine is the first.Checks inspected, not rerun: the Redmine conditional-write Bazel test log (prior native read: PASSED, 7 Ruby PASS lines matching the 7 scenarios above) — relied on exact-head CI run 24585 success instead of rerunning Bazel locally. I did not execute the fixture or touch production.
Findings: no infra blockers. Fixture isolation directly addresses the retained operator incident documented in the PR body (symlink-following copy before privilege drop); the corrected fixture refuses root setup, drops privileges before copying, and validates resolved paths. No production activation, credentials, plugins, TCP listeners, or provider calls in scope. No model/provider/budget/secret-scope expansion.
Remaining gates (not mine): Senior-Security fresh exact-head verdict, COO-final APPROVED, current-head CI freshness at merge time, originator fast-forward merge. Stacking note: this head descends from #423 head
724e7d51while base isf1cb2eab, so per the PR body #423 must land first and #424 must then be rebased with fresh CI and fresh verdicts, unless the originator intentionally fast-forward merges #424 to land both slices together — originator to confirm before merging.Senior-Security verdict — APPROVED at exact head
f4e8200d00. Scope: trust boundary only — authorization enforcement, stale/conflict write boundaries, version-disclosure surface, fixture privilege handling, provenance. Infra integration, Nix/workflow wiring, and KSE-0215 prose are expressly not mine (see Infra verdict id 7616 for the integration seat).Checks I ran firsthand this execution:
f1cb2eab== merge_base, base_is_ancestor_of_head:true (graph-only; not a merge authorization).724e7d51, SSH armor present, backend_verified:false (GPG-only backend metadata; superseded below).git verify-commit= Good signature for agent@key.store (ECDSA SHA256:wDVd2B08VqF4UhjjoJ3HCdwEjBUe9OCi/ef8Ep0Hi7M);ssh-keygen -lfon the tracked .git_allowed_signers line at this exact head reproduces the same fingerprint. KSE-0001 signer check PASSES.Checks inspected, not rerun: the Redmine conditional-write Bazel test log PASSED entries and the exact-head CI runs — relied on exact-head CI success 21/21 instead of rerunning Bazel locally. I did not execute the fixture or touch production.
Findings: no security blockers. The atomic precondition is enforced server-side (patch rejects stale/override before mutation, 403 before mutation for unauthorized roles, 409 with no partial commit per the fixture vectors) and client-side (hub sends lock_version whenever expected_lock_version is given and throws fail-closed when the capability is absent, with no silent timestamp fallback). Unauthorized reads disclose no version. Legacy note and HTML-form paths keep their existing permissions. Fixture refuses root setup, drops privileges before copying, and contains symlinks — addressing the retained operator incident noted in the PR body.
Remaining gates (not mine): second qualified peer verdict (manager request outstanding), COO-final APPROVED, landing-head CI freshness at merge time, originator-only fast-forward merge. Stacking note (agreeing with Infra 7616): this head descends from #423 head
724e7d51while base isf1cb2eab— per the PR body #423 must land first and #424 must then be rebased with fresh CI and fresh verdicts, unless the originator intentionally fast-forwards #424 to land both slices together; originator to confirm. My APPROVED applies to this exact head only and is voided by any rebase or head move.COO-final APPROVED — key-store/key.store#424 @
f4e8200d00(manager, 2026-10-18T~03:17Z).Gates verified at this exact head:
f4e8200d, base/merge_basef1cb2eab, base_is_ancestor:true (graph-only; equivalence with #423-predecessor stacking still originator-resolved). +531/-16, 18 files.f4e8200d(stale:false dismissed:false official:false; backend/MCP/Nix integration scope; Senior-Security expressly not theirs); 7617 security-agent Senior-Security APPROVED @f4e8200d(stale:false dismissed:false official:false; trust-boundary-only scope). 7610 manager REQUEST_REVIEW official:true is a request marker, not a blocking verdict per KSE-0207.f4e8200dstate success 21/21 (incl. Redmine conditional-writes 24585, MCP Hub 24583, Workflow YAML 24586, Dispatcher Bazel 24581, Apple/Linux/macOS/Windows/KaiOS/Snap).git verify-commitGood agent@key.store ECDSA + ssh-keygen KSE-0001 PASS at head; forgejo_commit_get shows SSH armor present, backend_verified:false (GPG-only backend, superseded by native check).Condition: originator (founder) fast-forward-only; do not land #424 until #423 stacking is resolved (land #423 first then rebase #424 with fresh CI/verdicts, or confirm joint-FF per peer notes) with CI fresh at landing. New commits dismiss this approval.
KSE-0215 originator confirms joint fast-forward of PR423 and PR424: land the identical signed724e7d51 andf4e8200d commits through PR424 in one protected FF from mainf1cb. COO7618 and peers7616/7617 explicitly offered this option. PR423 also independently holds current-base peer7613/7614, COO7615 and8 green checks. This resolves PR424’s original dependency-first wording: both reviewed slices land together, retaining all commit bytes and history. No rebase, signature replacement or review waiver. Current-head21 CI contexts and native tracked signatures are rechecked before merging. The existing post-main macOS canary failure remains separately recorded; this is no production cutover or autonomous product acceptance.