Skip to content

Harden project quality command policy - #23

Merged
samtay32 merged 2 commits into
mainfrom
codex/security-command-policy-v072
Jul 28, 2026
Merged

Harden project quality command policy#23
samtay32 merged 2 commits into
mainfrom
codex/security-command-policy-v072

Conversation

@samtay32

@samtay32 samtay32 commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • fail closed on subcommand-specific Git and Terraform inspection arguments, paths, execution hooks, and environment overrides
  • run installed-project doctor checks through the protected local CLI instead of mutable @latest code
  • add adversarial containment regressions, submission-ready plugin metadata, and a standard security reporting policy

Root cause

The previous validator allowed a nominally read-only Git subcommand without constraining its options or inherited environment. Options such as git diff --no-index --output=... could therefore create or truncate files outside the project.

Verification

  • npm run release:check — 84 tests, package dry-run, and packed smoke passed
  • original outside-file creation/truncation exploit is rejected before execution
  • executable Git fsmonitor/config hooks are suppressed by the approved check environment
  • Git/Terraform option, path, and environment adversarial matrices pass
  • npx -y markdownlint-cli2@0.18.1 "**/*.md" — 50 files passed
  • git diff --check passed

Upgrade impact

Custom Git checks must use the documented bounded inspection forms, including --no-ext-diff and --no-textconv where required. Terraform formatting checks must use terraform fmt -check. Existing customized checks that fall outside this policy require explicit replacement and reapproval.

Summary by CodeRabbit

  • Security
    • Strengthened validation, isolation, and safe parsing for Git and Terraform quality checks (stricter allowlists, read-only inspection enforcement, diff/log/show hardening, path escaping rejection).
    • Hardened check execution by constraining Git behavior and tightening environment allowlisting.
    • Added a private vulnerability reporting policy and security boundary guidance, plus upgrade/compatibility notes for custom checks.
  • Documentation
    • Updated installation, setup, and operating instructions to use the local doctor command entrypoint.
    • Linked the new security policy and expanded trust/check-constraint details.
  • Packaging
    • Included SECURITY.md in published packages.

@samtay32

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR hardens Git and Terraform quality-check validation, disables configurable Git execution behaviors, replaces mutable-tag doctor commands with the local CLI, and adds a published security policy with related documentation and tests.

Changes

Quality Check Security Hardening

Layer / File(s) Summary
Git and Terraform command validation
bin/ultimate-agent-stack.mjs, test/agent-stack.test.mjs, docs/TRUST.md, CHANGELOG.md
Git and Terraform checks now enforce command, argument, revision, flag, and project-contained path allowlists, with tests covering accepted and rejected forms.
Git execution environment hardening
bin/ultimate-agent-stack.mjs, test/agent-stack.test.mjs
Approved Git checks receive fixed environment controls, with regression coverage for external writes, fsmonitor execution, and restricted environment variables.

Local Doctor and Security Policy Distribution

Layer / File(s) Summary
Local doctor command guidance
README.md, STARTER_PROMPT.md, assets/project-template/AGENTS.md, docs/OPERATING_MANUAL.md, skills/*, CHANGELOG.md
Project instructions replace npx ...@latest doctor with the installed node .agent-stack/bin/agent-stack.mjs doctor command.
Security policy publication and metadata checks
SECURITY.md, package.json, README.md, .codex-plugin/plugin.json, test/maintenance.test.mjs, CHANGELOG.md
A private vulnerability reporting policy is added and packaged, while maintenance tests enforce its inclusion, the local doctor guidance, and the shortened plugin description.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant QualityConfig
  participant validateCommand
  participant validateGitCommand
  participant runCheck
  participant Git
  QualityConfig->>validateCommand: submit Git or Terraform quality check
  validateCommand->>validateGitCommand: validate Git subcommand and arguments
  validateCommand-->>QualityConfig: allow or reject command
  QualityConfig->>runCheck: execute approved check
  runCheck->>Git: apply hardened environment and run inspection
  Git-->>runCheck: return inspection result
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: tightening the project’s quality command policy and validations.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/security-command-policy-v072

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@samtay32

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@samtay32

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 25 minutes.

@samtay32

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/agent-stack.test.mjs`:
- Around line 1746-1800: Strengthen both policy test matrices in
test/agent-stack.test.mjs:1746-1800 and test/agent-stack.test.mjs:1835-1856 by
associating each rejected argv with its expected Git or Terraform policy message
and asserting that message with assert.match instead of only checking a
non-empty error list. In the Git matrix, add a validateConfig(config, target)
case covering the projectArgumentSafe projectFile-containment branch; preserve
the existing rejection cases while ensuring each failure is attributed to the
intended rule.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cca4394b-198a-4a91-bee3-560bd207fc8d

📥 Commits

Reviewing files that changed from the base of the PR and between b796750 and 01c2cba.

📒 Files selected for processing (14)
  • .codex-plugin/plugin.json
  • CHANGELOG.md
  • README.md
  • SECURITY.md
  • STARTER_PROMPT.md
  • assets/project-template/AGENTS.md
  • bin/ultimate-agent-stack.mjs
  • docs/OPERATING_MANUAL.md
  • docs/TRUST.md
  • package.json
  • skills/run-autonomous-delivery/SKILL.md
  • skills/setup-autonomous-project/SKILL.md
  • test/agent-stack.test.mjs
  • test/maintenance.test.mjs

Comment thread test/agent-stack.test.mjs
@samtay32

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@samtay32
samtay32 marked this pull request as ready for review July 28, 2026 05:46
@samtay32
samtay32 merged commit 761a1e3 into main Jul 28, 2026
13 checks passed
@samtay32
samtay32 deleted the codex/security-command-policy-v072 branch July 28, 2026 15:53
@samtay32 samtay32 mentioned this pull request Jul 28, 2026
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.

1 participant