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

Abierto Apto para principiantes
#3,135 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
bun, typescript
Área
backend, security

Línea de trabajo

Empieza por LIFEOS/STATVS/lib/refuse.ts:16 y lee cómo usan SECRET_RES credentialRefusal y validateEvent de Vigil. Comprueba si las pruebas existentes cubren cada prefijo de token de GitHub y el límite entre 35 y 36 caracteres; el issue informa de una prueba local y una regla propuesta, pero no menciona ningún archivo de pruebas. Se considera terminado cuando se rechacen las formas clásicas de tokens en ambos modos, mientras que las cadenas ordinarias enumeradas sigan aceptándose.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
TypeScript
Estrellas
20.7k
Forks
2.6k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de danielmiessler/LifeOS

Todos los issues de danielmiessler/LifeOS

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.