Skip to content

Fix restricted tool contracts in Formal Spec Verifier and Delight - #76589

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan/aw-tool-permission-denials
Nov 10, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan/aw-tool-permission-denials

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Formal Spec Verifier and Delight exhausted their three-denial budgets in runs 42844018496 and 42836767636. Each rejected call contained an ungranted operation; compound syntax alone was not the cause, and these were not GitHub authentication failures. Required command patterns also compiled to strings the SDK callback matched exactly rather than as the intended prefixes/wildcards.

Approach

  • Use scoped go test:* and gofmt -w:* contracts and finite exact Delight help commands without changing global SDK matching.
  • Replace unusable model-path wildcard grants with a finite SANY/TLC/Koka helper. It validates selected-spec paths, rejects colliding slugs and symlinks, uses pinned runtimes and fixed process limits, serializes the shared budget, and provides an actionable existing-lock diagnostic without unsafe automatic reclamation.
  • Give children a fixed minimal environment with fresh HOME/TMPDIR directories. Capture at most 64 KiB with only 8 KiB credential-redacted previews per stream persisted in evidence.json, including sanitized errors; do not persist raw output logs.
  • Print the exact nested evidence filename and direct native file inspection instead of a misleading directory glob. Native reads were already permitted; no wider shell-read grant is added.
  • Add first-denial permitted-operation recipes, correct Delight's restored memory paths, and handle empty samples without suppressing actual producer/sampling/read failures. Materializing candidates also avoids producer SIGPIPE.

No blanket shell, Go, Git, Python, directory-change or workflow grant is added. Credentials, firewall configuration, safe-output limits and denial thresholds are unchanged. Existing models with unsupported layouts or flags are reported incompatible rather than executed through an unrestricted wrapper. Environment cleanup and known-value redaction do not replace filesystem isolation or sanitize arbitrary sensitive file contents.

Validation

  • 36 focused tests passed across helper, emitted-permission and isolated sampling suites, including initially failing collision/environment regressions. Helper child processes are doubled; no actual Java, Koka, model binary or workflow was executed.
  • make agent-report-progress passed: typecheck, changed-file lint, impacted tests and workflow drift across all 365 workflows.
  • make recompile passed; existing repository compiler warnings remain.
  • All six supplied inline threads were answered and resolved; all seven supplied completion/memory comments received individual replies.
  • Open-PR path inventories found no equivalent overlapping fix before initial publication. Earlier Align report_incomplete across safe-output tool lists #76537 only changed safe-output tool-list advertising and was not duplicated.

Review and execution limits

The feedback batch in commit 161788dcbe8 received a hash-bound independent security review of all eight changed files, generated lock deltas and required unchanged enforcement: PASS; no confirmed vulnerabilities found. This is a new review-comment batch and does not retroactively label the initially unavailable pre-PR follow-up as completed.

Diagnostic dry-run coverage remains incomplete: Formal emitted a diagnostic lock but failed its gate on an existing imported-installer command warning; Delight's pre-agent steps are rejected by dry-run policy. These restrictions were not bypassed. No workflow dispatch or rerun was performed.

Use scoped validation and finite help grants, bound formal-model checks behind a reviewed-source helper, and align memory paths and denial recovery guidance. Add operation-contract and process-double regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread .github/scripts/formal_spec_check.cjs Resolved
@pelikhan
pelikhan marked this pull request as ready for review November 10, 2026 19:22
Copilot AI adaptive review requested due to automatic review settings November 10, 2026 19:22
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76589

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Generated by PR Specification Reviewer for #76589

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions github-actions 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.

Reviewed PR head 49c43a8. Applicable contracts include Copilot SDK Driver Specification v1.0.2, Sections 3.4 and 4.2 (authentication-token isolation; raw tokens must not be exposed or logged), and the security architecture secret-leak/threat-detection obligations.

Blocking finding (also reported by the existing security bot comment): .github/scripts/formal_spec_check.cjs:102 invokes pinned runtimes with spawnSync without an explicit sanitized env, while lines 97-99 persist complete stdout/stderr. The newly permitted model files are repository-controlled and therefore can read inherited process variables or print them; the captured logs are then exposed as evidence. This defeats the intended secret-isolation boundary and can disclose COPILOT_CONNECTION_TOKEN or other ambient credentials. Pass a minimal explicit environment (preserving only required non-secret runtime variables) and redact/bound captured output before persisting it; add a regression asserting the child receives no ambient secrets and evidence cannot contain them. No specification synchronization is appropriate until this security behavior is corrected.

No generated files or implementation changes were made by this review. Coverage was limited to the prefetched PR diff, changed workflow contracts, applicable specifications, and existing review comments; tests were not run per static-review policy.

Generated by PR Specification Reviewer for #76589 · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review-specs to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-10T19:25:31Z
review_event: REQUEST_CHANGES
top_themes:
  - formal-check evidence output is not readable through the permitted glob
files_reviewed:
  - .github/scripts/formal_spec_check.cjs
  - .github/workflows/daily-formal-spec-verifier.md
  - .github/workflows/delight.md
  - actions/setup/js/formal_spec_check.test.cjs
  - actions/setup/js/restricted_tool_workflows.test.cjs
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions 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.

Found one functional blocking issue: the new nested formal-check evidence layout is not readable using the workflow's permitted top-level cat .../* command. The inline comment explains the failure and a fix direction. The specialist pass was unavailable because its file-read tool invocation was denied; this review therefore relies on independent static analysis of the pre-fetched diff.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions github-actions 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs, /codebase-design, and /tdd. Requesting changes on correctness and test-coverage gaps in the new formal-spec helper and the Delight pre-agent step.

📋 Key Themes & Highlights

Key Themes

  • Slug collision: specs/a/b.md and specs/a-b.md map to the same model directory.
  • Stale budget lock: budget.lock is not reclaimed after an abnormal exit, so later checks fail.
  • Pipefail abort: set -euo pipefail plus an empty grep | shuf aborts the Delight pre-agent step.
  • Untested risks: no tests cover slug collisions or the child process environment.
  • Pre-existing grants (not new in this PR): the formal lock still allows bare shell(cat), shell(yq), and shell(head), which match arbitrary paths. The permission handler approves cat /proc/self/environ and cat .env because it checks only the command prefix. This should be narrowed in a follow-up.
  • Repo-memory branch mismatch: the Delight prompt reads repo-memory/default, which matches the mount id, but shared/repo-memory-standard.md still sets branch-name: memory/delight and the prompt says not to use the branch name. Confirm the persisted branch is what the next run reads.

Positive Highlights

  • ✅ The helper confines paths, records source SHA-256 hashes, and serializes runs under a shared budget.
  • ✅ Lock grants now name the helper rather than wildcard node/timeout.
  • ✅ The new tests follow the repo's ESM/vitest conventions.

Verification notes

  • Checked the HEAD lock permissions with the real permission handler. The asserted rejects for go version, git log, and python3 hold.
  • vitest is not installed at the root, so I did not run the new tests. The PR body's "26 tests pass" is unverified here.
  • The PR body says the independent security-review gate was not completed. This review does not replace it.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread .github/scripts/formal_spec_check.cjs Resolved
Comment thread .github/scripts/formal_spec_check.cjs Resolved
Comment thread .github/workflows/delight.md Resolved

Copilot AI 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.

🟡 Changes recommended

Critical flaws allow formal checks to report success for invalid models, while unvalidated dependencies and an agent-modifiable allowlisted helper undermine confinement and execution safeguards.

9 open issues
What changed in this PR

Updates gh-aw’s Formal Spec Verifier and Delight workflows to align permitted commands with their tasks and reduce repeated tool denials.

Changes:

  • Replace ineffective command patterns with scoped validation grants, exact help commands, and first-denial recovery guidance.
  • Add a SANY/TLC/Koka helper with pinned runtimes, process limits, a shared time budget, and evidence logging.
  • Align Delight’s memory access with the restored directory, regenerate both locks, and add permission and helper regression fixtures.
File Description
actions/​setup/​js/​restricted_tool_workflows.test.cjs Adds permission, denial-recovery, and memory-contract checks.
actions/​setup/​js/​formal_spec_check.test.cjs Adds process-double coverage for helper validation, limits, and evidence.
.github/​workflows/​delight.md Updates help-command grants, recovery guidance, and memory paths.
.github/​workflows/​delight.lock.yml Regenerates Delight’s setup, permissions, and workflow hashes.
.github/​workflows/​daily-formal-spec-verifier.md Updates Go grants and routes formal checks through the helper.
.github/​workflows/​daily-formal-spec-verifier.lock.yml Regenerates Formal’s execution grants and workflow hashes.
.github/​scripts/​formal_spec_check.cjs Implements bounded formal-check execution and evidence collection.

Review effort: Max (auto)

Comment thread .github/scripts/formal_spec_check.cjs Resolved
Comment thread .github/scripts/formal_spec_check.cjs Resolved
Comment thread .github/scripts/formal_spec_check.cjs Resolved
Comment thread .github/scripts/formal_spec_check.cjs Resolved
Comment thread .github/workflows/delight.md Resolved
Comment thread .github/workflows/delight.md Resolved
Isolate child environments and persist bounded redacted evidence, reject colliding model slugs, provide safe lock diagnostics and exact evidence inspection, and handle empty Delight samples without hiding real failures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the code-quality completion notice: no code change is needed for the notice itself. The actionable evidence-access finding is addressed in its inline thread with a documented, tested per-file inspection path.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the design-decision result: no code change is needed for this reported-no-action status. I have not treated it as proof of implementation completeness or authorization.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the Ponytail result: no implementation change is requested by this status notice. Its reported-no-action outcome is not being used as a substitute for the focused regressions and repository validation.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the skills-review completion notice: the actionable slug, lock, sampling and environment findings are addressed individually below. The compiled clone and push steps both use branch memory/delight with mount /tmp/gh-aw/repo-memory/default; those identify persistence and its local mount, respectively, and do not require a branch rename.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the specification-review completion notice: the substantive inherited-environment and raw-output finding is addressed in the security thread with explicit child isolation and bounded, sanitized evidence. No specification text was changed to conceal that defect.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the test-quality completion notice: no code change is requested by the reported-no-action status. The new behavioral regressions cover the concrete review findings rather than treating this notice as evidence that coverage was complete.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the saved comment-memory summary: its evidence-read concern duplicates the inline finding, which is addressed in that thread. No separate code change or edit to automation-owned comment memory is needed.

Keep exact Go formatting and focused-test permission assertions for the Formal Copilot and Sergo Claude workflows after the Formal contract changed to argument-prefix syntax.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
xargs -a /tmp/gh-aw/agent/validation-sample.txt cat > /tmp/gh-aw/agent/validation-sample-content.txt 2>/dev/null || echo "(no validation sample found)" > /tmp/gh-aw/agent/validation-sample-content.txt
for sample in doc-samples workflow-samples validation-sample; do
while IFS= read -r file; do
cat "$file"
status = run("compile", koka, [`--builddir=${path.join(results, "build")}`, "-o", executable, model], 120000);
if (status === 0) {
confinedPath(results, "model");
status = run("model", executable, [], 30000);
Stage a checksum-verified read-only checker, reject unsupported model dependencies and execute hashed snapshots, classify SANY diagnostics, and conservatively recover interrupted budget ownership. Precollect Delight help and load the history files actually produced.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this repeated completion notice: no additional implementation change is requested. Its actionable evidence-access finding was answered and resolved in the earlier batch; the new Copilot findings are handled in their own threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this repeated design-gate notice: no code change is needed for the reported-no-action status. It is not being treated as proof that the new review findings are satisfied.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this repeated Ponytail notice: there is no new requested implementation change. Focused validation, rather than the no-action notification, determines whether this batch is ready.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this repeated skills-review notice: the earlier concrete findings were answered individually. The newly identified interruption-accounting requirement is being handled separately from the earlier lock-diagnostic alternative.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this repeated specification-review notice: the earlier inherited-environment/raw-output concern was fixed and regression-tested. No further code change is requested by this completion message itself.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this repeated test-quality notice: no new code change is requested by the reported-no-action status. The new dependency, validation, interruption and prepared-input requirements have their own targeted regressions.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this repeated comment-memory record: its evidence-read concern was already addressed in the corresponding inline thread. No separate implementation or automation-memory edit is needed.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed for the earlier acknowledgement: exact native evidence-file inspection remains the intended contract. This acknowledgement itself introduces no additional implementation requirement.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed for the earlier acknowledgement: no-action design status is not a validation or authorization result. No code change is needed for that statement.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed for the earlier acknowledgement: the completion notice does not replace focused regressions or repository checks. There is no new implementation request in this comment.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed for the earlier acknowledgement: branch memory/delight and local mount /tmp/gh-aw/repo-memory/default intentionally name different parts of persistence. The separate new history-filename mismatch is addressed in its own inline thread without renaming the branch.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed for the earlier acknowledgement: explicit child-environment isolation and bounded, redacted evidence remain in place. New dependency and helper-trust findings are separate requirements, not reasons to weaken those protections.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed for the earlier acknowledgement: concrete behavioral regressions are required, not just successful automation notifications. No additional code change follows from this acknowledgement itself.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed for the earlier acknowledgement: the saved memory duplicates an already-addressed evidence-access comment. No further code change or edit to automation-owned memory is needed.

GH_AW_COPILOT_SDK_DRIVER: 1
GH_AW_COPILOT_SDK_SERVER_ARGS: '["--headless","--no-auto-update","--port","3002","--add-dir","/tmp/gh-aw/","--log-level","all","--log-dir","/tmp/gh-aw/sandbox/agent/logs/","--disable-builtin-mcps","--no-ask-user","--allow-tool","github","--allow-tool","safeoutputs","--allow-tool","shell(./gh-aw * --help)","--allow-tool","shell(./gh-aw --help)","--allow-tool","shell(awk)","--allow-tool","shell(cat .github/workflows/*.md)","--allow-tool","shell(cat /tmp/gh-aw/agent/*)","--allow-tool","shell(cat docs/src/content/docs/*.md)","--allow-tool","shell(cat docs/src/content/docs/*.mdx)","--allow-tool","shell(cat pkg/*/*.go)","--allow-tool","shell(cat)","--allow-tool","shell(date)","--allow-tool","shell(echo)","--allow-tool","shell(find .github/workflows -name \"*.md\")","--allow-tool","shell(find docs/src/content/docs -name \"*.md\" -o -name \"*.mdx\")","--allow-tool","shell(gh:*)","--allow-tool","shell(grep)","--allow-tool","shell(head)","--allow-tool","shell(ls)","--allow-tool","shell(printf)","--allow-tool","shell(pwd)","--allow-tool","shell(safeoutputs:*)","--allow-tool","shell(sed)","--allow-tool","shell(shuf)","--allow-tool","shell(sort)","--allow-tool","shell(tail)","--allow-tool","shell(uniq)","--allow-tool","shell(wc)","--allow-tool","shell(yq)","--allow-tool","write","--deny-tool","workflow","--allow-all-paths"]'
GH_AW_COPILOT_SDK_TOOL_CONFIG: '{"version":1,"capabilities":{"bash":true,"edit":true,"webFetch":false,"webSearch":false,"dynamicWorkflows":false,"mcp":true,"cliProxy":true},"permissions":{"allowedTools":["github","read","safeoutputs","shell(./gh-aw * --help)","shell(./gh-aw --help)","shell(awk)","shell(cat .github/workflows/*.md)","shell(cat /tmp/gh-aw/agent/*)","shell(cat docs/src/content/docs/*.md)","shell(cat docs/src/content/docs/*.mdx)","shell(cat pkg/*/*.go)","shell(cat)","shell(date)","shell(echo)","shell(find .github/workflows -name \"*.md\")","shell(find docs/src/content/docs -name \"*.md\" -o -name \"*.mdx\")","shell(gh:*)","shell(grep)","shell(head)","shell(ls)","shell(printf)","shell(pwd)","shell(safeoutputs:*)","shell(sed)","shell(shuf)","shell(sort)","shell(tail)","shell(uniq)","shell(wc)","shell(yq)","write"]}}'
GH_AW_COPILOT_SDK_SERVER_ARGS: '["--headless","--no-auto-update","--port","3002","--add-dir","/tmp/gh-aw/","--log-level","all","--log-dir","/tmp/gh-aw/sandbox/agent/logs/","--disable-builtin-mcps","--no-ask-user","--allow-tool","github","--allow-tool","safeoutputs","--allow-tool","shell(awk)","--allow-tool","shell(cat .github/workflows/*.md)","--allow-tool","shell(cat /tmp/gh-aw/agent/*)","--allow-tool","shell(cat /tmp/gh-aw/agent/help-output/*)","--allow-tool","shell(cat docs/src/content/docs/*.md)","--allow-tool","shell(cat docs/src/content/docs/*.mdx)","--allow-tool","shell(cat pkg/*/*.go)","--allow-tool","shell(cat)","--allow-tool","shell(date)","--allow-tool","shell(echo)","--allow-tool","shell(find .github/workflows -name \"*.md\")","--allow-tool","shell(find docs/src/content/docs -name \"*.md\" -o -name \"*.mdx\")","--allow-tool","shell(gh:*)","--allow-tool","shell(grep)","--allow-tool","shell(head)","--allow-tool","shell(ls)","--allow-tool","shell(printf)","--allow-tool","shell(pwd)","--allow-tool","shell(safeoutputs:*)","--allow-tool","shell(sed)","--allow-tool","shell(shuf)","--allow-tool","shell(sort)","--allow-tool","shell(tail)","--allow-tool","shell(uniq)","--allow-tool","shell(wc)","--allow-tool","shell(yq)","--allow-tool","write","--deny-tool","workflow","--allow-all-paths"]'
@pelikhan
pelikhan merged commit 6b742a9 into main Nov 10, 2026
122 checks passed
@pelikhan
pelikhan deleted the pelikhan/aw-tool-permission-denials branch November 10, 2026 23:23
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants