Skip to content

chore(security): 🔒 CodeAnt AI による CI パイプライン 強化 - #508

Merged
genzouw merged 4 commits into
mainfrom
chore/security-codeant-ai-ci-scan-5020808000545081841
Aug 7, 2026
Merged

genzouw merged 4 commits into
mainfrom
chore/security-codeant-ai-ci-scan-5020808000545081841

Conversation

@genzouw

@genzouw genzouw commented Aug 6, 2026 •

Copy link
Copy Markdown
Owner

概要

生成 AI の発展に伴う CI/CD パイプラインの高度化を目的として、CodeAnt AI を活用したセキュリティスキャンワークフローを追加しました。

💡 What

  • .github/workflows/codeant-ci-scan.yml を新規作成し、CodeAnt-AI/codeant-ci-scan-action を導入しました。
  • SAST、SCA、およびシークレットスキャンを CI 実行時に統合的に実施する設定を追加しました。
  • 依存するアクションを特定の SHA にピン留めし、安全性を確保しています。

🎯 Why

  • 新たな AI セキュリティツールの導入により、既存の脆弱性スキャン(Trivy / OSV-Scanner)と合わせて多層防御を実現するため。
  • 公開リポジトリで無料で利用できる最新の AI ツールを試験的に導入し、将来的な AI 自動化フローの最適化につなげるため。

📸 Before/After

  • N/A(UI変更なし)

♿ Accessibility

  • N/A(フロントエンドの変更なし)

関連 Issue / 設計ドキュメント

  • N/A

動作確認

  • ローカルで動作確認した
  • テストを追加・更新した(不要な理由: CI/CD の設定追加のみのため)

セルフチェック

  • bun run lint がパスする
  • bun run typecheck がパスする
  • 破壊的変更がある場合、README または docs を更新した
  • DB マイグレーションがある場合、ロールバック手順を確認した
  • secret / 個人情報を含むコードや設定が含まれていない

AIツール・CI/CD連携に関する手動セットアップ(必要な場合のみ)

  • CodeAnt AI 用のアクセス設定として、GitHub Secrets に ACCESS_TOKEN_GITHUB(PAT またはリポジトリトークン)を登録してください。

デプロイ時の注意

なし

背景

今後の生成 AI の発展を見据え、既存の CI/CD ツールに加え、AI を活用した最新のセキュリティ・コード解析ツールの導入が求められています。

現状認識

現在は Trivy、OSV-Scanner、Secretlint などによる標準的なスキャンが実装されていますが、AI 主導の高度な静的解析や統合的なセキュリティ評価ツールは導入されておらず、パイプラインのブラッシュアップの余地がありました。

このPRで導入・強化するもの

CodeAnt AI CI Scan (CodeAnt-AI/codeant-ci-scan-action) を利用し、SAST、SCA、およびシークレットスキャンを統合。アクションは特定の SHA でピン留めし、プロトタイプとして main ブランチの Push および PR 時に動作させます。

検知漏れリスクと補完策

外部サービスの API レスポンスに依存するため、サービス停止時やトークン未設定時にはスキャンが失敗、またはスキップされる可能性があります。補完策として既存の Trivy や Secretlint との併用を維持しています。

マージ前に必要な手動作業(チェックリスト)

  • CodeAnt AI 用のアクセス設定として、GitHub Secrets に ACCESS_TOKEN_GITHUB(PAT またはリポジトリトークン)を登録してください。

マージ後の確認手順

  1. マージ後、main ブランチで CodeAnt AI CI Scan アクションがトリガーされることを Actions タブから確認する。
  2. スキャンが正常に終了し、不要な警告やエラーが出ていないことを確認する。

ロールバック手順

設定に不具合がある、またはパイプラインの実行時間に致命的な影響が出る場合は、該当の PR を Revert するか、.github/workflows/codeant-ci-scan.yml ファイルを削除してコミットしてください。

参考情報


PR created automatically by Jules for task 5020808000545081841 started by @genzouw

Summary by CodeRabbit

  • 新機能

    • コードの脆弱性、依存関係、機密情報を自動検査するセキュリティスキャンを追加しました。
    • コード変更時に自動実行され、問題の早期発見に役立ちます。
  • ドキュメント

    • セキュリティスキャンの設定方法、必要な認証情報、最小権限での運用方針を追加しました。
    • 認証情報が未設定の場合の動作も明記しました。

Co-authored-by: genzouw <29957+genzouw@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

CodeAnt CI Scan用のGitHub Actionsワークフローを追加しました。mainへのpushとpull requestで実行し、Markdownのみの変更を除外します。トークン未設定時は警告後にスキャンをスキップします。

Changes

CodeAnt CIスキャン

Layer / File(s) Summary
スキャンワークフローと設定文書
.github/workflows/codeant-ci-scan.yml, docs/security/ai-ci-tools.md
mainへのpushとpull requestを対象に、Markdownのみの変更を除外するCodeAntワークフローを追加しました。contents: read権限でチェックアウトし、ACCESS_TOKEN_GITHUBがある場合にSAST、SCA、シークレットスキャンを実行します。トークンがない場合は警告を出してスキャンをスキップする動作を文書化しました。

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • genzouw/monopo#273: GitHub Actionsでセキュリティスキャンを追加する点が関連します。
  • genzouw/monopo#496: docs/security/ai-ci-tools.mdでAI CIツールの設定を文書化する点が関連します。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、CodeAnt AIによるCIパイプラインのセキュリティ強化という変更内容を明確に要約しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/security-codeant-ai-ci-scan-5020808000545081841

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

CodeAnt AI セキュリティスキャンをGitHub Actionsに追加(SAST/SCA/Secrets)

⚙️ Configuration changes ✨ Enhancement 🕐 10-20 Minutes

Grey Divider

AI Description

• main への push / PR 時に CodeAnt AI の統合セキュリティスキャンを実行
• SAST・SCA・シークレットスキャンを単一ワークフローに集約
• 依存アクションを SHA ピン留めし、最小権限で実行
Diagram

graph TD
  T(("push / PR")) --> W(["GitHub Actions: CodeAnt CI Scan"]) --> C["actions/checkout@SHA"] --> A{{"CodeAnt CI Scan Action@SHA"}} --> R(["Scan Results"])
  S[("GitHub Secret: ACCESS_TOKEN_GITHUB")] --> A
  subgraph Legend
    direction LR
    _evt(("Event")) ~~~ _wf(["Workflow/Step"]) ~~~ _ext{{"External Action"}} ~~~ _sec[("Secret")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. 既存セキュリティワークフローへ統合
  • ➕ セキュリティ系ジョブが1箇所に集約され運用・監視が容易
  • ➕ 並列度/依存関係(needs)を最適化しやすい
  • ➖ 既存ワークフローが肥大化し、変更時の影響範囲が広がる
  • ➖ ロールバック単位が大きくなる
2. Reusable workflow(workflow_call)化
  • ➕ 他リポジトリ/他ワークフローから再利用でき、標準化しやすい
  • ➕ 入力(scanners/timeout/paths-ignore)をパラメータ化可能
  • ➖ 初期設計がやや増える(インタフェース設計が必要)
  • ➖ リポジトリ単体の変更としては過剰になりがち
3. 実行トリガーを schedule/手動中心にする(+差分時のみ)
  • ➕ CI時間と外部サービス依存による失敗の影響を抑えられる
  • ➕ 段階導入(まずは夜間スキャン)に向く
  • ➖ PR時点での早期検知が弱くなる
  • ➖ 差分判定の実装・チューニングが必要になる場合がある

Recommendation: 現状の「独立したワークフローとして追加」は、導入の影響範囲が小さく、問題時にファイル削除/Revertで切り戻せるためプロトタイプ導入として妥当です。運用が安定し、既存のTrivy/OSV/Secretlint等との役割分担が固まった段階で、(1) 既存ワークフローへの統合や (2) reusable workflow 化を検討すると保守性が上がります。

Files changed (1) +29 / -0

Other (1) +29 / -0
codeant-ci-scan.ymlCodeAnt AI の統合セキュリティスキャン用ワークフローを追加 +29/-0

CodeAnt AI の統合セキュリティスキャン用ワークフローを追加

• main ブランチの push / PR をトリガーに CodeAnt CI Scan を実行する GitHub Actions ワークフローを新規追加しました。checkout と CodeAnt アクションは SHA ピン留めし、トークンは secrets.ACCESS_TOKEN_GITHUB から注入します。スキャナは sast/sca/secrets を有効化し、タイムアウトを 600 秒に設定しています。

.github/workflows/codeant-ci-scan.yml

@qodo-code-review

qodo-code-review Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. ACCESS_TOKEN_GITHUB docs missing ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new codeant-ci-scan workflow requires the secret ACCESS_TOKEN_GITHUB, but no adjacent
README/setup documentation describes this manual prerequisite. This increases the risk of CI
failures and unclear security setup for maintainers.
Code

.github/workflows/codeant-ci-scan.yml[R25-28]

+        uses: CodeAnt-AI/codeant-ci-scan-action@82f83c97a923b626244fdbf9b749ae37308eaf9e # v0.0.5
+        with:
+          access_token: ${{ secrets.ACCESS_TOKEN_GITHUB }}
+          scanners: 'sast,sca,secrets'
Relevance

●●● Strong

Strong precedent for documenting required secrets/setup in docs/security when adding new workflows.

PR-#358
PR-#426
PR-#458

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1856869 requires that new AI-tool manual pre-setup steps (including required secret
names and where to configure them) are documented in an adjacent README/setup doc. The workflow
newly references secrets.ACCESS_TOKEN_GITHUB, but the existing AI/CI tools setup documentation
does not mention ACCESS_TOKEN_GITHUB (nor CodeAnt), so the required manual setup is not documented
in-repo.

Rule 1856869: Manual pre-setup steps for new AI tools must be documented in code adjacent README
.github/workflows/codeant-ci-scan.yml[24-28]
docs/security/ai-ci-tools.md[1-10]
docs/security/ai-ci-tools.md[33-51]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new workflow `.github/workflows/codeant-ci-scan.yml` introduces a required secret (`ACCESS_TOKEN_GITHUB`) but there is no code-adjacent README/setup doc describing what it is and where to configure it.

## Issue Context
This PR adds a new AI security scanning workflow that depends on a manually configured GitHub Actions secret. Our compliance requires documenting these manual pre-setup steps in an adjacent README/setup document.

## Fix Focus Areas
- .github/workflows/codeant-ci-scan.yml[24-28]
- docs/security/ai-ci-tools.md[1-10]
- docs/security/ai-ci-tools.md[33-51]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unguarded required secret ✓ Resolved 🐞 Bug ☼ Reliability
Description
The workflow always invokes the CodeAnt action with ${{ secrets.ACCESS_TOKEN_GITHUB }}; if that
secret is not configured or is unavailable for the triggering event, the action receives an empty
token which can lead to an auth failure or an ineffective/Skipped scan depending on the action’s
behavior. This can unexpectedly break CI signal on PRs or reduce security coverage without a clear
explanation in logs.
Code

.github/workflows/codeant-ci-scan.yml[R24-27]

+      - name: Run CodeAnt CI Scan
+        uses: CodeAnt-AI/codeant-ci-scan-action@82f83c97a923b626244fdbf9b749ae37308eaf9e # v0.0.5
+        with:
+          access_token: ${{ secrets.ACCESS_TOKEN_GITHUB }}
Relevance

●●● Strong

They commonly add guards/logging to avoid silent CI failures when tokens/secrets are missing.

PR-#469
PR-#307

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new workflow passes ACCESS_TOKEN_GITHUB directly to the action with no preceding presence
check. In contrast, an existing workflow in the repo explicitly checks for a missing secret and
skips with a warning, establishing a repo pattern for handling optional secrets safely.

.github/workflows/codeant-ci-scan.yml[24-29]
.github/workflows/ai-pr-description.yml[49-52]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`CodeAnt-AI/codeant-ci-scan-action` is called unconditionally with `access_token: ${{ secrets.ACCESS_TOKEN_GITHUB }}`. When the secret is unset/unavailable, the action receives an empty token and may fail or silently skip scanning, producing unreliable CI/security results.

### Issue Context
Other workflows in this repo explicitly detect missing secrets and skip with a clear warning (e.g., AI PR Description checks `GH_MODELS_TOKEN`).

### Fix Focus Areas
- .github/workflows/codeant-ci-scan.yml[24-29]

### Suggested fix
- Add an explicit guard before running the scan:
 - Option A (skip):
   - Add a step that checks for an empty token and emits `::warning::ACCESS_TOKEN_GITHUB is not set; skipping CodeAnt scan.` then `exit 0`.
   - Add `if: ${{ secrets.ACCESS_TOKEN_GITHUB != '' }}` to the CodeAnt scan step.
 - Option B (fail clearly):
   - If you want this scan to be mandatory on `push` to `main`, fail fast with a clear `::error::` when the token is missing, and optionally skip only for fork PRs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Token bypasses permissions 🐞 Bug ⛨ Security
Description
The workflow declares least-privilege GitHub Actions permissions (contents: read) but then
supplies a separate access token to a third-party action; that token’s scopes are not constrained by
the workflow permissions model. This can effectively grant the action broader repository/API
capabilities than the workflow permissions suggest unless the secret token is independently scoped
to minimum required privileges.
Code

.github/workflows/codeant-ci-scan.yml[R11-13]

+permissions:
+  contents: read
+
Relevance

●● Moderate

Least-privilege is enforced, but “don’t pass extra secrets/tokens” security requests were rejected
in similar contexts.

PR-#135
PR-#350
PR-#496

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The repo’s permissions audit explicitly pushes least-privilege permissions, but this workflow
introduces a separate credential path via ACCESS_TOKEN_GITHUB. Existing security scanning
workflows demonstrate the pattern of using GITHUB_TOKEN + job-level permissions for write
operations, rather than a separately scoped user token.

.github/workflows/permissions-audit.yml[39-45]
.github/workflows/codeant-ci-scan.yml[11-13]
.github/workflows/codeant-ci-scan.yml[24-29]
.github/workflows/osv-scanner.yml[17-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Workflow `permissions` only restrict the auto-provisioned `GITHUB_TOKEN`. Passing an external token via `secrets.ACCESS_TOKEN_GITHUB` means the job’s effective privileges are determined by that secret’s scopes, which can exceed the repo’s least-privilege intent.

### Issue Context
This repo has an explicit permissions-audit workflow encouraging least privilege and job-scoped write permissions. Other security workflows generally use `GITHUB_TOKEN` with explicit job-level permissions when write access is needed (e.g., uploading SARIF).

### Fix Focus Areas
- .github/workflows/codeant-ci-scan.yml[11-13]
- .github/workflows/codeant-ci-scan.yml[24-29]

### Suggested fix
- Prefer `secrets.GITHUB_TOKEN` (or `${{ github.token }}`) if the CodeAnt action supports it, and then grant only required job-level `permissions`.
- If a separate token is required:
 - Use a fine-grained PAT or GitHub App token restricted to this repo only.
 - Limit scopes to the minimum needed by the action (avoid broad write scopes if not required).
 - Document the required scopes in the workflow or repo docs to prevent over-privileged tokens from being used.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 34 rules

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread .github/workflows/codeant-ci-scan.yml
Comment thread .github/workflows/codeant-ci-scan.yml
Comment thread .github/workflows/codeant-ci-scan.yml
genzouw added 2 commits August 7, 2026 07:52
secrets.ACCESS_TOKEN_GITHUB が未設定の場合でも無条件にCodeAnt CI Scanアクションが
実行され、空トークンによる認証失敗や不明瞭なスキャン無効化を招く恐れがあったため、
job-level の env でシークレット有無を判定し、未設定時は警告を出してスキャンステップを
スキップするよう修正。

レビューコメント: #508 (comment)
レビュアー: qodo-code-review
優先度: high
新規追加したCodeAnt CI ScanワークフローのシークレットACCESS_TOKEN_GITHUBについて、
手動設定手順(本リポジトリ専用の最小権限トークンを発行すべきこと、未設定時は
警告を出してスキャンをスキップする挙動)がdocs/security/ai-ci-tools.mdに未記載
だったため、既存の他ツール導入時と同様の形式で追記した。

レビューコメント: #508 (comment)
レビュアー: qodo-code-review
優先度: medium
@github-actions github-actions Bot added github-actions Pull requests that update GitHub Actions code docs labels Aug 6, 2026
@genzouw
genzouw enabled auto-merge (squash) August 7, 2026 01:58
@genzouw
genzouw merged commit a22c6e4 into main Aug 7, 2026
35 of 36 checks passed
@genzouw
genzouw deleted the chore/security-codeant-ai-ci-scan-5020808000545081841 branch August 7, 2026 02:01

@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: 4

🤖 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 @.github/workflows/codeant-ci-scan.yml:
- Around line 30-34: Update the “Run CodeAnt CI Scan” step so it does not
execute scanner code fetched dynamically from api.codeant.ai without
verification. Pin the scanner implementation to a reviewed commit or use an
artifact whose signature or immutable hash is verified before execution, while
preserving the existing access-token gating and secret handling.
- Line 17: Configure a job-level timeout for the workflow job using runs-on:
ubuntu-latest, setting timeout-minutes to approximately 10–15 minutes so stalled
CodeAnt scans cannot occupy the runner until GitHub Actions’ maximum duration.

In `@docs/security/ai-ci-tools.md`:
- Around line 11-20: 「CodeAnt AI CI Scan
の設定」節に、スキャン実行を確認する検証手順と、ワークフローを無効化または削除するロールバック手順を追加してください。既存のACCESS_TOKEN_GITHUB設定および未設定時の挙動の説明は維持し、実行結果の確認方法と復旧操作を具体的に記載してください。
- Around line 15-17: Update the GitHub Secrets setup section to state that
ACCESS_TOKEN_GITHUB must contain a CodeAnt-issued access token, not a GitHub
Fine-grained PAT. Remove the Fine-grained PAT and broad-scope guidance, and add
the CodeAnt access-token issuance steps plus the required scopes.
🪄 Autofix

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: 3b692013-7da6-4c4f-8ce1-d878d7e07571

📥 Commits

Reviewing files that changed from the base of the PR and between 56e5d3b and e74fe7c.

📒 Files selected for processing (2)
  • .github/workflows/codeant-ci-scan.yml
  • docs/security/ai-ci-tools.md

jobs:
codeant_scan:
name: Run CodeAnt CI scan
runs-on: ubuntu-latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
curl -fsSL \
  https://raw.githubusercontent.com/CodeAnt-AI/codeant-ci-scan-action/82f83c97a923b626244fdbf9b749ae37308eaf9e/action.yml \
  | sed -n '30,72p'

Repository: genzouw/monopo

Length of output: 1412


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== file exists =="
test -f .github/workflows/codeant-ci-scan.yml && echo yes || echo no

echo "== codeant-ci-scan.yml first 120 lines =="
sed -n '1,120p' .github/workflows/codeant-ci-scan.yml | nl -ba

echo "== timeout occurrences =="
rg -n "timeout-minutes|codeant_scan|scan_timeout|curl|start_scan" .github/workflows/codeant-ci-scan.yml || true

Repository: genzouw/monopo

Length of output: 256


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf "== codeant-ci-scan.yml lines 1-120 ==\n"
sed -n '1,120p' .github/workflows/codeant-ci-scan.yml

printf "\n== timeout/minutes and codeant_scan occurrences ==\n"
grep -n "timeout-minutes\|codeant_scan\|scan_timeout\|curl\|start_scan\|permissions:" .github/workflows/codeant-ci-scan.yml || true

Repository: genzouw/monopo

Length of output: 1369


ジョブ全体のタイムアウトを設定してください。

scan_timeout はスクリプトへの引数です。ジョブに timeout-minutes がないため、このジョブは GitHub Actions の 360 分上限まで占有されます。CodeAnt API が止まった場合にランナーが長時間占有されないよう、10〜15 分程度のジョブタイムアウトを追加してください。

修正案
   codeant_scan:
     name: Run CodeAnt CI scan
     runs-on: ubuntu-latest
+    timeout-minutes: 15
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 15
🤖 Prompt for 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.

In @.github/workflows/codeant-ci-scan.yml at line 17, Configure a job-level
timeout for the workflow job using runs-on: ubuntu-latest, setting
timeout-minutes to approximately 10–15 minutes so stalled CodeAnt scans cannot
occupy the runner until GitHub Actions’ maximum duration.

Comment on lines +30 to +34
- name: Run CodeAnt CI Scan
if: ${{ env.HAS_ACCESS_TOKEN_GITHUB == 'true' }}
uses: CodeAnt-AI/codeant-ci-scan-action@82f83c97a923b626244fdbf9b749ae37308eaf9e # v0.0.5
with:
access_token: ${{ secrets.ACCESS_TOKEN_GITHUB }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
curl -fsSL \
  https://raw.githubusercontent.com/CodeAnt-AI/codeant-ci-scan-action/82f83c97a923b626244fdbf9b749ae37308eaf9e/action.yml \
  | sed -n '33,72p'

Repository: genzouw/monopo

Length of output: 1367


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow action call =="
sed -n '20,38p' .github/workflows/codeant-ci-scan.yml 2>/dev/null || true

echo
echo "== pinned action.yml keys =="
python3 - <<'PY'
import re, urllib.request
url='https://raw.githubusercontent.com/CodeAnt-AI/codeant-ci-scan-action/82f83c97a923b626244fdbf9b749ae37308eaf9e/action.yml'
text=urllib.request.urlopen(url, timeout=20).read().decode()
for expr in [
  r'api_base:\s*\n\s*([^#\n]+)#',
  r'access_token:\s*\n\s*([^#\n]+)#',
  r'https://api.codeant\.ai',
  r'ACCESS_TOKEN:\s*\$\{\{\s*inputs\.access_token\s*\}\}',
  r'bash\s+start_scan\.sh\s+\\',
]:
    print(f"-- regex {expr!r} --")
    for i,line in enumerate(text.splitlines(),1):
        if re.search(expr, line):
            print(f"{i}: {line}")
PY

Repository: genzouw/monopo

Length of output: 3228


CodeAnt CI Scan でスキャントークンを検証されない実行スクリプトへ渡さないでください。

この Action は実行時に api.codeant.ai から start_scan.sh を取得し、復号後に bash start_scan.sh で実行します。スキャントークンも ACCESS_TOKEN 環境変数として渡されるため、CodeAnt が侵害されるとチェックアウト済みソースとトークンを取得される可能性があります。スキャナ実装を固定コミットに含めるか、署名や不変ハッシュで検証できる成果物に変更してください。

🤖 Prompt for 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.

In @.github/workflows/codeant-ci-scan.yml around lines 30 - 34, Update the “Run
CodeAnt CI Scan” step so it does not execute scanner code fetched dynamically
from api.codeant.ai without verification. Pin the scanner implementation to a
reviewed commit or use an artifact whose signature or immutable hash is verified
before execution, while preserving the existing access-token gating and secret
handling.

Comment on lines +11 to +20
## 新規: CodeAnt AI CI Scan の設定

SAST/SCA/Secretsスキャンを自動実行する `.github/workflows/codeant-ci-scan.yml`(`CodeAnt-AI/codeant-ci-scan-action`)を追加しました。

1. **GitHub Secretsの設定 (必須)**
- リポジトリ管理者権限を持つユーザーが `Settings > Secrets and variables > Actions` にて `ACCESS_TOKEN_GITHUB` を登録してください。
- このトークンはCodeAnt AI側の認証に使用されるため、**本リポジトリ専用に発行した最小権限(Fine-grained PAT等)のトークン**を使用し、組織全体・複数リポジトリにまたがる広いスコープのトークンを使い回さないでください。
2. **未設定時の挙動**
- `ACCESS_TOKEN_GITHUB` が未登録の場合、ワークフローは `::warning::` ログを出力したうえでスキャン実行ステップをスキップします(CI自体は失敗しません)。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

検証手順とロールバック手順を追加してください。

この節には設定手順と未設定時の挙動だけがあります。PR objective が要求する、スキャン実行を確認する手順と、ワークフローを無効化または削除するロールバック手順を記載してください。

🤖 Prompt for 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.

In `@docs/security/ai-ci-tools.md` around lines 11 - 20, 「CodeAnt AI CI Scan
の設定」節に、スキャン実行を確認する検証手順と、ワークフローを無効化または削除するロールバック手順を追加してください。既存のACCESS_TOKEN_GITHUB設定および未設定時の挙動の説明は維持し、実行結果の確認方法と復旧操作を具体的に記載してください。

Comment on lines +15 to +17
1. **GitHub Secretsの設定 (必須)**
- リポジトリ管理者権限を持つユーザーが `Settings > Secrets and variables > Actions` にて `ACCESS_TOKEN_GITHUB` を登録してください。
- このトークンはCodeAnt AI側の認証に使用されるため、**本リポジトリ専用に発行した最小権限(Fine-grained PAT等)のトークン**を使用し、組織全体・複数リポジトリにまたがる広いスコープのトークンを使い回さないでください。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
curl -fsSL \
  https://raw.githubusercontent.com/CodeAnt-AI/codeant-ci-scan-action/82f83c97a923b626244fdbf9b749ae37308eaf9e/README.md \
  | sed -n '95,110p'

Repository: genzouw/monopo

Length of output: 521


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- docs/security/ai-ci-tools.md lines 1-40 ---\n'
sed -n '1,40p' docs/security/ai-ci-tools.md

printf '\n--- search for ACCESS_TOKEN_GITHUB ---\n'
rg -n "ACCESS_TOKEN_GITHUB|CodeAnt|access token|Fine-grained PAT|PAT" .

Repository: genzouw/monopo

Length of output: 243


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- docs/security/ai-ci-tools.md lines 1-40 ---'
sed -n '1,40p' docs/security/ai-ci-tools.md

printf '%s\n' ''
printf '%s\n' '--- search for ACCESS_TOKEN_GITHUB ---'
rg -n "ACCESS_TOKEN_GITHUB|CodeAnt|access token|Fine-grained PAT|PAT" .

Repository: genzouw/monopo

Length of output: 3204


CodeAnt access token の設定手順を載せてください。

ACCESS_TOKEN_GITHUB は CodeAnt CI scan workflow が入力として受け取る Secret の名前です。値は GitHub Fine-grained PAT ではなく、CodeAnt側で発行する access token にします。Line 17 の「Fine-grained PAT等」の説明を削除し、CodeAnt access token の発行手順と必要スコープを記載してください。

🤖 Prompt for 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.

In `@docs/security/ai-ci-tools.md` around lines 15 - 17, Update the GitHub Secrets
setup section to state that ACCESS_TOKEN_GITHUB must contain a CodeAnt-issued
access token, not a GitHub Fine-grained PAT. Remove the Fine-grained PAT and
broad-scope guidance, and add the CodeAnt access-token issuance steps plus the
required scopes.

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

Labels

docs github-actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant