Skip to content

Harden security boundaries and CI - #11

Merged
RNA4219 merged 4 commits into
mainfrom
security-hardening
Jul 22, 2026
Merged

Harden security boundaries and CI#11
RNA4219 merged 4 commits into
mainfrom
security-hardening

Conversation

@RNA4219

@RNA4219 RNA4219 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary\n- 外部解析結果のimportに、manifest・SHA-256・revision・tool identity・入力上限・安全なpath検証を追加\n- plugin実行をfail-closed化し、process/Docker sandbox、権限・環境変数・出力・時間上限を導入\n- repository scanに件数・深さ・容量・時間上限とpartial伝播を追加\n- Semgrep、Gitleaks、npm audit、CycloneDX SBOM、golden testを含む固定済みsecurity gateを追加\n- README(英語・日本語を含む)、CLIおよびsandbox/security文書を更新\n\n## Why\n信頼できないimport、plugin、巨大repository、CI supply-chainを境界で検証し、異常時に安全側へ失敗させるためです。\n\n## Validation\n-

pm run build\n-
pm run test:smoke (56 passed)\n- security targeted suite (397 passed, 3 skipped)\n- architecture tests (18 passed)\n- package smoke\n-
pm run audit:deps (0 vulnerabilities)\n-
ode scripts/verify-security-toolchain.mjs\n\nローカルではDocker Engineが利用できなかったため、固定digestのSemgrep container実行はGitHub Actionsを正本として確認します。

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

code-to-gate PR Review

Gate Verdict

  • Status: needs_review
  • Readiness: passed
  • Findings: 17 total, 0 critical, 1 high

Blocking Reasons

  • No blocking reason was found.

Acceptable Risks

  • [info] Readiness verdict is passed: All policy conditions met, release ready
  • [info] No unsupported claims are present: LLM or imported claims that lack evidence are not present in findings.unsupported_claims.
  • [info] Public docs, CLI, schema, and schema coverage are aligned: 8 spec drift checks passed without failures.

Suggested Tests

  • [medium] Run fixtures/demo-ci-imports/tests/user.test.ts: Test path matched changed source path. Command: npm test -- fixtures/demo-ci-imports/tests/user.test.ts Source: test-plan-001, src/cli/import.ts
  • [medium] Run src/tests/cli-all.test.ts: Test path matched changed source path. Command: npm test -- src/tests/cli-all.test.ts Source: test-plan-002, src/cli.ts
  • [medium] Run src/tests/contract/security-toolchain.test.ts: Test path matched changed source path. Command: npm test -- src/tests/contract/security-toolchain.test.ts Source: test-plan-003, src/tests/contract/security-toolchain.test.ts
  • [medium] Run src/tests/performance/analyze-performance.test.ts: Test path matched changed source path. Command: npm test -- src/tests/performance/analyze-performance.test.ts Source: test-plan-004, src/cli/analyze.ts
  • [medium] Run src/tests/plugin/sample-plugin-execution.test.ts: Test path matched changed source path. Command: npm test -- src/tests/plugin/sample-plugin-execution.test.ts Source: test-plan-005, src/plugin/index.ts
  • [medium] Run src/tests/smoke/cli-smoke.test.ts: Test path matched changed source path. Command: npm test -- src/tests/smoke/cli-smoke.test.ts Source: test-plan-006, src/cli.ts
  • [high] Run src/application/tests/rule-evaluator.test.ts: Test path matched changed source path. Command: npm test -- src/application/tests/rule-evaluator.test.ts Source: test-plan-007, src/application/tests/rule-evaluator.test.ts, src/application/rule-evaluator.ts
  • [medium] Run src/application/assurance/tests/assurance-graph.test.ts: Test path matched changed source path. Command: npm test -- src/application/assurance/tests/assurance-graph.test.ts Source: test-plan-008, src/types/graph.ts
  • [high] Run src/cli/tests/analyze-imports-security.test.ts: Test path matched changed source path. Command: npm test -- src/cli/tests/analyze-imports-security.test.ts Source: test-plan-009, src/cli.ts, src/cli/tests/analyze-imports-security.test.ts, src/cli/analyze.ts, src/cli/import.ts
  • [high] Run src/cli/tests/analyze.test.ts: Test path matched changed source path. Command: npm test -- src/cli/tests/analyze.test.ts Source: test-plan-010, src/cli.ts, src/cli/analyze.ts
  • [high] Define expected behavior for .gitleaksignore and add a focused regression or manual black-box check.: No related automated test was found for this changed source file. Source: oracle-gap-001, .gitleaksignore
  • [high] Define expected behavior for scripts/security-golden.mjs and add a focused regression or manual black-box check.: No related automated test was found for this changed source file. Source: oracle-gap-002, scripts/security-golden.mjs
  • [high] Define expected behavior for scripts/verify-security-toolchain.mjs and add a focused regression or manual black-box check.: No related automated test was found for this changed source file. Source: oracle-gap-003, scripts/verify-security-toolchain.mjs
  • [high] Define expected behavior for src/cli/import-provenance.ts and add a focused regression or manual black-box check.: No related automated test was found for this changed source file. Source: oracle-gap-004, src/cli/import-provenance.ts
  • [high] Define expected behavior for src/plugin/docker-command-builder.ts and add a focused regression or manual black-box check.: No related automated test was found for this changed source file. Source: oracle-gap-005, src/plugin/docker-command-builder.ts
  • [high] Define expected behavior for src/plugin/sandbox-config.ts and add a focused regression or manual black-box check.: No related automated test was found for this changed source file. Source: oracle-gap-006, src/plugin/sandbox-config.ts
  • [high] Define expected behavior for src/types/artifacts.ts and add a focused regression or manual black-box check.: No related automated test was found for this changed source file. Source: oracle-gap-007, src/types/artifacts.ts

Spec Drift

  • No spec drift was found or no spec-drift artifact was provided.

Drift Budget

  • No drift budget summary is available.

Evidence Links

  • Release readiness: .qh/release-readiness.json schema: release-readiness@v1 hash: c08e219e86e44fbd
  • Findings: .qh/findings.json schema: findings@v1 hash: aa225147dd804155
  • Auto test plan: .qh/test-plan.json schema: test-plan@v1 hash: d2dd55a304ac5342
  • Spec drift: .qh/spec-drift.json schema: spec-drift@v1 hash: f93e6c0095e3c47d
  • Evidence DAG: .qh/evidence-dag.json schema: evidence-dag@v1 hash: e7ac571b1019da0d
  • QEG evidence input: .qh/qeg-code-to-gate.json schema: ctg.qeg-input/v1 hash: b0dc16254da7fc9d
  • Published quality report: https://github.com/RNA4219/code-to-gate/actions/runs/29894410686

Suppression / Baseline Summary

  • No baseline summary is available.

Gate Explainability

  • No gate explainability summary is available.

Generated by code-to-gate v1.5.0

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76597fbf87

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +102 to +106
args.push(
"--permission",
"--allow-fs-read=" + pluginRoot,
"--allow-fs-read=" + workDir,
"--allow-fs-write=" + workDir

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add repo read permissions for process plugins

When a trusted Node plugin needs to inspect source files (the manifest/docs allow security.filesystem.read: ["${repoRoot}"] and many evaluators read file bodies from repo_graph.files), the spawned process gets --permission with read access only to the plugin directory and work dir. Node's --allow-fs-read is the read allowlist, so any fs.readFile of a repo path is denied in the default process sandbox even though the plugin is trusted; pass the configured repo/manifest read paths into these flags or process-mode plugins will fail.

Useful? React with 👍 / 👎.

this.runningProcesses
this.runningProcesses,
{
pluginRoot: entry.path,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve direct execution for none sandbox mode

When users explicitly choose --sandbox none --unsafe-allow-none to run a legacy non-Node plugin such as python plugin.py, this still supplies pluginRoot, so buildPluginSpawnSpec() takes the contained-entrypoint branch and requires command[0] itself to be a file under the plugin directory. Commands resolved from PATH are rejected, so none is no longer the documented direct-execution escape hatch; only pass pluginRoot for process sandboxing or keep the raw spawn path for none.

Useful? React with 👍 / 👎.

Comment on lines +230 to +232
return path.isAbsolute(candidate) || path.win32.isAbsolute(candidate)
? path.resolve(candidate)
: path.resolve(repoRoot, candidate);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject Windows absolute paths on POSIX imports

On POSIX, importing a report produced with Windows absolute paths such as C:\agent\repo\src\a.ts hits the path.win32.isAbsolute branch, but path.resolve() then treats that string as relative under the current repo and it later normalizes to C:/agent/repo/src/a.ts. Those findings are marked accepted/complete even though the evidence path is not actually inside the repository; reject foreign Windows absolutes or translate them only with an explicit repo root mapping.

Useful? React with 👍 / 👎.

@RNA4219
RNA4219 merged commit b6fcafa into main Jul 22, 2026
15 checks passed
@RNA4219
RNA4219 deleted the security-hardening branch July 22, 2026 05:44
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