Skip to content

fix: match owned security labels exactly - #1887

Merged
obviyus merged 3 commits into
mainfrom
fix/exact-security-labels
Oct 10, 2026
Merged

obviyus merged 3 commits into
mainfrom
fix/exact-security-labels

Conversation

@obviyus

@obviyus obviyus commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Use isSecurityLabel as the single classifier for the seven exact security labels, with existing case/whitespace normalization. Remove prose/advisory-ID and prefix classification.
  • Apply-close and trusted-close now recognize all seven labels, not just security. Keep every previous automation hold: the former extra protection labels live in the existing CLOSE_PROTECTED_LABEL_NAMES owner, separately from security classification. The separate impact:security advisory exclusion also remains.
  • Fix the real post-flight race found by this proof: immediately before repair merge/automerge, reread the full security predicate against current labels and comments, rather than checking only generic merge labels. Finalizer selection also refuses generic protected targets without misclassifying them as security work.
  • Keep structured ClawSweeper security markers and explicit job security metadata. Update focused regressions, policy docs, and the changelog; no stored-schema change.

Mutation-boundary proof

Candidate: 6088af72aad6749a7a683ecdb1f145a3fa7170f1. Environment: macOS arm64, Node 24; compiled production CLIs with synthetic reviewed reports/jobs and a stub gh that records every call and refuses every mutation. All authority, source-freshness, review-comment, and merge-preflight gates remain enabled. No live GitHub writes and no successful merge are claimed.

The fixtures enter apply-decisions (both dry-run and normal execution), repair:apply-result, repair:post-flight for manual repair and automerge, and repair:finalize-open-prs. An allowed normal-execution control reaches the actual close/merge call and is stopped by the stub, not by an earlier unrelated gate. Forbidden cases record zero mutation attempts.

Input / timing Apply close (dry-run + normal execution) Repair merge / automerge Finalizer selection
No security label Dry-run proposes close; normal execution reaches refused close PATCH Reaches refused gh pr merge One candidate
security Held; zero mutations Held; zero mutations No candidate
security-sensitive Held; zero mutations Held; zero mutations No candidate
security sensitive Held; zero mutations Held; zero mutations No candidate
type: security Held; zero mutations Held; zero mutations No candidate
type:security Held; zero mutations Held; zero mutations No candidate
kind: security Held; zero mutations Held; zero mutations No candidate
kind:security Held; zero mutations Held; zero mutations No candidate
Each of the seven added after initial capture Live source-revision reread rejects all seven before mutation Final PR reread rejects all seven before mutation in both post-flight modes Exact labels held on hydrated view
Each of the eight supported HTML security markers Not a claim about core apply's marker parser Held in apply-result and post-flight; each marker also held when introduced only after post-flight's initial read No candidate
securityish plus security/advisory prose Dry-run proposes close; normal execution reaches refused close PATCH Reaches refused merge One candidate
Each retained generic protection, initially present or introduced late All six held; zero mutations All six held by both post-flight modes, including final reread; zero mutations No candidate, including list-to-view additions; protected_label, not security_hold

Retained generic protections are area: security, impact:security, security-review-required, security-sensitive-changed, merge-risk: 🚨 security-boundary, and clawsweeper:needs-security-review. Their existing holds are not removed by the exact-seven classification decision. Other existing protected labels and approval/preflight requirements remain in place.

Observed candidate coverage: 44/44 apply-close scenarios; 17/17 repair apply-result merge scenarios; 44/44 post-flight repair merge scenarios; 44/44 post-flight automerge scenarios; 29/29 finalizer classification/selection scenarios — 178/178 expected outcomes.

Before / after discrimination

Pinned origin/main (9e8717ba669e480507db031901d8787cf3d077e5), compiled in an isolated runtime with its own prompts/config, allowed the six non-security exact labels through core close authorization and reached the real close PATCH. All 44 main comparison scenarios produced the expected outcomes, including preservation of the six pre-existing generic holds. The pre-fix reviewed head's post-flight final reread also reached gh pr merge for those six late labels in both manual repair and automerge (12 forbidden attempts). Every attempt was intercepted by the mutation-refusing stub. The candidate holds all seven and makes no forbidden mutation attempt. Core apply's existing source-revision drift check already rejected labels added during a run; the new classifier also protects targets whose labels were added after queueing but before apply began.

Redacted traces

Targets and SHA values below are synthetic. Local paths are shortened; no tokens, environment credentials, or private payloads are included.

Allowed core close:
  GET repos/<fixture>/issues/321 -> labels=[]
  ... exact durable review comment and freshness checks ...
  PATCH repos/<fixture>/issues/321 --input <tmp>/close-321.json
  MUTATION SENTINEL (refused; no GitHub write)

Nearest forbidden core close:
  queued report: labels=[]
  GET repos/<fixture>/issues/321 -> labels=["type: security"]
  result: skipped_protected_label, "protected label: type: security"
  mutation attempts: 0

Label introduced during apply:
  GET #1 issues/321 -> labels=[]
  GET #2 issues/321 -> labels=["type: security"]
  result: kept_open, "issue source revision changed since context capture or during the apply-time review lease check; next apply will retry"
  mutation attempts: 0

Post-flight final label guard:
  GET #1 pulls/101 -> labels=[]; head=<same fixture SHA>
  GET #2 pulls/101 -> labels=[{"name":"type: security"}]; head=<same fixture SHA>
  result: blocked, "security-sensitive PR requires central security triage"
  mutation attempts: 0

Post-flight final structured-marker guard:
  comments after GET #1 -> []
  comments after GET #2 -> ["<!-- clawsweeper-route:security -->"]
  result: blocked, "security-sensitive PR requires central security triage"
  mutation attempts: 0

Retained non-classifier hold during automerge:
  GET #1 -> labels=["clawsweeper:automerge"]
  GET #2 -> labels=["clawsweeper:automerge","impact:security"]
  result: blocked, "protected or paused repair label: impact:security"
  mutation attempts: 0

Allowed repair control:
  GET #1/#2 -> labels=["securityish"]; head=<same fixture SHA>
  gh pr merge 101 --repo <fixture> --squash --match-head-commit <fixture SHA> ...
  SECURITY_PROOF_REFUSED_MUTATION (no GitHub write)

Finalizer hydrated hold:
  list -> no protection label
  view -> labels=["area: security"]
  security_hold=false; blockers include protected_label; dispatch candidates=[]
  mutation attempts: 0

Reproduction drivers and complete call/response logs are retained outside the checkout under /tmp/security1887: apply-proof.mts, apply-main-final/summary.json, apply-preserved/summary.json, repair-boundary-proof.mjs, and repair-boundary-final/summary.json. The table and traces above are included here so review does not depend on access to those local files. The apply driver runs node dist/clawsweeper.js apply-decisions with temporary items/closed/plans/report paths, --skip-dashboard --item-number 321, and optional --dry-run. The repair driver runs the compiled apply-result, post-flight, and finalize-open-prs CLIs from an isolated copy of the built runtime/config. Heavy commands ran through Pueue.

Limits: synthetic external GitHub responses, not live GitHub/Worker integration. Finalizer proof establishes classification and candidate selection, not execution of the dispatched workflow. Mutation stubs establish authorization and refusal ordering, not successful remote close/merge semantics.

Validation

  • pnpm run build:all — passed.
  • Focused Node tests for advisory, security signals, importer/sweep/intake, apply-result, post-flight, finalizer, apply-live-state, stale-version/unsponsored close, close reasons, and comment-router — 359 passed, 0 failed.
  • pnpm run lint and pnpm run format:check — passed.
  • codex review --base origin/main on the final candidate tree — no actionable defects.

No OpenClaw Bay change is needed: existing observer-only status/report rendering can display the protected-label blocker; no public action, navigation, queue API, or wire schema changes.

Source-revision regression repair

The CI failure exposed two effects of expanding CLOSE_PROTECTED_LABEL_NAMES: the fixture incorrectly assumed every close-protected label changes the source revision (the existing advisory filter still ignores impact:security and the security-boundary merge-risk label), and the hash actually regressed for clawsweeper:needs-security-review, which changed from ignored automation metadata to source content.

Decouple source-revision freshness from close protection: preserve the existing human-review, manual-only, and bulk-filed exceptions while ignoring other automation status labels. Separate live close/merge guards still enforce every retained protection. The regression checks each automation label independently and derives the remaining human/protection cases from owner constants. Human label and comment edits still change the revision; bot comments and automation labels do not.

Repair head: 12c5e563c31e2377b57e50a8ea4a12df35f60bcf. On macOS arm64 / Node 24.21.0, Pueue task 1293 (bash /tmp/security1887/source-guard-checks.sh) passed pnpm run build:all, the source-guard file (2/2 tests), the existing focused security/apply/repair suite (359/359 tests), pnpm run lint, and pnpm run format:check. Full output was inspected with pueue log 1293 --full. Task 1294's incremental Codex review found no actionable defects. The mutation-boundary trace above remains evidence for its explicitly named earlier head; this narrow follow-up restores the pre-PR automation hash behavior and reruns the focused suite, rather than claiming those older traces were rerun on this head.

The owner decision is now recorded: approve the explicit-signal contract. This resolves the prior review's maintainer-decision question without removing generic protections or the final mutation reread.

Merge risk

Two-way code change: reverting restores the previous classifiers/guards and requires no data migration. The blast radius is automated advisory eligibility, close authorization, and repair merge/finalizer selection. Classification is narrowed to exact labels, but existing automation holds are preserved and the six previously missing exact close labels are added. Incorrect guards could hold legitimate work or allow a protected target through; paired allowed/forbidden traces above exercise those boundaries. Do not merge or enable automerge as part of this request.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR shares exact security-label matching across automation gates, preserves generic protections, and rechecks security signals before repair merges.

Example: A repair PR gains the label type: security after its initial readiness check.

  • Before: The final authorization check can reach the merge call.
  • After: The final security reread blocks the merge attempt.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is useful, narrowly justified, and has no actionable findings; strong earlier mutation-boundary evidence remains valid for unchanged owners, but the latest freshness change has only test-level validation.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Security-labeled items can miss core close protections, and security signals added during repair authorization can miss the final merge guard.
Reason: The authorization fixes have concrete value, and verified repository maintain permission establishes the recorded approval of the narrower signal contract.

Merge readiness

✅ Ready for maintainer review

This PR fixes distinct close and merge guard failures, preserves existing protections, and has verified maintainer approval for the narrower security-signal contract; no actionable introduced code defect was found.

Priority: P2
Reviewed head: 12c5e563c31e2377b57e50a8ea4a12df35f60bcf

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The latest source-revision change lacks a current-head shipped admission or trusted-close trace showing automation-only changes preserve freshness while human changes invalidate it and security protections still reject mutation.
Agent review details

How this fits together

GitHub labels, review markers, and job metadata enter ClawSweeper's eligibility and authorization gates, which select work and permit or reject close and merge operations.

flowchart TD
  A[GitHub labels and comments] --> B[Shared security classifier]
  C[Job security metadata] --> B
  B --> D[Close authorization]
  B --> E[Repair merge authorization]
  B --> F[Finalizer selection]
  D --> G[GitHub mutation boundary]
  E --> G
Loading

Technical review

Best possible solution:

Retain the approved shared classifier, independent generic protections, final mutation reread, and restored automation-label freshness behavior.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes missing shared close-label coverage and the absent final security reread, and the supplied before/after CLI traces discriminate both failures without live GitHub writes.

Is this the best way to solve the issue?

Using the existing classifier at shared gates and rereading its full predicate before mutation addresses the demonstrated failures directly, with the broader classification change now approved.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a3ac9853bee1.

Provenance checked

  • Security prefixes, advisory identifiers, and marker parsing changes intended behavior with a stated reason (3ae3a88: The typing refactor replaced broad risk-word matching with explicit labels, prefixes, markers, and advisory identifiers.)
  • Core close protections keeps the original intent (fix(close): close automation reads typed fields and exact labels, not prose judges #1774: Close automation was changed to consume typed facts and exact protected labels rather than prose judgments.)
  • Shared label ownership keeps the original intent (refactor: give ClawSweeper labels and bot logins one owner #1781: Automation labels were consolidated into an import-free owner usable by the dashboard Worker.)
  • Post-flight authorization reread keeps the original intent (9ab7ed4: Post-flight rereads live merge policy and the current head before authorizing merge.)
  • Issue source-revision automation exceptions keeps the original intent (65cadf5: Issue implementation freshness distinguishes human source changes from automation metadata; the follow-up restores the pre-PR treatment of needs-security-review.)
  • Low-signal importer changes intended behavior with a stated reason (fix(repair): select gitcrawl low-signal PRs by facts, not keywords #1778: Candidate selection uses facts while the model and guarded applicator judge whether a close is appropriate.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced security classification: The pinned introduced diff removes prefix and advisory-ID classification, shares the seven-label predicate, and retains the six generic protections in CLOSE_PROTECTED_LABEL_NAMES. (src/repair/security-signals.ts:67, 12c5e563c31e)
  • Final merge guard: Post-flight rereads current labels and structured security comments before the head check and actual merge call; generic protection labels remain independently enforced. (src/repair/post-flight.ts:246, 12c5e563c31e)
  • Current main still needs the change: Fetched main retains security-prefix and advisory-ID classification and lacks the newly added final security reread. (src/repair/security-signals.ts:20, a3ac9853bee1)
  • Verified maintainer decision: fix: match owned security labels exactly #1887 (comment) explicitly approves exact labels and scoped structured signals while retaining generic protections; the collaborator-permission endpoint independently reports obviyus's role as maintain, resolving the conflicting CONTRIBUTOR association.
  • Supplied mutation-boundary proof: The PR body supplies macOS arm64 / Node 24 traces from compiled production close, apply-result, post-flight, and finalizer CLIs at 6088af7: allowed controls reach mutation-refusing calls, while forbidden labels, late labels, late markers, and retained protections produce zero forbidden attempts. (6088af72aad6)
  • Latest follow-up and its proof limit: The latest commit changes source-revision filtering consumed by exact-review admission and trusted-close routing; the body expressly limits runtime traces to the earlier head and reports only tests and static validation for this follow-up. (src/repair/issue-source-guard.ts:50, 12c5e563c31e)

Likely related people:

  • Peter Steinberger: Raw commit 3ae3a88 adds src/repair/security-signals.ts:24 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3ae3a88220cc; files: src/repair/security-signals.ts)

Review metrics

Metric Value Why it matters
Introduced production and test changes Production +56/-101; tests +288/-71 Shared classification removes production duplication while focused tests cover exact labels, retained holds, late security signals, and source-revision exceptions.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.

Label justifications:

  • P2: The change addresses concrete automation authorization failures within a focused maintenance surface.
  • merge-risk: 🚨 security-boundary: The diff changes which security signals hold destructive automation; the narrower contract is explicitly accepted by a verified repository maintainer.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-10T10:03:00.842Z sha f2fcafa :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-10T10:24:57.209Z sha 6088af7 :: blocked before merge. :: none

Reviewed October 10, 2026, 6:37 AM ET / 10:37 UTC (Revision 3).

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision on the open question: approve the explicit-signal contract.

The seven exact security labels and the scoped structured signals (supported review markers and explicit job metadata) are the only authoritative security holds. Label prefixes such as security/internal, advisory identifiers found in free text, and loose markers in raw jobs no longer hold automation by themselves. We decided this earlier: exact labels, and no text or substring judges.

Every generic protection that held items before stays in place (CLOSE_PROTECTED_LABEL_NAMES), and the final mutation reread stays in place. So the change only narrows what counts as a security label. It does not remove any close or merge protection.

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient Contributor real behavior proof is sufficient. labels Oct 10, 2026
@obviyus
obviyus merged commit 9df9545 into main Oct 10, 2026
30 of 33 checks passed
@obviyus
obviyus deleted the fix/exact-security-labels branch October 10, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant