Skip to content

engine/codex: compile error when restricted bash allowlist is configured - #49758

Merged
pelikhan merged 8 commits into
mainfrom
copilot/fix-bash-allowlist-bypass
Aug 2, 2026
Merged

engine/codex: compile error when restricted bash allowlist is configured#49758
pelikhan merged 8 commits into
mainfrom
copilot/fix-bash-allowlist-bypass

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

tools.bash with specific commands under engine: codex was silently accepted but never enforced — the Codex CLI has no mechanism to restrict shell commands, so the allowlist was discarded while the agent ran with --dangerously-bypass-approvals-and-sandbox. This created a false sense of security: the config looked enforced but wasn't.

Changes

  • New BashCommandAllowlist engine capability — added to EngineCapabilities and EngineCapabilitiesDefinition; set true for Claude, Copilot, Gemini, and Antigravity (all of which map tools.bash entries to their CLI's enforcement mechanism); defaults to false (Codex, others)

  • Compile-time validationvalidateBashCommandAllowlistSupport() errors when a non-wildcard bash list is used with an engine that cannot enforce it; wired into validateEngineToolRequirements()

  • Wildcards and absent config still compile cleanly — only specific-command lists (e.g. bash: [git, npm]) trigger the error; bash: ["*"], bash: true, and omitting bash are unaffected

engine: codex
tools:
  bash:
    - git   # error: engine 'codex' does not support bash command allow-listing
    - npm   # use bash: ["*"] to allow all, or switch to copilot/claude/gemini/antigravity

Run: https://github.com/github/gh-aw/actions/runs/30750494960

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12 AIC · ⌖ 7.39 AIC · ⊞ 8.3K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30752949969

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.69 AIC · ⌖ 6.11 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI and others added 2 commits August 2, 2026 11:07
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix tools.bash allowlist issue for codex engine engine/codex: compile error when restricted bash allowlist is configured Aug 2, 2026
Copilot AI requested a review from pelikhan August 2, 2026 11:23
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category:
  • Risk:
  • Priority: (score: 53/100)
    • Impact: 30/50, Urgency: 14/30, Quality: 9/20
  • Recommended action:

Automated triage — see full report issue for details.

Structured data:

{
  "action": "defer",
  "category": "chore",
  "pr_number": 49758,
  "risk": "high"
}

Generated by 🔧 PR Triage Agent · auto · 73.4 AIC · ⌖ 3.47 AIC · ⊞ 8K ·

@pelikhan
pelikhan marked this pull request as ready for review August 2, 2026 12:52
Copilot AI review requested due to automatic review settings August 2, 2026 12:52

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.

🟡 Not ready to approve

Explicit deny configurations (bash: false and bash: []) still bypass validation and leave Codex shell access unrestricted.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds engine capability validation to prevent unsupported bash allowlists from being silently ignored.

Changes:

  • Adds BashCommandAllowlist engine capability.
  • Rejects restricted bash lists for unsupported engines.
  • Adds validation and capability tests.
File summaries
File Description
pkg/workflow/agent_validation.go Validates bash allowlist support.
pkg/workflow/agentic_engine.go Defines runtime capability.
pkg/workflow/engine_definition.go Defines declarative capability.
pkg/workflow/compiler_orchestrator_tools.go Wires validation into compilation.
pkg/workflow/bash_command_allowlist_validation_test.go Tests validation and capabilities.
pkg/workflow/compiler_orchestrator_tools_test.go Updates Codex compilation test.
pkg/workflow/claude_engine.go Enables Claude capability.
pkg/workflow/copilot_engine.go Enables Copilot capability.
pkg/workflow/gemini_engine.go Enables Gemini capability.
pkg/workflow/antigravity_engine.go Enables Antigravity capability.
Review details
  • Files reviewed: 10/11 changed files
  • Comments generated: 1
  • Review effort level: Balanced

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread pkg/workflow/agent_validation.go Outdated
Comment on lines +264 to +266
if !hasBashRestrictedAllowlist(tools) {
return nil
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 853d09c. validateBashCommandAllowlistSupport now uses a new hasBashExplicitRestriction helper that returns true for bash: false, bash: [], and non-wildcard command lists — only absent/nil bash, bash: true, and wildcard lists (["*"], [":*"]) bypass the error. The separate hasBashRestrictedAllowlist function used for MCP CLI command injection is unchanged.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ failed during design decision gate check.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

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

Review Summary

The logic change is correct and well-tested — the new BashCommandAllowlist capability flag and validateBashCommandAllowlistSupport() function properly prevent the silent-bypass scenario described in the PR.

Blocking issue: An unrelated binary file (openai-codex-0.146.0.tgz) has been accidentally committed. This should be removed and added to .gitignore before merging.

Non-blocking observations:

  • hasBashRestrictedAllowlist returns false for bash: false and bash: []. These are not "restricted allowlist" cases in the same way (bash is disabled rather than superficially restricted), so the current behavior is acceptable — but worth a comment in the function doc if the distinction isn't obvious.
  • The error message is clear and actionable; the test coverage is thorough.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 28.5 AIC · ⌖ 10.5 AIC · ⊞ 5.4K

Comments that could not be inline-anchored

openai-codex-0.146.0.tgz:1

This binary .tgz package file appears to have been accidentally committed to the repository. Binary packages should not be tracked in source control — they belong in .gitignore and installed via the package manager at build/test time.

Please remove this file and add *.tgz (or at least openai-codex-*.tgz) to .gitignore to prevent re-commits.

@copilot please address this.

@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 and /tdd — requesting changes on two issues.

📋 Key Findings

Issues

  1. Accidentally committed binary (openai-codex-0.146.0.tgz) — should be removed from source control and gitignored.
  2. Happy-path test removed without replacementTestProcessToolsAndMarkdown_CustomEngineNoTools was repurposed to test the error path only; the previous assertion that bash: ["*"] compiles correctly for Codex was dropped with no substitute.

Positive Highlights

  • ✅ Clean capability-flag design: BashCommandAllowlist on EngineCapabilities follows the existing pattern perfectly.
  • ✅ Excellent error message — names the engine, explains the runtime risk, and offers concrete alternatives.
  • ✅ Good test coverage in bash_command_allowlist_validation_test.go covering all four supporting engines and Codex across wildcard / single / multi-command / absent cases.
  • ✅ Wiring via validateEngineToolRequirements is minimal and idiomatic.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 33 AIC · ⌖ 9.84 AIC · ⊞ 7.1K
Comment /matt to run again

Comments that could not be inline-anchored

openai-codex-0.146.0.tgz:1

[/diagnosing-bugs] This binary artifact (openai-codex-0.146.0.tgz) appears to be accidentally committed to the repository root — it is not referenced by any code in the diff and should not be tracked in source control.

<details>
<summary>💡 Suggested fix</summary>

Remove the file and add it to .gitignore:

git rm --cached openai-codex-0.146.0.tgz
echo &#39;*.tgz&#39; &gt;&gt; .gitignore

Committing binary archives bloats git history and is likely a leftover debug artefact.

</details>

@…

pkg/workflow/compiler_orchestrator_tools_test.go:679

[/tdd] The updated test no longer verifies a tools.bash list that doesn't trigger the new validation — it only covers the error path. A complementary case (e.g. engine: codex with bash: [&quot;*&quot;] or no bash key) should be added to document and guard the happy path.

<details>
<summary>💡 Suggestion</summary>

Add a second test function TestProcessToolsAndMarkdown_CodexWildcardBashSucceeds with bash: [&quot;*&quot;] and assert require.NoError(t, err) and assert.NotEmpty(t, result.tools). T…

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 87/100 — Excellent

Analyzed 16 test(s): 14 design, 2 implementation, 0 violation(s).

📊 Metrics (16 tests)
Metric Value
Analyzed 16 (Go: 16, JS: 0)
✅ Design 14 (87.5%)
⚠️ Implementation 2 (12.5%)
Edge/error coverage 13 (81.3%)
Duplicate clusters 0
Inflation No
🚨 Violations 0
Test File Classification Coverage
TestValidateBashCommandAllowlistSupport bash_command_allowlist_validation_test.go:12 Design 11 table-driven scenarios: Codex restrictions (2), other engines (4), edge cases (5)
TestEngineBashCommandAllowlistCapability bash_command_allowlist_validation_test.go:114 Design 5 table-driven scenarios: engine capabilities verification
TestProcessToolsAndMarkdown_CustomEngineNoTools compiler_orchestrator_tools_test.go:636 Implementation Integration test: compile error verification

Test Strengths

Table-driven test design: Both new tests use clean table-driven patterns with explicit scenarios for success/error paths.

Comprehensive edge coverage: 11 scenarios in TestValidateBashCommandAllowlistSupport cover restriction conditions (Codex with ["git", "npm"], ["git"]), wildcards (*, :*), boolean true, missing bash tool, and nil tools.

Error assertion discipline: Tests use require.Error(), require.NoError(), and assert.Contains() with descriptive failure messages.

No mock violations: No gomock, testify/mock, or internal-call mocking detected.

Build tag compliance: New test file has mandatory //go:build !integration tag on line 1.

Integration test: Modified TestProcessToolsAndMarkdown_CustomEngineNoTools validates the end-to-end compile error path.

Verdict

Passed. 12.5% implementation tests (threshold: 30%). Test design focuses on behavioral contracts: Codex allowlist restriction enforcement and engine capability flags. No code violations or red flags detected.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 19.1 AIC · ⌖ 5.01 AIC · ⊞ 8.5K ·
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.

✅ Test Quality Sentinel: 87/100. 12.5% implementation tests (threshold: 30%).

…ement

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread openai-codex-0.146.0.tgz Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot delete this file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — removed in commit chore: remove accidentally committed openai-codex-0.146.0.tgz.

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

Verdict: Request changes

Core validator logic (validateBashCommandAllowlistSupport, capability flag wiring, reused hasBashRestrictedAllowlist) is sound and well-tested. One blocking issue: an unrelated 4.5KB binary npm tarball (openai-codex-0.146.0.tgz) was committed to the repo root — it has no connection to the bash-allowlist feature and must be removed before merge.

💡 Review notes
  • Capability flag additions for claude/copilot/gemini/antigravity are consistent and gofmt-aligned.
  • pi engine correctly defaults to BashCommandAllowlist: false (unset), so it is also caught by the new validator — same silent-ignore risk as codex, appropriately blocked.
  • Reuse of hasBashRestrictedAllowlist (already used for MCP CLI mounting) is appropriate; bash:false/bash:[] semantics (disabled/no-commands) are distinct from a restricted allowlist that is silently ignored, so returning false for those cases is correct for this validator's purpose.
  • Test coverage is solid across engines and wildcard/absent cases.
  • Flagged separately: the stray openai-codex-0.146.0.tgz binary artifact.

🔎 Code quality review by PR Code Quality Reviewer · auto · 105.6 AIC · ⌖ 5.07 AIC · ⊞ 7.9K
Comment /review to run again

Comments that could not be inline-anchored

openai-codex-0.146.0.tgz:1

Stray unrelated binary artifact committed to the repo root — this npm tarball has nothing to do with the bash-allowlist feature and should not be part of this PR.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the remaining review feedback on this PR, then run the pr-finisher skill.

Outstanding signals to close:

  • Remove the accidentally committed binary artifact openai-codex-0.146.0.tgz and prevent it from being re-added.
  • Restore or add the missing happy-path coverage for Codex wildcard / unrestricted bash handling.
  • Design Decision Gate reported an ADR/check failure earlier in the run history; verify the current head clears that feedback as well.

Branch refresh was requested for this PR. After updates, run the pr-finisher skill.

Run details: https://github.com/github/gh-aw/actions/runs/30750494960

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12 AIC · ⌖ 7.39 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI and others added 2 commits August 2, 2026 14:16
…ows to bash: ["*"]

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…ndMarkdown

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — requesting changes on two issues....

Both blocking issues are now addressed:

  1. Binary artifact (openai-codex-0.146.0.tgz) removed and *.tgz added to .gitignore (committed earlier).
  2. Happy-path test added: TestProcessToolsAndMarkdown_CodexWildcardBashSucceeds in compiler_orchestrator_tools_test.go verifies that Codex with bash: ["*"] compiles without error (commit 853d09c).

Copilot AI requested a review from gh-aw-bot August 2, 2026 14:28
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the remaining review feedback on this PR, then run the pr-finisher skill.

Outstanding signals to close:

  • Review replies already indicate the binary artifact removal and wildcard happy-path test were addressed; please verify the remaining blocking review state and clear any still-open thread or stale requested-change state.
  • Failed check from compact triage: agent appears on a different PR run history pattern elsewhere; confirm this PR head is green and only maintainer/reviewer closure remains.
  • Branch refresh was skipped because this PR is currently blocked/dirty; if conflict-free refresh becomes available later, incorporate it before handoff.

After verifying the blocking review state is fully closed, run the pr-finisher skill and summarize merge readiness for the maintainer.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.69 AIC · ⌖ 6.11 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please address the remaining review feedback on this PR, then run the pr-finisher skill.

Outstanding signals to close:...

Here is the full pr-finisher summary for this PR.


  • Reviews — All in-scope feedback has been addressed. Both open review threads have substantive Copilot replies and are outdated (the code they referenced no longer exists). Two github-actions[bot] CHANGES_REQUESTED reviews (Impeccable Skills Reviewer, Matt Pocock Skills Reviewer) were raised about the accidentally-committed binary and a missing happy-path test — both issues are fully resolved in the pushed commits. Thread resolution and review dismissal require maintainer action (no GraphQL mutation tool available to the agent).
  • Checks (local)make agent-report-progress passes: zero lint errors, lock files in sync, all unit tests pass (including TestValidateBashCommandAllowlistSupport, TestEngineBashCommandAllowlistCapability, TestProcessToolsAndMarkdown_CodexWildcardBashSucceeds).
  • Checks (CI) — Stale after agent push; needs human re-trigger. Prior CI run for head SHA 853d09c2: all CGO checks green (build, lint-go, impacted-go-tests, unit tests A-Z, security, Windows/macOS/Alpine, mcp-server-compile-test). "Agentic Commands" shows action_required (manual approval gate, not a CI failure).
  • Mergeableblocked. The block is due to two stale CHANGES_REQUESTED reviews from automation (both issues fully fixed in commits 7b8fd8f + 853d09c) and the two unresolved (but outdated) review threads. A maintainer needs to dismiss the stale reviews and resolve the threads to unblock.

Actions taken this run: Confirmed all prior work is complete and pushed; ran full local validation (green); produced this merge-readiness summary.

Hand-off: CI must be re-triggered by a maintainer (close/reopen PR or push) before merge. A maintainer also needs to dismiss the two stale CHANGES_REQUESTED reviews from github-actions[bot] and resolve the two outdated review threads to clear the blocked state.

@pelikhan
pelikhan merged commit 34035ee into main Aug 2, 2026
30 of 31 checks passed
@pelikhan
pelikhan deleted the copilot/fix-bash-allowlist-bypass branch August 2, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

engine: codex — tools.bash allowlist is silently ignored; agent runs with sandbox bypass

4 participants