Skip to content

feat(b-0582): decompose slice 1 and 2 (destructive verb refusal gate)#3967

Open
AceHack wants to merge 1 commit into
mainfrom
lior/decompose-3964-slice1
Open

feat(b-0582): decompose slice 1 and 2 (destructive verb refusal gate)#3967
AceHack wants to merge 1 commit into
mainfrom
lior/decompose-3964-slice1

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 16, 2026

Decomposing PR #3964 (narration-over-action blob) into actionable slices. This PR implements Slice 1 (skeleton) and Slice 2 (refusal list JSON) for the mechanical pre-call refusal gate. Bias toward execution.

Copilot AI review requested due to automatic review settings May 16, 2026 23:16
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05b2090f7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +16 to +18
// Skeleton implementation.
// In future slices, this will load from refusal-list.json and evaluate patterns.
console.log(`[Gate] Checking verb: ${command} with args:`, args);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Implement refusal matching before allowing commands

assertVerbAllowed currently only logs and returns, so every command is effectively allowed even when it should be denied by the refusal list. Any caller that trusts this function as a pre-call safety gate will execute destructive verbs (for example force-push or repo deletion) without interruption, which defeats the security control this commit introduces.

Useful? React with 👍 / 👎.

export function assertVerbAllowed(command: string, args: string[]): void {
// Mechanical refusal gate
// Throws an error if the verb/args match the refusal list.
const fullCmd = [command, ...args].join(' ');
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces the first two slices of B-0582’s “destructive verb refusal gate” by adding (1) a TypeScript skeleton module intended to enforce a pre-call refusal check and (2) a JSON-configured initial refusal verb list to be used by the gate.

Changes:

  • Added tools/auth/destructive-verb-gate.ts with exported types and a stub assertVerbAllowed(...) entrypoint.
  • Added tools/auth/refusal-list.json defining the initial set of destructive-class refusal patterns.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tools/auth/refusal-list.json Adds the initial refusal verb list (names, patterns, descriptions) intended for the mechanical gate.
tools/auth/destructive-verb-gate.ts Adds the gate module skeleton (types + stub function) that will later load/evaluate the refusal list.
Comments suppressed due to low confidence (1)

tools/auth/destructive-verb-gate.ts:14

  • P0: fullCmd is declared but never used. With noUnusedLocals: true in tsconfig, this will fail the lint (tsc tools) gate. Remove fullCmd for now, or use it in the skeleton (e.g., log the assembled command string or pass it into the matcher).
    const fullCmd = [command, ...args].join(' ');

Comment on lines +12 to +17
// Mechanical refusal gate
// Throws an error if the verb/args match the refusal list.
const fullCmd = [command, ...args].join(' ');

// Skeleton implementation.
// In future slices, this will load from refusal-list.json and evaluate patterns.
Comment on lines +2 to +18
name: string;
pattern: string;
description: string;
}

export interface RefusalList {
verbs: RefusalVerb[];
}

export function assertVerbAllowed(command: string, args: string[]): void {
// Mechanical refusal gate
// Throws an error if the verb/args match the refusal list.
const fullCmd = [command, ...args].join(' ');

// Skeleton implementation.
// In future slices, this will load from refusal-list.json and evaluate patterns.
console.log(`[Gate] Checking verb: ${command} with args:`, args);
},
{
"name": "history_rewrite",
"pattern": "git push.*--force",
{
"name": "webhook_creation",
"pattern": "gh api.*POST.*hooks",
"description": "Webhook creation to unallowlisted endpoint"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants