GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — chore: CI セキュリティスキャン 3 件追加 (#205) by ymnao · Pull Request #218 · ymnao/scripta Conversation
Owner
概要CI セキュリティスキャンを 3 件追加し、Dependabot 単独運用が拾わない層を塞ぐ。アプリコードは変更せず workflow ファイルのみ。レビュー指摘 6 件 (P1×1 / P2×5) を全件反映済み。 関連 Issuecloses #205 移行 Stage該当なし(CI/CD 側の補強)。 変更内容追加された workflow (3 件)
設計判断
採用見送り (issue 記載通り)
動作確認ローカル検証 (全 pass)
CI / merge gate 確認 (PR 作成後)
Branch protection 必須化 (merge 前に実施)現状の必須 checks は
gh api repos/ymnao/scripta/branches/main/protection/required_status_checks \ --method PATCH \ -F strict=true \ -f 'contexts[]=lint' \ -f 'contexts[]=typecheck' \ -f 'contexts[]=test' \ -f 'contexts[]=build' \ -f 'contexts[]=e2e' \ -f 'contexts[]=electron-e2e' \ -f 'contexts[]=dependency-review' \ -f 'contexts[]=Analyze (javascript-typescript)'
レビュー対応履歴
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions- CodeQL workflow 新規 (.github/workflows/codeql.yml) — JS/TS 静的解析、 push/PR/weekly schedule、build-mode: none、SHA pin - dependency-review-action を ci.yml に job 追加 — PR diff の新規依存に 既知 advisory が無いか gate、fail-on-severity: high、PR 限定 - pnpm audit weekly 新規 (.github/workflows/audit.yml) — 検出時のみ peter-evans/create-issue-from-file で issue 作成、同 label の open issue が あれば issue-number 渡してコメント追加で idempotent 全 action は SHA pin (codeql v4.36.2 / dep-review v5.0.0 / create-issue v6.0.0)。cron は日曜 05:30 UTC (codeql) と月曜 06:30 UTC (audit) で 曜日・時間分散。 closes #205 - paths-ignore で markdown / docs / ISSUE_TEMPLATE の no-op push を scan 対象外に
(schedule trigger には paths-ignore が適用されないので main baseline は保持)
- concurrency.cancel-in-progress を `${{ github.event_name != 'schedule' }}` で
動的化。schedule run の SARIF upload が PR push に巻き込まれて中断されるのを
防ぐ (audit.yml の cancel-in-progress: false と同方針に揃える)
/simplify の他指摘 2 件はいずれも skip:
- peter-evans/create-issue-from-file v6 の native search-existing オプション →
v6 action.yml に該当 input は存在せず (agent の hallucination、false positive)
- audit job が pnpm install --frozen-lockfile を full 実行する非効率 →
composite action 改修は他 job への副作用があり scope creep。別 PR で対応
P2-1: CodeQL の定期実行が main への push でキャンセルされる
concurrency.cancel-in-progress を schedule では false に動的化していたが、
GitHub Actions の cancel-in-progress は **後発 job 側** の設定が effective なので、
schedule 走行中に push が来ると後発 push の cancel-in-progress: true で
先発 schedule がキャンセルされる。group key 自体を分離する必要がある。
→ group を `codeql-${{ github.event_name == 'schedule' && 'scheduled' || github.ref }}`
に変更し、schedule run を別 group へ隔離 (cancel-in-progress: true へ戻す)
P2-2: 既存監査 Issue にコメント追加されず本文が上書きされる
peter-evans/create-issue-from-file の issue-number は src/main.ts:46-52 で
octokit.issues.update を呼んでおり、body を完全上書きする (= 過去の検出履歴と
対応記録が失われる)。
→ 既存 issue がある場合は gh issue comment で append、無い場合のみ
create-issue-from-file で新規作成、と step を 2 つに分割。
create step は if: ... && issue_number == ''
comment step は if: ... && issue_number != ''
P2-3: pnpm audit の全エラーを advisory と判定する
「非 0 = advisory あり」と単純化していたため、registry / network エラーで
非 0 exit になった場合も has_advisories=true となり、空 / 不正な内容の issue が
作成されていた。
→ jq で JSON 妥当性を検証 → invalid なら job fail
exit code を case で 0/1/* に厳密分岐 → 0=no_advisory、1=advisory、
それ以外 (registry/network error 想定) は job fail
pnpm v11.6.0 で `pnpm audit --json` の出力形式 (`{"advisories":{},"metadata":{...}}`)
を実機確認、jq -e . が truthy 判定で通ることを確認済み。
P1-1: security-audit ラベルが存在せず Issue 重複生成される
peter-evans/create-issue-from-file は「issue create → addLabels」順で API を
叩くが、未存在ラベルへの addLabels は GitHub REST API 仕様で 422 を返し
action 全体が fail する。issue 作成済み・label 未付与の状態となり、次回 run の
find_issue が見落として重複 issue が量産される。
→ workflow 内で `gh label create security-audit --force` を冪等に実行する step を
追加 (--force で既存なら update、無ければ create)
P2-2: issues: write トークンが依存パッケージの postinstall から悪用可能
actions/checkout はデフォルトで `.git/config` に GITHUB_TOKEN を保存
(persist-credentials: true)。後段 setup-node-pnpm の pnpm install 実行時に
侵害パッケージの postinstall script が token を読み取り、issue API を叩いて
改ざん・spam に悪用され得る。本 job は issues: write を持つため悪用範囲が大きい。
→ audit.yml の checkout に `with: persist-credentials: false` を追加。
gh CLI を使う step は env.GH_TOKEN で明示的に渡しているため影響なし。
※ codeql.yml と ci.yml の dependency-review は setup-node-pnpm を使わず
postinstall scripts を実行しないので本対応の範囲外。
P2-1: dependency-review がマージゲートになっていない、は別途対応
branch protection の必須 checks は [lint, typecheck, test, build, e2e,
electron-e2e] で dependency-review / codeql が含まれない。本 PR では workflow
を整え、merge 後に手動で branch protection を更新する想定 (gh api で PATCH)。
PR description に手順を明記する。
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
ymnao
added a commit
that referenced
this pull request
- `CHANGELOG.md` に v0.5.0 セクションを追加 - Added: #202 → #221 (バックリンクパネル) - Fixed: #220 → #222 (タブ切替 undo 履歴消失) - Security: #204 → #210 (Electron Tier 1 補完), #205 → #218 (CI スキャン 3 件), #223 (codeql-skip stub), #201 (undici 9 件) - Internal: #203 → #223 (ADR-0010 MiniSearch Rejected) - Dependencies: #199 + #211-#217 → #219 (Dependabot 8 件集約) - `package.json` の `version` を `0.4.0` → `0.5.0` - HANDOFF の規約通り、本 commit では `pnpm <script>` を呼ばない (lockfile / node_modules には触れない)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. chore: CI セキュリティスキャン追加 (CodeQL / dependency-review / pnpm audit)Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |