Skip to content

feat(shim): add inline --no-refuse bypass flag#29

Open
gok03 wants to merge 1 commit into
mainfrom
feat/no-refuse-flag
Open

feat(shim): add inline --no-refuse bypass flag#29
gok03 wants to merge 1 commit into
mainfrom
feat/no-refuse-flag

Conversation

@gok03
Copy link
Copy Markdown
Contributor

@gok03 gok03 commented May 21, 2026

Summary

Append `--no-refuse` to any wrapped install to skip the gate for that one command:

```sh
pip install pyyaml==5.3 --no-refuse # runs the real pip, ungated
npm install lodash@4.17.10 --no-refuse
```

Friendlier than exporting `REFUSE_NO_GATE=1` for a one-off. The shim strips every occurrence of `--no-refuse` from argv before exec'ing the real binary — no package manager understands the flag, so leaving it in would make the real command error.

Security note

Bypass is shim-only (interactive PATH use). The agent PreToolUse hook path (`refuse gate`) doesn't honor `--no-refuse`, so an autonomous agent can't append it to defeat its own gate. Documented in the README.

Verified end-to-end

Command Result
`npm install lodash@4.17.10` blocked, exit 2
`npm install lodash@4.17.10 --no-refuse` real npm runs with `install lodash@4.17.10` (flag stripped), exit 0

Test plan

  • CI green
  • `stripFlag` unit tests pass (added)
  • After release, `pip install --no-refuse` bypasses; without it, blocks

Append `--no-refuse` to any wrapped install to skip the gate for that one
command, e.g. `pip install pyyaml==5.3 --no-refuse`. Friendlier than
exporting REFUSE_NO_GATE for a one-off.

The flag is ours, not the underlying manager's, so the shim strips every
occurrence from argv before exec'ing the real binary — no package manager
understands --no-refuse and leaving it in would make the real command
error.

Bypass is shim-only (interactive PATH use). The agent PreToolUse hook
path doesn't honor it, so an autonomous agent can't append --no-refuse to
defeat its own gate.

Verified end-to-end:
  npm install lodash@4.17.10              → blocked (exit 2)
  npm install lodash@4.17.10 --no-refuse  → real npm runs with
                                            "install lodash@4.17.10"
                                            (flag stripped), exit 0
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.

1 participant