AltimateAI / AltimateAI/altimate-code

De-fork spike S3: HardPolicy kill gate (non-bypassable DDL denies at every dispatcher)

Abierto
#1,017 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
811
Forks
134
Merge medio
3 d 2 h
PR fusionados (30 d)
50

Descripción

Stage S3 of the de-fork spike — the kill gate. Enforce non-bypassable hard denies (sql_execute DDL: DROP DATABASE/SCHEMA/TRUNCATE; bash DDL) at EVERY model-invoked tool-execution dispatcher, preserving today's behavior (these already block; S3 relocates them to one audited chokepoint).

- NEW \`packages/opencode/src/altimate/policy/hard-policy.ts\` — pure/synchronous/total \`HardPolicy.check()\`; malformed args fail closed (policy_internal_error), never throws/implicit-allows. Emits a structured audit record per call (the oracle — NOT the trace).
- HardPolicy.check inserted before tool.execute at all active + latent dispatchers (D1/D2/D6 in session/prompt.ts, D3/D4 in session/tools.ts, D5 in tool/batch.ts) + fail-closed init in effect/app-runtime.ts.
- Fixes a real bypass: the fork's resolvers discarded \`tool.execute.before\`'s return value, so a before-hook that mutated args (SELECT -> DROP DATABASE) executed the mutation unchecked. S3 captures the post-hook FINAL args and checks THOSE.
- 18 tests (bypass matrix): allow-all config still denies; near-miss controls run; deny is terminal (execute + tool.execute.after skipped); audit oracle asserted.

This is a security boundary + the spike's decision checkpoint. HELD for human go/no-go — do not auto-merge.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.