Skip to content

feat(safety): deny specific flag values in baked profiles - #1263

Open
bautrey wants to merge 9 commits into
openclaw:mainfrom
bautrey:feat/safety-denied-values
Open

bautrey wants to merge 9 commits into
openclaw:mainfrom
bautrey:feat/safety-denied-values

Conversation

@bautrey

@bautrey bautrey commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

A baked agent-safe binary blocks gmail trash and the send paths, but these effects can still be reached through commands it allows:

  • gog gmail thread modify <id> --add TRASH trashes the thread. The same works through messages modify, labels modify and batch modify, and through --add-label on thread and batch.
  • gog calendar create|update|move ... --send-updates all emails every guest.
  • Focus-time and out-of-office events auto-decline conflicting invitations by default (all), and every decline notifies the organizer. You reach them through calendar focus-time, or through calendar create|update with --event-type, or with any --focus-*/--ooo-* flag, which infers the type.

Today a profile can allow or deny command paths and lock boolean flags. That means the only way to close these is to block the whole command, which takes label organizing and calendar writes away from agents.

This PR adds a denied-values profile key:

denied-values:
  gmail.thread.modify:
    add: [TRASH, SPAM]
    add-label: [TRASH, SPAM]
  calendar.create:
    send-updates: [all, externalonly]
    focus-chat-status: ["*"]
  • Keys are canonical command paths, matched exactly after Kong resolves aliases. gmail read edit is gmail thread modify.
  • A value is compared case-insensitively, first whole and then split on commas. trash, Trash and TRASH,INBOX are all refused, and so is a denied value that itself contains a comma. Splitting can only over-deny.
  • A sole "*" refuses any value typed on the command line, including an empty one. It also refuses any non-empty default. Use it for free-text flags whose mere presence causes the effect.
  • Defaults count. calendar focus-time with no --auto-decline is refused, because the parsed default is all.
  • Enforcement runs after the locked flags and before the command, so --dry-run is refused too. A refusal is a usage error (exit 2): flag --add value "trash" is denied for "gmail thread modify" by baked safety profile "agent-safe".
  • At startup the binary refuses to run if a rule names a missing command or flag, or a flag that is not a string or a list. This mirrors verifyLockedFlagsExist, so a typo can't claim a guarantee the binary doesn't give.
  • Nothing in a rule is stored as a string. The path and flag are hashed like the command rules, and each denied value is hashed together with them (safetyprofile.DeniedValueKey). The runtime hashes the value it was given, both whole and per comma part, before the switch. Whether a rule is "*" is compiled into the rule case.

agent-safe changes

  • Refuses TRASH/SPAM on the four Gmail modify commands, on --add, and on --add-label where it exists.
  • Refuses --send-updates all|externalonly on calendar create, update and move.
  • On calendar create, refuses the focus-time and out-of-office --event-type aliases, --focus-auto-decline/--ooo-auto-decline all|new, and any --focus-chat-status, --focus-decline-message or --ooo-decline-message. Explicit --focus-auto-decline none still works.
  • On calendar update, the same, except the auto-decline flags take "*". Update infers the type from any supplied focus/OOO flag, even an empty one, and an empty mode defaults to all.
  • Refuses calendar focus-time --auto-decline all|new, including the default.
  • Path-blocks calendar propose-time. Its --decline and --comment (which implies decline) patch the event with SendUpdates("all"), and --comment is a string a flag lock can't reach.
  • Path-blocks Drive comments create/update/reply and Docs comments add/reply. These notify anyone the comment @mentions.

The preset changes are separable from the profile key. Happy to drop any of them.

Built-binary proof (head baf3d02, profile safety-profiles/agent-safe.yaml)

Forbidden runs use a fake account and no --dry-run. The refusal comes before auth, so no request is built or sent. Permitted runs use --dry-run, which prints the request the handler would send. The comma case uses a second binary built from a one-rule profile (drive.upload: {name: ["private,report.txt"]}).

## Forbidden, refused before auth (no --dry-run)
$ gmail thread modify t1 --add TRASH
exit 2: flag --add value "TRASH" is denied for "gmail thread modify" by baked safety profile "agent-safe"
$ gmail messages modify m1 --add spam
exit 2: flag --add value "spam" is denied for "gmail messages modify" by baked safety profile "agent-safe"
$ gmail batch modify m1 m2 --add-label Trash
exit 2: flag --add-label value "Trash" is denied for "gmail batch modify" by baked safety profile "agent-safe"
$ calendar create primary --summary x --from ... --to ... --send-updates all
exit 2: flag --send-updates value "all" is denied for "calendar create" by baked safety profile "agent-safe"
$ calendar update primary e1 --send-updates externalOnly
exit 2: flag --send-updates value "externalOnly" is denied for "calendar update" by baked safety profile "agent-safe"
$ calendar move primary e1 other --send-updates all
exit 2: flag --send-updates value "all" is denied for "calendar move" by baked safety profile "agent-safe"
$ calendar create primary --summary Focus --from ... --to ... --event-type focus-time
exit 2: flag --event-type value "focus-time" is denied for "calendar create" by baked safety profile "agent-safe"
$ calendar create primary --summary Focus --from ... --to ... --focus-chat-status doNotDisturb
exit 2: flag --focus-chat-status value "doNotDisturb" is denied for "calendar create" by baked safety profile "agent-safe"
$ calendar create primary --summary Away --from ... --to ... --event-type ooo
exit 2: flag --event-type value "ooo" is denied for "calendar create" by baked safety profile "agent-safe"
$ calendar create primary --summary Away --from ... --to ... --ooo-decline-message away
exit 2: flag --ooo-decline-message value "away" is denied for "calendar create" by baked safety profile "agent-safe"
$ calendar update primary e1 --event-type focus
exit 2: flag --event-type value "focus" is denied for "calendar update" by baked safety profile "agent-safe"
$ calendar update primary e1 --focus-auto-decline ""
exit 2: flag --focus-auto-decline value "" is denied for "calendar update" by baked safety profile "agent-safe"
$ calendar focus-time --from ... --to ...
exit 2: flag --auto-decline value "all" is denied for "calendar focus-time" by baked safety profile "agent-safe"
$ calendar propose-time primary e1 --comment later
exit 2: command "calendar propose-time" is blocked by baked safety profile "agent-safe"
$ drive comments create f1 hello
exit 2: command "drive comments create" is blocked by baked safety profile "agent-safe"
$ docs comments add d1 hello
exit 2: command "docs comments add" is blocked by baked safety profile "agent-safe"
$ drive upload ./report.txt --name private,report.txt          (comma-proof profile)
exit 2: flag --name value "private,report.txt" is denied for "drive upload" by baked safety profile "comma-proof"

## Permitted, request retained (--dry-run)
$ --dry-run gmail thread modify t1 --add INBOX
exit 0: Dry run: would gmail.thread.modify  {"add": ["INBOX"], "remove": [], "thread_id": "t1"}
$ --dry-run calendar create primary --summary x --from ... --to ... --send-updates none
exit 0: Dry run: would calendar.create  {... "send_updates": "none" ...}
$ --dry-run calendar create primary --summary Focus --from ... --to ... --focus-auto-decline none
exit 0: Dry run: would calendar.create  {... "eventType": "focusTime", "focusTimeProperties": {"autoDeclineMode": "declineNone", "chatStatus": "doNotDisturb"} ...}
$ --dry-run calendar focus-time --from ... --to ... --auto-decline none
exit 0: Dry run: would calendar.focus-time  {... "focusTimeProperties": {"autoDeclineMode": "declineNone", ...} ...}

Testing

I wrote the tests first and ran each one red before implementing:

  • go test ./internal/safetyprofile/ -run DeniedValues exited 1 with Parse: unsupported safety profile value at "denied-values.gmail.thread.modify.add"
  • go test ./cmd/bake-safety-profile/ exited 1 with generated output missing case for calendar.create send-updates
  • go test ./internal/cmd/ -run "DeniedValues|AgentSafeProfile" exited 1. Example: the dry-run case returned {"dry_run": true, "op": "gmail.thread.modify" ...} instead of being refused. The focus/OOO cases reached runtime service is required: calendar.
  • TestDeniedValues_MatchesADeniedValueContainingAComma exited 1 against the split-only matcher.

make fmt, make lint and make test each exit 0 at the head.

Addressed from the ClawSweeper review of 085199d

  • [P2] Compare the complete flag value before splitting it: fixed in baf3d02, with a regression test.
  • [P1] Cover auto-declining events created through the general command: fixed in bd177a6 for create and update, covering both --event-type and type inference.
  • [P3] Contributor thanks: added in aaae5d1.
  • Owner decision on the new profile key and the preset changes: yours to make.

Transport proof (head c0df495, profile safety-profiles/agent-safe.yaml)

Each run went through a local HTTPS proxy that logs one line per CONNECT (host and port only, nothing decrypted), against a real account. A refused run opened no connection at all. A permitted run reached the production client. The Gmail thread already carried INBOX, so the permitted modify changed nothing, and its labels read the same afterwards. The calendar event was private, free, had no attendees, and was deleted afterwards. Account email and event link are redacted.

## Gmail
$ gog gmail thread modify <thread> --add TRASH
exit 2: flag --add value "TRASH" is denied for "gmail thread modify" by baked safety profile "agent-safe"
connections: none

$ gog gmail thread modify <thread> --add INBOX
exit 0: Modified thread <thread>
connections: CONNECT gmail.googleapis.com:443

## Calendar
$ gog calendar create primary --summary "gog #1263 proof (delete me)" --from 2026-12-31T23:00:00Z --to 2026-12-31T23:15:00Z --send-updates all
exit 2: flag --send-updates value "all" is denied for "calendar create" by baked safety profile "agent-safe"
connections: none

$ gog --json calendar create primary --summary "gog #1263 proof (delete me)" --from 2026-12-31T23:00:00Z --to 2026-12-31T23:15:00Z --visibility private --transparency free --no-reminders --send-updates none
exit 0: {"event": {"status": "confirmed", "visibility": "private", "transparency": "transparent", "eventType": "default", "organizer": {"email": "<redacted>", "self": true}, ...}}
connections: CONNECT www.googleapis.com:443

The proxy and the driver script are short and available on request.

Addressed from the ClawSweeper review of aaae5d1

  • [P3] Document that wildcard denials also reject non-empty defaults: fixed in the docs, with TestDeniedValues_AnyValueRefusesANonEmptyDefault. The test goes red when the default branch of the check is removed, because the dry run then emits autoDeclineMode: declineAllConflictingInvitations.
  • Rebased onto main after the 0.47.1 release, with no conflicts, and the changelog entry moved under 0.47.2 - Unreleased. The commit hashes above predate the rebase. make fmt, make lint and make test each exit 0 at the new head. The built-binary proof was captured at baf3d02; the enforcement code has not changed since, only docs, one test and the changelog.

Addressed from the ClawSweeper review of c0df495

  • [P2] Compile denied values without patchable string literals: fixed in the hashing commit below. The generator no longer emits any denied value. TestGenerateDeniedValuesEmitsHashedLookup ran red against the old generator, whose output contained return []string{"private,report.txt"}, and passes now. TestSafetyProfileDeniedValueHashAgreement pins the runtime key to the generator's key. It went red (runtime=0x384a5e248733b5b2 codegen=0x9863ab7239c23808) when I changed the runtime separator, and passed again once I restored it.
  • Built from the comma-proof profile (drive.upload: {name: ["private,report.txt"]}) at the new head:
    $ grep -c -a "private,report.txt" gog-comma
    0
    $ gog-comma drive upload ./report.txt --name Private,Report.txt
    exit 2: flag --name value "Private,Report.txt" is denied for "drive upload" by baked safety profile "comma-proof"
    $ gog-comma --dry-run drive upload ./report.txt --name private,report.csv
    exit 0: Dry run: would drive.upload {... "name": "private,report.csv" ...}
    
  • Merge conflict: rebased onto main after v0.48.0. The changelog entry is under 0.48.1 - Unreleased.
  • Upgrade comparison. I built agent-safe from v0.48.0, the latest release, and from this head, then ran both against the same existing config, keyring and authorized account. Every command in the comparison only reads, and the output is shown as hashes so no account data appears:
    ## Versions
    v0.48.0-safe (f939ed37151a)
    v0.48.0-11-gaef4aaa4-safe (aef4aaa41dd7)
    
    ## Existing settings and stored credentials, read by both
    config list         stable exit 0 sha 0a8d55f5c779d1f1 | candidate exit 0 sha 0a8d55f5c779d1f1 | identical
    auth list           stable exit 0 sha 2618e16f3bf49f7e | candidate exit 0 sha 2618e16f3bf49f7e | identical
    auth status         stable exit 0 sha 9cb2a80e273bfe4b | candidate exit 0 sha 9cb2a80e273bfe4b | identical
    
    ## Existing account data, read by both
    gmail labels list   stable exit 0 sha 54cc0fdf623a8dd6 | candidate exit 0 sha 54cc0fdf623a8dd6 | identical
    calendar calendars  stable exit 0 sha ad62d40476b549c3 | candidate exit 0 sha ad62d40476b549c3 | identical
    
    ## Commands visible in one binary and not the other (schema --json)
    < gog calendar (cal) propose-time
    < gog docs (doc) comments add (create,new)
    < gog docs (doc) comments reply (respond)
    < gog drive (drv) comments create (add,new)
    < gog drive (drv) comments reply (respond)
    < gog drive (drv) comments update (edit,set)
    
    ## New refusals (candidate only; stable accepts these with --dry-run)
    $ gmail thread modify t1 --add TRASH
      stable exit 0 | candidate exit 2: flag --add value "TRASH" is denied for "gmail thread modify" by baked safety profile "agent-safe"
    $ calendar create primary --summary x --from ... --to ... --send-updates all
      stable exit 0 | candidate exit 2: flag --send-updates value "all" is denied for "calendar create" by baked safety profile "agent-safe"
    $ calendar focus-time --from ... --to ...
      stable exit 0 | candidate exit 2: flag --auto-decline value "all" is denied for "calendar focus-time" by baked safety profile "agent-safe"
    
    The profile is compiled in and keeps no state of its own, so an upgrade leaves the config, the keyring and the tokens as they were. The comparison shows what changes: six commands disappear and three values are refused, all intended.
  • Owner decision on the new key and the preset scope: yours to make. The preset changes come apart from the key if you want only part of them.

Plan: none -- upstream contribution, the design is described in this PR body

🤖 Generated with Claude Code

https://claude.ai/code/session_01NAC67iQrvrvQdbbutzzLzg

@clawsweeper

clawsweeper Bot commented Oct 24, 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.

bautrey added a commit to bautrey/gogcli-upstream that referenced this pull request Oct 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. 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. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: ready, awaiting a maintainer decision.

What this changes

Adds command-specific denied flag values to baked safety profiles and tightens agent-safe against destructive Gmail labels and notification-producing operations.

Example: An agent-safe binary receives gog gmail thread modify t1 --add TRASH.

  • Before: The allowed modify command can move the thread to trash.
  • After: The binary refuses the value with exit 2 before authentication or command execution.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Relevant binary, transport, and upgrade evidence supports a technically sound patch; unresolved product sponsorship caps overall readiness.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Contributor terminal evidence exercises baked CLI enforcement, permitted production Gmail and Calendar requests, forbidden requests opening no connection, and current-head hashed comma-value matching; the latest-stable comparison preserves existing settings and account reads.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: An agent-safe caller can trash mail or cause notifications through commands that the preset otherwise permits.
Reason: The use case has concrete value, but a new YAML contract and stricter shipped preset require the safety-profile owner's direction.

Merge readiness

⏳ Ready, awaiting maintainer decision

Keep open: this PR supplies a useful capability absent from main, resolves the prior code findings, and still needs an owner decision on the new policy contract and preset restrictions.

Priority: P2
Reviewed head: aef4aaa41dd75ea214195aa82f08bcbd003b55be
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should denied-values become a supported baked-profile key, and should agent-safe remove the six previously allowed commands and reject the proposed Gmail and Calendar values?
  • Recommendation: Approve the key and stricter preset: Accept the documented capability reductions to enforce agent-safe's destructive-action and notification boundary.
  • Why: This extends the intentionally boolean-only flag-policy surface and changes an owner-authored preset; the discussion contains contributor proposals but no written owner approval.

Before merge

None.

Findings

None.

Agent review details

How this fits together

Build-time YAML parsing generates immutable policy lookups; the CLI checks parsed command paths and flag values before handlers can invoke Google APIs.

flowchart LR
 A[Profile YAML] --> B[Parser and generator]
 B --> C[Baked hash lookups]
 D[CLI arguments and defaults] --> E[Kong parser]
 E --> F[Command and flag policy]
 C --> F
 F --> G[Allowed Google API operation]
Loading

Technical review

Best possible solution:

Adopt the existing parser-generator-enforcement design with an explicitly approved denied-values contract and agent-safe scope.

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

Current-main command grants and handler behavior establish the reported TRASH and notification paths; the contributor also supplies stable-versus-candidate CLI comparisons, without reviewer execution.

Is this the best way to solve the issue?

Command-specific value checks reuse the existing baked-policy owner and preserve permitted organizing operations, while broader preset removals remain a product choice.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6af89c8 adds internal/cmd/safety_profile.go:67 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6af89c8dd7cb; files: internal/cmd/safety_profile.go)
  • Drew Burchfield: Raw commit 4690010 adds cmd/bake-safety-profile/main.go:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 46900109e029; files: cmd/bake-safety-profile/main.go)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Implementation and regression coverage Production Go +329/-8; tests +700/-0 The change spans profile parsing, generated lookups, and CLI enforcement, with coverage for distinct matching and policy-validation failures.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: This is a bounded safety-profile improvement affecting custom baked binaries.
  • merge-risk: 🚨 compatibility: Existing agent-safe workflows lose six commands and gain value refusals, including rejection of the default focus-time auto-decline mode.
  • merge-risk: 🚨 security-boundary: The PR extends the immutable policy deciding which caller-controlled values may reach Gmail and Calendar effects.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-24T18:17:46.228Z sha 085199d :: needs real behavior proof before merge. :: [P2] Compare the complete flag value before splitting it | [P1] Cover auto-declining events created through the general command | [P3] Add contributor thanks to the Unreleased entry
  • reviewed 2026-10-24T19:00:39.563Z sha aaae5d1 :: needs real behavior proof before merge. :: [P3] Document that wildcard denials also reject non-empty defaults
  • reviewed 2026-11-11T21:02:09.403Z sha c0df495 :: needs real behavior proof before merge. :: [P2] Compile denied values without patchable string literals

Reviewed November 13, 2026, 4:09 PM ET / 21:09 UTC (Revision 4).

bautrey added a commit to bautrey/gogcli-upstream that referenced this pull request Oct 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
@bautrey

bautrey commented Oct 24, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 24, 2026
@bautrey
bautrey force-pushed the feat/safety-denied-values branch from 62bdc9c to c0df495 Compare November 4, 2026 23:59
bautrey added a commit to bautrey/gogcli-upstream that referenced this pull request Nov 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
bautrey added a commit to bautrey/gogcli-upstream that referenced this pull request Nov 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
bautrey added a commit to bautrey/gogcli-upstream that referenced this pull request Nov 4, 2026
0.47.1 shipped on 2026-10-26 without this change, so the entry belongs in the open release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2aiSKKPHZ2qnjrALo2Y1A
@bautrey

bautrey commented Nov 11, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 11, 2026
Add a denied-values profile key that refuses named values of string and list flags on a specific command. agent-safe uses it to refuse the TRASH and SPAM labels on the Gmail modify commands and --send-updates all|externalOnly on calendar create, update and move, which were reachable through allowed commands. agent-safe also blocks calendar propose-time and Drive and Docs comment writes, which notify other people.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
calendar focus-time defaults to --auto-decline all, and declining a conflicting invitation notifies its organizer. Deny all and new so agent-safe only creates focus time with an explicit --auto-decline none. Denied values are read from the parsed flag, so the default is refused too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
…gent-safe

A denied-values list of ["*"] refuses any value typed for the flag. agent-safe uses it, plus the focus-time and out-of-office event-type aliases, to stop calendar create and update from making focus or OOO events whose auto-decline defaults to all and notifies organizers. Explicit --focus-auto-decline none and --ooo-auto-decline none still work on create. update infers the type from any supplied focus or OOO flag, even an empty one, so its auto-decline flags take ["*"].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
- codex: a denied value containing a comma never matched, because only the comma-separated parts of the input were compared. The whole trimmed value is now compared too (--add-label takes names literally, commas included). Test fails without the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
bautrey and others added 4 commits November 13, 2026 14:53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01K1fj3CKEioe5f7QqomgCCv
An omitted flag is allowed under "*" only when its default is empty. calendar focus-time with auto-decline: ["*"] still refuses an omitted --auto-decline, whose default is all. Also say values are compared whole before comma splitting. The new test fails when the default branch of the check is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2aiSKKPHZ2qnjrALo2Y1A
0.47.1 shipped on 2026-10-26 without this change, so the entry belongs in the open release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2aiSKKPHZ2qnjrALo2Y1A
The generator hashed the command path and flag of a denied-values rule but
emitted the refused values as string literals, so an equal-length edit of the
binary (private,report.txt -> private,report.csv) could lift a denial without
touching compiled code. That reopened the ASCII patching the Tamper Resistance
section and openclaw#540 closed.

Each refused value is now hashed with its path and flag
(safetyprofile.DeniedValueKey, NUL before the value), and the runtime hashes the
whole value and each comma part the same way before the switch. The rule case
reports whether it refuses any value, so "*" is compiled control flow too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NAC67iQrvrvQdbbutzzLzg
@bautrey
bautrey force-pushed the feat/safety-denied-values branch from c0df495 to aef4aaa Compare November 13, 2026 21:00
@bautrey

bautrey commented Nov 13, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 13, 2026

This branch has not been deployed

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

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant