Skip to content

feat(exec): expose knownLongFlags in safeBinProfiles config schema - #56806

Closed
spencer2211 wants to merge 1 commit into
openclaw:mainfrom
spencer2211:expose-known-long-flags
Closed

spencer2211 wants to merge 1 commit into
openclaw:mainfrom
spencer2211:expose-known-long-flags

Conversation

@spencer2211

@spencer2211 spencer2211 commented Mar 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expose the knownLongFlags field in the safeBinProfiles config schema, allowing operators to declare long flags as "known" for GNU abbreviation resolution without misusing allowedValueFlags or deniedFlags.

Closes #56805

Rebased 2026-06-10. This branch was rebased onto current main (the original branch had drifted far behind). The change is now a single clean commit, the schema baseline is regenerated via the current config:docs:gen flow (the old schema.base.generated.ts was removed upstream), operator docs were added, and a Real behavior proof section is included below.

Problem

The knownLongFlags field exists internally in SafeBinProfile and is used by validateSafeBinArgv for GNU long-option abbreviation resolution. However, it is not present in:

  1. The Zod schema (ToolExecSafeBinProfileSchema) — .strict() rejects it as an unknown key
  2. The SafeBinProfileFixture type — no way to pass it through config normalization

For empty profiles {}, knownLongFlags auto-derives as [], causing all long flags to be treated as unknown and rejected. The only workaround is to list every possible long flag in allowedValueFlags or deniedFlags, which changes their semantics.

Changes

File Change
src/config/zod-schema.agent-runtime.ts Add knownLongFlags: z.array(z.string()).optional() to ToolExecSafeBinProfileSchema
src/infra/exec-safe-bin-policy-profiles.ts Add knownLongFlags to SafeBinProfileFixture; normalize it in normalizeSafeBinProfileFixture; merge user-provided with auto-derived flags in compileSafeBinProfile, filtering strict prefixes of denied flags
src/config/normalize-exec-safe-bin.ts Add knownLongFlags to the type cast in normalization
docs/tools/exec-approvals-advanced.md Document the field, its auto-derivation default, and the prefix-filter security semantics
docs/.generated/config-baseline.sha256 Regenerated via pnpm config:docs:gen for the new field
src/infra/exec-safe-bin-policy.test.ts 8 new tests for the config path + security filter

Design Decisions

  • Merge, don't replace: User-provided knownLongFlags are merged with auto-derived flags from allowedValueFlags ∪ deniedFlags, so flags in those lists stay "known" even if not explicitly listed.
  • Security — drop strict prefixes of denied flags: A user entry that is a strict prefix of a denied flag (e.g. --rec when --recursive is denied) is filtered at compile time, so it cannot gain exact-match priority in resolveCanonicalLongFlag and bypass the denial. (Addresses the prior Codex review P1.)
  • Reuses normalizeFixtureFlags: Same normalization (trim, dedupe, sort) as other flag arrays.
  • Backwards-compatible: Existing configs without knownLongFlags work identically via auto-derivation.

Usage

{
  tools: {
    exec: {
      safeBins: ["mycli"],
      safeBinProfiles: {
        mycli: {
          allowedValueFlags: ["--limit"],
          deniedFlags: ["--recursive"],
          knownLongFlags: ["--dry-run", "--verbose"],
        },
      },
    },
  },
}

Real behavior proof

Behavior or issue addressed: Setting tools.exec.safeBinProfiles.<bin>.knownLongFlags in a real config previously could not be accepted — the strict Zod schema had no such key. After this patch the field is accepted by config validation and is honored by the safe-bin argv validator (declared long flags resolve, including GNU abbreviation), while strict prefixes of denied flags are still blocked.

Real environment tested: Local OpenClaw build from this branch, OpenClaw 2026.6.2 (bb6e477), Node v22.22.0, run via the real openclaw CLI and the compiled exec-safe-bin-policy module (not mocks).

Exact steps or command run after this patch:

# 1) Real CLI accepts a config containing knownLongFlags
OPENCLAW_CONFIG_PATH=/tmp/klf-proof.json5 openclaw config validate --json
# config: { tools: { exec: { safeBins: ["mycli"], safeBinProfiles: {
#   mycli: { allowedValueFlags: ["--limit"], deniedFlags: ["--recursive"],
#            knownLongFlags: ["--dry-run", "--verbose"] } } } } }

# 2) Same CLI still rejects an unknown key (the pre-fix state of knownLongFlags)
OPENCLAW_CONFIG_PATH=/tmp/klf-proof-unknown.json5 openclaw config validate --json
#   ( mycli: { knownLongFlagsTYPO: ["--dry-run"] } )

# 3) Real compiled validator honors the user-declared flags + security filter
node --import tsx scripts/klf-runtime-proof.mts

Evidence after fix:

# step 1 — openclaw config validate (knownLongFlags present)
{"valid":true,"path":"/tmp/klf-proof.json5"}

# step 2 — openclaw config validate (unknown key knownLongFlagsTYPO)
{"valid":false,"path":"/tmp/klf-proof-unknown.json5",
 "issues":[{"path":"tools.exec.safeBinProfiles.mycli","message":"Invalid input"}]}

# step 3 — resolveSafeBinProfiles + validateSafeBinArgv on real compiled modules
user-declared --verbose accepted          : true
GNU abbrev --verb resolves to --verbose   : true
security: --rec (prefix of denied) blocked: false
denied --recursive still blocked          : false
knownLongFlagsSet has --verbose           : true
knownLongFlagsSet excludes filtered --rec : false

Observed result after fix: The live openclaw config validate returns valid: true for a config carrying knownLongFlags, and still returns valid: false for an unknown sibling key — confirming the field is genuinely wired into the strict schema. At runtime the compiled validator accepts the user-declared --verbose, resolves the --verb abbreviation to it, keeps --recursive denied, and drops the --rec prefix so it cannot bypass that denial.

What was not tested: End-to-end exec of a real third-party binary through the approval pipeline (requires a trusted-dir executable); behavior is covered at the policy/validator layer instead.

Test Plan

  • All tests in exec-safe-bin-policy.test.ts pass: 98 passed (90 existing + 8 new) under vitest.infra.config.ts
  • pnpm config:docs:check and pnpm config:schema:check pass (baseline in sync, no drift)
  • oxlint clean on changed files; no new type errors introduced
  • Real behavior proof captured above via the openclaw CLI and compiled validator

@greptile-apps

greptile-apps Bot commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR exposes the knownLongFlags field in the safeBinProfiles config schema, fixing a crash (Unrecognized key) when operators specify long flags for GNU abbreviation resolution. The change is backwards-compatible and well-structured.

Key changes:

  • ToolExecSafeBinProfileSchema now includes knownLongFlags: z.array(z.string()).optional(), eliminating the .strict() crash
  • SafeBinProfileFixture gains the knownLongFlags field; normalization and compilation updated to merge user-provided flags with auto-derived flags from allowedValueFlags ∪ deniedFlags
  • The type cast in normalize-exec-safe-bin.ts is kept in sync
  • schema.base.generated.ts regenerated correctly
  • 6 new tests covering the config path, all well-scoped and assertions are correct

The merge-over-replace strategy is the right call: it preserves the invariant that every flag in allowedValueFlags and deniedFlags is always "known" regardless of what knownLongFlags contains. The validator in exec-safe-bin-policy-validator.ts correctly uses resolveCanonicalLongFlag (which checks knownLongFlagsSet before the prefix map), so exact flags remain unambiguous even when a longer flag shares their prefix.

Confidence Score: 5/5

Safe to merge — the change is additive, backwards-compatible, and the core validator logic is unchanged.

No P0 or P1 issues found. The Zod schema fix, fixture type update, normalization flow, and merge strategy are all correct. Edge cases (flags-in-both-sets, empty arrays, non---prefixed strings) are handled safely by the existing validator pipeline. The 6 new tests exercise the important paths including GNU abbreviation, denial precedence, and merge idempotency.

No files require special attention.

Important Files Changed

Filename Overview
src/config/zod-schema.agent-runtime.ts Added knownLongFlags: z.array(z.string()).optional() to ToolExecSafeBinProfileSchema; directly fixes the .strict() crash. Consistent with adjacent fields.
src/infra/exec-safe-bin-policy-profiles.ts Added knownLongFlags to SafeBinProfileFixture type; merge strategy in compileSafeBinProfile unions user-provided flags with auto-derived flags correctly; normalizeSafeBinProfileFixture delegates to normalizeFixtureFlags consistently.
src/config/normalize-exec-safe-bin.ts Type cast updated to include knownLongFlags, keeping it in sync with SafeBinProfileFixture.
src/config/schema.base.generated.ts Regenerated schema correctly reflects the new knownLongFlags field in both relevant locations.
src/infra/exec-safe-bin-policy.test.ts 6 new tests covering boolean flags, inline value rejection, unknown flag rejection, merge idempotency, GNU abbreviation, and deduplication with allow/deny — all assertions are correct.

Reviews (1): Last reviewed commit: "feat(exec): expose knownLongFlags in saf..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 856a903119

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const knownLongFlags = collectKnownLongFlags(allowedValueFlags, deniedFlags);
const derivedKnownLongFlags = collectKnownLongFlags(allowedValueFlags, deniedFlags);
const knownLongFlags = fixture.knownLongFlags
? Array.from(new Set([...derivedKnownLongFlags, ...fixture.knownLongFlags]))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject abbreviated entries in knownLongFlags

Merging fixture.knownLongFlags directly into the compiled profile allows non-canonical prefixes (for example --rec) to become exact canonical hits. In validateSafeBinArgv, resolveCanonicalLongFlag checks knownLongFlagsSet before prefix resolution, so --rec is treated as canonical --rec and bypasses deniedFlags entries like --recursive; GNU tools can still interpret --rec as --recursive, re-enabling denied behavior. Since this commit exposes knownLongFlags through config, this creates a new denial-bypass path for misconfigured profiles unless knownLongFlags is validated/normalized to full canonical long flags.

Useful? React with 👍 / 👎.

spencer2211 added a commit to spencer2211/openclaw that referenced this pull request Mar 30, 2026
…lags

Addresses review feedback on PR openclaw#56806. User-provided knownLongFlags
entries that are strict prefixes of denied flags (e.g. "--rec" when
"--recursive" is denied) would get exact-match priority in
resolveCanonicalLongFlag, bypassing the denial check. The flag resolves
to itself rather than the denied canonical form.

Filter these entries at compile time in compileSafeBinProfile. Full
canonical forms (e.g. "--recursive" itself) are unaffected — they're
already auto-derived from deniedFlags and denied at validation time.

Adds 2 tests covering the prefix-filtering and non-prefix preservation.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@spencer2211

Copy link
Copy Markdown
Contributor Author

Thanks for flagging this — the concern is valid. A user-provided knownLongFlags entry like --rec would get exact-match priority in resolveCanonicalLongFlag (line 53), resolving to itself rather than --recursive via prefix expansion. Since deniedFlags.has("--rec") is false, this bypasses the denial.

Fixed in 481f67b: compileSafeBinProfile now filters user-provided knownLongFlags that are strict prefixes of any denied flag. Full canonical forms (e.g. --recursive itself) are unaffected — they're already auto-derived via collectKnownLongFlags and denied at validation time.

Added 2 tests:

  • Verifies --rec and --recu are rejected when --recursive is denied (prefix filter works)
  • Verifies --verbose and --version are preserved when they're not prefixes of denied flags

@spencer2211

Copy link
Copy Markdown
Contributor Author

Friendly bump — this has been open for a couple of weeks now. Happy to address any feedback or make changes if needed. Also happy to rebase if the branch has drifted.

Re: the Codex bot's note about abbreviated flags in knownLongFlags — the same risk exists today for allowedValueFlags and deniedFlags (an operator could put --rec in either). This PR is consistent with that existing behavior, but I can add a validation step if the team prefers.

@spencer2211

Copy link
Copy Markdown
Contributor Author

Small clarification on my comment from April 10 — I said I was "happy to rebase or add validation if the team prefers," but looking back at the branch history, validation was actually already pushed in 481f67b on 2026-03-30, directly in response to the Codex P1 concern.

That commit filters any user-supplied knownLongFlags entry that would be a strict prefix of a denied flag, closing the --rec → --recursive bypass path. So from our side the PR is ready to merge — happy to iterate further on any additional feedback.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 30, 2026
@clawsweeper

clawsweeper Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 20, 2026, 7:57 PM ET / 23:57 UTC.

Summary
The PR adds tools.exec.safeBinProfiles.<bin>.knownLongFlags, merges those values into safe-bin GNU long-option resolution with denied-prefix filtering, and updates docs, generated config baselines, and regression tests.

PR surface: Source +23, Tests +111, Docs +13, Generated 0. Total +147 across 8 files.

Reproducibility: yes. for the reported configuration gap: current main's strict schema lacks knownLongFlags, while the PR body supplies after-fix CLI validation and compiled-policy output. This review did not execute the reproduction locally.

Review metrics: 1 noteworthy metric.

  • Public exec config surface: 1 added, 0 removed. One new safeBinProfiles key changes what operators can authorize through the exec approval policy.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #56805
Summary: This PR is the active candidate implementation for the closed report requesting the same knownLongFlags configuration exposure; adjacent safe-bin PRs address distinct policy behavior.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
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:

  • Obtain an explicit maintainer decision on whether custom safe-bin profiles may expose recognized boolean long flags as public configuration.

Risk before merge

  • [P1] Merging creates a durable operator-controlled execution-approval setting for arbitrary custom long flags, while current adjacent behavior intentionally limits comparable boolean-flag recognition to built-in profiles.
  • [P1] The denied-prefix filter addresses the reported --rec versus --recursive bypass, but it does not answer whether this configuration capability should become a supported security contract for custom safe bins.

Maintainer options:

  1. Decline the public setting (recommended)
    Keep the current built-in-only recognition model so custom profiles cannot expand the auto-approved boolean-flag surface.
  2. Approve the contract explicitly
    Sponsor the new configuration key only after confirming that operator-defined boolean flags are intended to be part of the safe-bin approval contract.

Next step before merge

  • [P2] A maintainer must decide the permanent custom safe-bin configuration and approval-boundary contract; no mechanical repair can resolve that choice.

Maintainer decision needed

  • Question: Should custom safeBinProfiles let operators declare arbitrary canonical boolean long flags through knownLongFlags, or should recognized boolean metadata remain built-in-only?
  • Rationale: The patch is mechanically narrow and has real CLI/policy proof, but it changes the supported configuration and security boundary for auto-approved exec commands; tests cannot determine the intended long-term product contract.
  • Likely owner: steipete — The PR timeline already routed the unresolved product question here, although direct ownership evidence is limited.
  • Options:
    • Keep metadata built-in-only (recommended): Decline the new public configuration field and retain the current model in which recognized boolean flags are curated in built-in safe-bin profiles.
    • Sponsor the custom-profile contract: Accept knownLongFlags as a supported operator setting, with the proposed denied-prefix protection and explicit documentation of its trust and approval semantics.

Security
Needs attention: The patch has no demonstrated denial-prefix defect after its filter, but it exposes a new operator-controlled setting at the safe-bin execution-approval boundary that needs explicit product sponsorship.

Review details

Best possible solution:

Close this stale PR as superseded: Decline the public setting. Keep the current built-in-only recognition model so custom profiles cannot expand the auto-approved boolean-flag surface.

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

Yes for the reported configuration gap: current main's strict schema lacks knownLongFlags, while the PR body supplies after-fix CLI validation and compiled-policy output. This review did not execute the reproduction locally.

Is this the best way to solve the issue?

Unclear. The implementation is a narrow solution to the schema gap, but current adjacent safe-bin work intentionally keeps comparable boolean-flag recognition built-in-only, so maintainer product approval is required before calling this the best solution.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a bounded but security-sensitive configuration capability addition that needs a normal-priority maintainer decision.
  • merge-risk: 🚨 compatibility: Adding a public config key creates a supported operator contract that future changes must preserve or migrate.
  • merge-risk: 🚨 security-boundary: The new key changes which long options a custom safe-bin profile can recognize in an auto-approval policy.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body provides after-fix terminal evidence that the real CLI accepts knownLongFlags, rejects an unknown sibling key, and that the compiled validator accepts declared flags while preserving the denied-prefix block.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix terminal evidence that the real CLI accepts knownLongFlags, rejects an unknown sibling key, and that the compiled validator accepts declared flags while preserving the denied-prefix block.
Evidence reviewed

PR surface:

Source +23, Tests +111, Docs +13, Generated 0. Total +147 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 24 1 +23
Tests 1 111 0 +111
Docs 2 14 1 +13
Config 0 0 0 0
Generated 2 6 6 0
Other 0 0 0 0
Total 8 155 8 +147

Security concerns:

  • [medium] Confirm custom flag recognition is an intended security contract — src/config/zod-schema.agent-runtime.ts:510
    Adding knownLongFlags lets custom profiles classify additional long options as recognized for approval-policy parsing. Current adjacent work keeps comparable boolean metadata built-in-only, so merge requires an explicit decision that this broader operator-controlled surface is intended.
    Confidence: 0.93

What I checked:

  • recommended close path: the latest review's recommended merge-risk option is Decline the public setting, categorized as pause_or_close.
  • stale PR: PR was opened 2026-03-29T04:58:34Z, which is older than the 30-day stale promotion threshold.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • yetval: Authored the merged safe-bin boolean-flag work that established the current built-in-only behavior adjacent to this proposed public config surface. (role: recent adjacent contributor; confidence: medium; commits: 1bac1022e65b; files: src/infra/exec-safe-bin-policy-profiles.ts, src/infra/exec-safe-bin-policy.test.ts)
  • steipete: The PR timeline explicitly routed this pending product question to this person; the available context does not establish direct code ownership. (role: likely product decision owner; confidence: low; files: src/config/zod-schema.agent-runtime.ts, src/infra/exec-safe-bin-policy-profiles.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 (5 earlier review cycles)
  • reviewed 2026-07-04T01:54:32.725Z sha f2cc40a06418408a68e10ff95a48fabb496ef5f4 :: found issues before merge. :: [P3] Update the exec config overview
  • reviewed 2026-07-05T16:38:07.938Z sha f2cc40a06418408a68e10ff95a48fabb496ef5f4 :: found issues before merge. :: [P3] Update the exec config overview
  • reviewed 2026-07-06T04:30:28.839Z sha 69923f772ccd327ff6a3314e0a31548ea135848a :: found issues before merge. :: [P3] Run the docs formatter on the exec overview
  • reviewed 2026-07-12T05:14:01.348Z sha cbe4b337e06f3517ac85b55e3ac0d9e36ab6bfe3 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-20T23:14:32.031Z sha 510a228 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 1, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper clawsweeper Bot added 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. labels May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 10, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. 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 Jun 10, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 10, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 10, 2026
@spencer2211
spencer2211 force-pushed the expose-known-long-flags branch from 481f67b to d3209dc Compare June 10, 2026 14:52
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jun 10, 2026
@clawsweeper

clawsweeper Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 10, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Jun 10, 2026
@spencer2211
spencer2211 force-pushed the expose-known-long-flags branch from d3209dc to c8f79b0 Compare June 26, 2026 00:30
@spencer2211

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (2026-06-25) — the branch had drifted ~3,980 commits behind and GitHub had flagged it conflicting. Production changes (zod-schema.agent-runtime.ts, exec-approvals-advanced.md) re-applied cleanly; the only conflict was the generated docs/.generated/config-baseline.sha256, which I regenerated via config:docs:gen against the current schema (not hand-merged).

Re-verified on current main (Node 22):

  • config:docs:check ✅ and config:schema:check ✅ (baseline in sync, no drift)
  • exec-safe-bin-policy.test.ts 98/98 passing (90 existing + 8 new)
  • tsgo:core clean

Real-behavior proof and the strict-prefix denial-bypass filter (the original Codex P1) are unchanged. @clawsweeper re-review

@spencer2211

Copy link
Copy Markdown
Contributor Author

Refreshed against current main (2026-07-02) — the branch had drifted conflicting again. Same single production change rebased clean (f2cc40a); the only conflict was the generated docs/.generated/config-baseline.sha256, regenerated via config:docs:gen against the current schema (not hand-merged).

Re-verified on current main (Node 22):

  • config:docs:check ✅ and config:schema:check ✅ (baseline in sync, no drift)
  • exec-safe-bin-policy.test.ts 98/98 passing
  • tsgo:core ✅ and tsgo:test:src ✅

@spencer2211
spencer2211 force-pushed the expose-known-long-flags branch from f2cc40a to 69923f7 Compare July 6, 2026 04:01
@spencer2211

Copy link
Copy Markdown
Contributor Author

Refreshed against current main (d957f5a) and addressed the P3 docs finding.

Rebase: branch had gone CONFLICTING again as main moved. Rebased to a single clean commit (69923f7). Two conflicts resolved:

  • docs/.generated/config-baseline.sha256 — regenerated via config:docs:gen against the rebased schema (not hand-merged).
  • docs/tools/exec-approvals-advanced.md — kept the two knownLongFlags explanation paragraphs; dropped the trailing jq -n env paragraph because current main already documents that safe-bin rejection earlier in the same file, so it was now a duplicate.

P3 (review finding — docs overview alignment): docs/tools/exec.md now lists knownLongFlags alongside minPositional/maxPositional/allowedValueFlags/deniedFlags in the safeBinProfiles quick overview, so the schema, advanced docs, and overview stay aligned.

Re-verified on the new head (Node 22):

  • config:docs:check ✅ and config:schema:check ✅ (baseline in sync)
  • exec-safe-bin-policy.test.ts 98/98 passing
  • tsgo:core ✅ and tsgo:test:src ✅

The strict-prefix denial-bypass filter (original Codex P1) is unchanged. The remaining item — accepting knownLongFlags as public operator config — is the maintainer decision noted in the review.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@spencer2211

Copy link
Copy Markdown
Contributor Author

Refreshed against current main (f7e0a614) — the branch had gone CONFLICTING again as main moved. Rebased to a single clean commit (cbe4b33).

Conflicts resolved:

  • src/infra/exec-safe-bin-policy-profiles.ts — main added allowedBooleanFlags as a third argument to collectKnownLongFlags. Kept this PR's user-supplied-knownLongFlags merge (with the strict-prefix denial-bypass filter) and adopted main's 3-arg derive call: collectKnownLongFlags(allowedValueFlags, deniedFlags, allowedBooleanFlags).
  • src/infra/exec-safe-bin-policy.test.ts — kept main's newly added type SafeBinProfileFixtures import.
  • docs/.generated/config-baseline.sha256 — regenerated via config:docs:gen against the rebased schema (not hand-merged).

Re-verified on the new head (Node 22):

  • config:docs:check ✅ and config:schema:check ✅
  • exec-safe-bin-policy.test.ts 118/118 passing (now includes main's added profile tests alongside this PR's)
  • tsgo:core ✅ and tsgo:test:src ✅ for this PR's files

Note: tsgo:test:src currently surfaces a pre-existing, unrelated error on main in src/state/openclaw-state-db.test.ts ("schema_version" vs SqliteNumberPragma), introduced by the recent SQLite hardening (#104952 / #104859). It is outside this PR's diff (which touches only exec-safe-bin/config files) and clears once main's own file is fixed.

The strict-prefix denial-bypass filter (original Codex P1) is unchanged. The remaining item — accepting knownLongFlags as public operator config — is the maintainer decision noted in the review.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

knownLongFlags is used internally by validateSafeBinArgv for GNU
long-option abbreviation resolution, but was not exposed in the config
schema. Attempting to set it crashed the strict() Zod schema with an
"Unrecognized key" error.

This change:
- Adds knownLongFlags to ToolExecSafeBinProfileSchema (Zod) and the
  SafeBinProfileFixture type, and normalizes it in the config + fixture
  normalizers
- Merges user-provided knownLongFlags with the auto-derived set from
  allowedValueFlags union deniedFlags in compileSafeBinProfile
- Filters any user entry that is a strict prefix of a denied flag, so a
  short form like "--rec" cannot gain exact-match priority and bypass the
  denial of "--recursive" (addresses prior Codex review feedback)
- Documents the field, its auto-derivation default, and the prefix-filter
  security semantics in docs/tools/exec-approvals-advanced.md
- Regenerates docs/.generated/config-baseline.sha256 for the new field
- Adds 8 tests covering the config path, GNU abbreviation, merge with
  auto-derivation, and the strict-prefix-of-denied security filter

Backwards-compatible: existing configs without knownLongFlags continue to
work identically via auto-derivation.

Closes openclaw#56805

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@spencer2211
spencer2211 force-pushed the expose-known-long-flags branch from cbe4b33 to 510a228 Compare July 20, 2026 23:10
@spencer2211

Copy link
Copy Markdown
Contributor Author

Refreshed against current main — the branch had gone CONFLICTING/DIRTY again as main moved, so check-docs was red on a stale config baseline.

  • Rebased to a single clean commit; the only source conflict was the perpetual generated docs/.generated/config-baseline.sha256, resolved by regenerating (config:docs:gen), not hand-merging.
  • Fixed one test-type error surfaced by main's stricter noUncheckedIndexedAccess: the new knownLongFlags tests accessed resolveSafeBinProfiles(...) results by index directly. Switched to the file's existing expectDefined(...) idiom.

Green locally: 117/117 infra unit tests, tsgo:core + tsgo:core:test clean, config:docs:check + config:schema:check OK. Now MERGEABLE. No behavior change — same public knownLongFlags config surface as before.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 21, 2026
@steipete

Copy link
Copy Markdown
Contributor

Closing per ClawSweeper review verdict duplicate_or_superseded (decision packet 2026-07-20T23:57:18.527Z). This item was part of the audited close backlog (openclaw/clawsweeper#920) stranded by an apply-lane defect, drained manually after re-verification. If this is wrong, reopen and ClawSweeper will re-review.

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

Labels

docs Improvements or additions to documentation 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

Expose knownLongFlags in safeBinProfiles config schema

2 participants