[bug] STATVS secret filter accepts classic GitHub tokens (ghp_…): the rule expects a dash

オープン 初心者向け
#3,135 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
bun, typescript
領域
backend, security

調査の方向性

LIFEOS/STATVS/lib/refuse.ts:16から始め、credentialRefusalとVigilのvalidateEventがSECRET_RESをどのように使っているかを読んでください。既存のテストが各GitHubトークンのプレフィックスと35文字と36文字の境界を網羅しているか確認してください。issueにはローカルでの検証と提案されたルールが記載されていますが、テストファイル名は挙げられていません。両方のモードで従来形式のトークンが拒否され、列挙された一般的な文字列は引き続き受け入れられれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Version

LifeOS 8.761.0 · attestation: 180 system file(s) differ from danielmiessler/[email protected] · 9 system file(s) missing:

  • hooks/VoiceCompletion.hook.ts
  • hooks/DriftReminder.hook.ts
  • hooks/ISASync.hook.ts
  • hooks/ModelDriftGuard.hook.ts
  • hooks/README.md
  • hooks/ISARenderOnStop.hook.ts
  • hooks/PromptProcessing.hook.ts
  • hooks/lib/work-config.ts
  • hooks/lib/herdr-tabs.ts
  • hooks/lib/format-caps.ts
  • hooks/lib/notification-channel.ts
  • hooks/FormatGate.hook.ts
  • hooks/SubagentGitSandbox.hook.ts
  • hooks/handlers/VoiceNotification.ts
  • hooks/handlers/DocCrossRefIntegrity.ts
  • hooks/handlers/UpdateCounts.ts
  • skills/Prioritize/Tools/Prioritize.ts
  • skills/Prioritize/Setup.md
  • skills/StateLog/SKILL.md
  • skills/Errata/Tools/Er.ts
  • skills/Errata/Tools/Send.ts
  • skills/Errata/Intents/Send.md
  • skills/CreateSkill/SKILL.md
  • skills/CreateSkill/Intents/OptimizeDescription.md
  • skills/CreateSkill/Intents/CreateSkill.md
  • skills/RichFormat/tests/engine.test.tsx
  • skills/RichFormat/hooks/table.ts
  • skills/RichFormat/hooks/workflow.ts
  • skills/RichFormat/hooks/register.tsx
  • skills/RichFormat/hooks/stream.ts
  • skills/RichFormat/hooks/enrich.ts
  • skills/RichFormat/SKILL.md
  • skills/LifeOSHooks/hooks/LifeOSHooks.ts
  • skills/Herdr/Intents/Configure.md
  • skills/Interview/Intents/Phase0Setup.md
  • skills/LifeOS/Tools/Report.ts
  • skills/LifeOS/SKILL.md
  • skills/Fabric/Patterns/create_better_frame/system.md
  • skills/Fabric/Patterns/extract_article_wisdom/README.md
  • skills/Fabric/Patterns/extract_wisdom/README.md
  • …and 140 more
What is broken

The STATVS secret filter (SECRET_RES in LIFEOS/STATVS/lib/refuse.ts, shared by STATVS credentialRefusal and Vigil validateEvent) does not catch classic GitHub tokens. Its token rule is /\b(?:sk|pk|ghp|glpat|csk)-[A-Za-z0-9_-]{16,}/i, with a dash after ghp, but GitHub's tokens use an underscore: ghp_, gho_, ghu_, ghs_, ghr_ plus 36 characters. At 40 characters a classic token is also under the 48-character long-run rule, so nothing in SECRET_RES matches it, and a STATVS row or Vigil event carrying one is accepted. Fine-grained tokens (github_pat_…, 93 characters) are caught today, but only by the generic long-run rule.

Where (file:line)

LIFEOS/STATVS/lib/refuse.ts:16

Repro on a clean tree
On a clean 8.761.0 tree, with a synthetic value:

`bun -e 'import {credentialRefusal} from "./LIFEOS/STATVS/lib/refuse.ts"; const t="ghp_"+"Ab3x".repeat(9); console.log(credentialRefusal(t)??"ACCEPTED", credentialRefusal(t,{slugs:true})??"ACCEPTED")'`

Expected: refused twice. Actual: `ACCEPTED ACCEPTED`. Negative control: the same value with `ghp-` is refused. The captured probe below shows the classic form accepted, the fine-grained form and the dash form refused.
Negative control

Probe: cd /tmp/claude-501/d3 && bun probe-token.ts · exit 1 · captured 2026-12-02T10:51:06.128Z

Red looks like: GITHUB TOKEN ACCEPTED

classic ghp_: ACCEPTED | fine-grained github_pat_: Credential-shaped string refused | dash control ghp-: Credential-shaped string refused
GITHUB TOKEN ACCEPTED
Suggested fix

One added rule in SECRET_RES, case-sensitive like GitHub's prefixes, without a left word boundary so a token glued to a prefix (MY_TOKEN_ghp_…) is still caught:

   /\b(?:sk|pk|ghp|glpat|csk)-[A-Za-z0-9_-]{16,}/i,
+  // GitHub's own token forms use an underscore (classic gh?_ + 36, fine-grained github_pat_ + 22 + "_" + 59).
+  // No left boundary, so a token glued to text before it is still caught. Case-sensitive, and the fine-grained form
+  // needs its first 22 unbroken letters and digits, so GITHUB_PAT_SOME_SETTING stays accepted.
+  /(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9]{22,})/,

Tested locally with a new refuse.test.ts: synthetic tokens of every prefix at the edge lengths (35 accepted, 36 refused), glued prefixes, both modes, and ordinary rows that must stay accepted (paths, slugs, 12-char commit refs, ghost_town, GITHUB_PAT_CONFIGURATION_GUIDE_FOR_CI). Vigil's tests stay green. Trade-off: github_pat_ followed by one unbroken 22+ letter word is refused.

Environment
  • OS: macOS 27.0 (arm64)
  • Harness: claude-code
  • bun: 1.4.3 · git: 2.54.0
  • Doctor broken: none
主要言語
TypeScript
スター
20.7k
フォーク
2.6k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

danielmiessler/LifeOS のほかの issue

danielmiessler/LifeOS の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。