Skip to content

EXPERIMENTAL: authorization policy prototype β€” DO NOT LAND#103780

Draft
steipete wants to merge 2 commits into
mainfrom
codex/runtime-security-context
Draft

EXPERIMENTAL: authorization policy prototype β€” DO NOT LAND#103780
steipete wants to merge 2 commits into
mainfrom
codex/runtime-security-context

Conversation

@steipete

@steipete steipete commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Caution

EXPERIMENTAL PROTOTYPE. DO NOT LAND OR MERGE.

Purpose

Archive the broad authorization-policy exploration for design reference and selective salvage. This branch is intentionally not a landing candidate.

It explores sender-aware authorization across tool calls, message actions, commands, Gateway operations, queued delivery, harnesses, subagents, and channel identity propagation. It also contains adversarial tests for authority forgery, payload mutation, delayed effects, and run-replacement races.

Why this must not land

  • Scope expanded far beyond the intended one-file maintainer policy.
  • The branch changes hundreds of files and introduces a new authorization subsystem.
  • Integrated exact-head CI and live Discord verification are incomplete.
  • The branch is intentionally not rebased onto current main.
  • Review uncovered useful security cases, but the implementation did not converge into a reviewable owner boundary.

Intended successor

A separate minimal PR will use the existing hook system. Peter-versus-maintainer behavior will live in one local hook file. Core changes will be limited to the smallest authenticated caller context needed by that hook.

Preservation evidence

  • Diff-only Gitleaks scan: clean.
  • git diff --check: clean before checkpoint.
  • Many focused test slices passed during exploration, but they are not claimed as integrated release proof.
  • Autoreview bundle creation was blocked by a false positive on deleted test code assigning a helper result to a variable named modelToken; no secret value was present.

No landing, merge, deployment, or release is requested from this PR.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes scripts Repository scripts agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 10, 2026
@steipete
steipete force-pushed the codex/runtime-security-context branch from e8eaa80 to 66e90d7 Compare July 10, 2026 15:47
@clawsweeper clawsweeper Bot added rating: πŸ¦ͺ silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. status: πŸ“£ needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 11:01 PM ET / July 19, 2026, 03:01 UTC.

Summary
The draft adds a broad sender-aware authorization-policy plugin API, required-policy configuration, and authenticated turn-authority propagation across tool execution, commands, message actions, queues, sessions, channels, and Codex/ACPX runtimes.

Reproducibility: not applicable. This PR is an exploratory security-feature prototype, not a report of an existing reproducible defect. The branch includes adversarial tests, but its author does not claim integrated live proof or a merge-ready behavior path.

Review metrics: 1 noteworthy metric.

  • Authorization contract surface: 1 new plugin API plus 1 new operator fail-closed configuration family. Both surfaces become long-lived compatibility contracts for plugins and deployed Gateway configurations if any subset of this design is later landed.

Stored data model
Persistent data-model change detected: migration/backfill/repair: docs/docs_map.md, serialized state: src/sessions/session-lifecycle-admission.test.ts, serialized state: src/sessions/session-lifecycle-admission.ts, serialized state: src/sessions/session-work-admission-handoff.ts, serialized state: src/sessions/user-turn-idempotency.ts, serialized state: src/sessions/user-turn-transcript.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Record the maintainer decision on the intended hook and authenticated-context contract.
  • If sponsored, replace this archive with a focused successor that includes fresh-install, upgrade, and redacted live enforcement proof.

Risk before merge

  • [P1] If this branch were merged, the new fail-closed required-policy pins could stop tools, commands, or message actions for existing installations when a policy registration or handler is unavailable.
  • [P1] The proposed plugin API and authority snapshot propagate through multiple runtimes, channels, queues, and gateway paths; that creates a broad compatibility and availability boundary not resolved by the prototype’s focused tests.
  • [P1] The branch is intentionally stale against main and its body says integrated exact-head CI and live Discord verification are incomplete, so it cannot establish upgrade safety or real user behavior for a merge decision.

Maintainer options:

  1. Keep the archive non-mergeable (recommended)
    Retain the prototype solely as a reference and require a focused successor with explicit API, upgrade, and security-boundary approval before implementation.
  2. Adopt a staged security contract
    If maintainers want this direction, first land narrow contract tests and a hook-context seam, then separately review any fail-closed policy activation and cross-runtime propagation.

Next step before merge

  • [P1] Protected maintainer labeling and the author’s explicit non-landing intent require a human decision on the permanent security boundary; no automated repair should target this archive branch.

Maintainer decision needed

  • Question: Should the project retain this prototype only as design evidence and require any sender-aware authorization work to begin as a small hook-context extension, rather than adopting the new authorization-policy API and required-policy configuration proposed here?
  • Rationale: The permanent security contract determines plugin trust, caller identity provenance, fail-closed behavior, and upgrade/operator consequences across many runtimes; the author explicitly states that this archive did not converge on a reviewable owner boundary.
  • Likely owner: steipete β€” The PR body establishes the archival intent and the proposed narrower successor, making this the strongest available routing signal.
  • Options:
    • Archive and narrow the successor (recommended): Keep this draft non-mergeable and require a focused hook-based proposal that proves the exact missing authenticated context and enforcement boundary.
    • Sponsor the full policy API: Explicitly accept the wider plugin API and fail-closed configuration direction, then split it into owner-approved, independently reviewable contracts and runtime changes.
    • Defer the capability: Keep the prototype for reference but do not schedule a successor until a concrete supported use case establishes the required core extension gap.

Security
Needs attention: The intended authorization design changes trusted-plugin, caller-identity, and fail-closed execution boundaries across numerous runtimes, so it needs explicit security-contract approval before any subset is made mergeable.

Review details

Best possible solution:

Preserve the useful adversarial cases and design notes, then sponsor one narrowly scoped successor that reuses the existing typed hook system and adds only the authenticated caller facts demonstrably absent from that hook; require fresh-install and upgrade proof before any new permanent API or fail-closed setting is accepted.

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

Not applicable: this PR is an exploratory security-feature prototype, not a report of an existing reproducible defect. The branch includes adversarial tests, but its author does not claim integrated live proof or a merge-ready behavior path.

Is this the best way to solve the issue?

No: the author’s own successor plan and current plugin guidance favor a small typed-hook solution with only the authenticated caller context proven necessary, rather than a new cross-runtime policy subsystem and fail-closed configuration family.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b79c141fc702.

Label changes

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This protected maintainer draft explicitly says it is not a landing candidate and does not request merge; its reported exploratory tests are therefore not evaluated as merge-gate proof.
  • remove rating: πŸ¦ͺ silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: πŸ“£ needs proof: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: This is a substantial security and product-direction prototype, but it is explicitly non-landing and does not report an active user-facing emergency.
  • merge-risk: 🚨 compatibility: The draft adds a public plugin API and required-policy configuration that can alter existing plugin and upgrade behavior.
  • merge-risk: 🚨 security-boundary: It introduces caller-aware deny policies and authority propagation at side-effect boundaries, so an incomplete contract could weaken or misapply authorization.
  • merge-risk: 🚨 availability: Required policy pins are designed to fail closed and could deny normal tools, commands, or message actions when activation or registration fails.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This protected maintainer draft explicitly says it is not a landing candidate and does not request merge; its reported exploratory tests are therefore not evaluated as merge-gate proof.
Evidence reviewed

Security concerns:

  • [high] Resolve the permanent fail-closed policy contract first β€” src/plugins/plugin-api.types.ts:196
    The draft makes plugin registration and handler availability capable of denying tools, commands, and message actions. That is an intentional security boundary, but its upgrade behavior, supported principals, and owner scope need a maintainer-approved contract before code is split out.
    Confidence: 0.95
  • [medium] Avoid a parallel authorization surface without a seam comparison β€” src/plugins/registry-api.ts:266
    Current OpenClaw guidance already presents typed hooks as the preferred policy and tool-control extension point. Adding a separate authorization API without proving that hooks lack a necessary authenticated-context or final-enforcement seam risks conflicting security behavior.
    Confidence: 0.87

What I checked:

  • Explicit non-landing intent: The PR body says this is an experimental archive, explicitly requests no landing or merge, identifies the scope as hundreds of files plus a new authorization subsystem, and describes a separate minimal hook-based successor. (14a57dd06f1e)
  • Current extension seam: Current plugin documentation says typed runtime hooks through api.on(...) are the preferred surface for middleware, policy, message rewriting, prompt shaping, and tool control; this supports evaluating a narrow hook-based successor before introducing a parallel authorization API. Public docs: docs/tools/plugin.md. (docs/tools/plugin.md, b79c141fc702)
  • Policy-compatible scope guardrail: VISION.md prioritizes security and safe defaults, asks for one focused PR per topic, applies exceptional review to PRs above roughly 5,000 lines, and prefers plugin API extensions over one-off core behavior when a plugin cannot otherwise implement the need. (VISION.md, b79c141fc702)
  • New public and operator surfaces: The branch adds api.authorization.registerPolicy(...), manifest authorization-policy declarations, and plugins.entries..authorization.requiredPolicies with fail-closed operation pins; these are compatibility- and security-sensitive product contracts rather than a local implementation detail. (src/plugins/plugin-api.types.ts:196, 14a57dd06f1e)
  • Related work is only partial overlap: The related reports cover enriched before_tool_call context, persistent external-content tainting, and a general external guardrail interface. They overlap the motivation but do not establish one merged or proof-positive canonical replacement for this prototype.

Likely related people:

  • steipete: Authored both commits, assigned the draft to themself, renamed it to state the non-landing intent, and the PR body names the narrower successor direction. (role: project owner and prototype author; confidence: high; commits: e670d6d97bbd, 14a57dd06f1e; files: src/plugins/plugin-api.types.ts, src/plugins/turn-authority.ts, extensions/codex/src/app-server/run-attempt-runtime.ts)
What the crustacean ranks mean
  • πŸ¦€ challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • πŸ¦ͺ silver shellfish: thin signal; proof, validation, or implementation needs work.
  • πŸ§‚ unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-10T16:19:43.354Z sha 66e90d7 :: needs real behavior proof before merge. :: none

@steipete steipete self-assigned this Jul 18, 2026
@steipete
steipete force-pushed the codex/runtime-security-context branch from 66e90d7 to 14a57dd Compare July 19, 2026 02:56
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web labels Jul 19, 2026
@steipete steipete changed the title feat(plugins): add final tool input policies EXPERIMENTAL: authorization policy prototype β€” DO NOT LAND Jul 19, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: πŸ¦ͺ silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: πŸ“£ needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 19, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Minimal successor: #111190.

This experimental prototype remains DO NOT LAND. Keep it only as a design archive; review and testing should move to the minimal file-hook PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: qqbot channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes docs Improvements or additions to documentation extensions: acpx extensions: codex extensions: copilot feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant