Skip to content

[auth] Exempt direct CLI invocation from SECRET_KEY guard#1161

Merged
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:main
Jul 13, 2026
Merged

[auth] Exempt direct CLI invocation from SECRET_KEY guard#1161
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:main

Conversation

@frankrousseau

Copy link
Copy Markdown
Contributor

Problem

  • python zou/cli.py <cmd> and python -m zou.cli <cmd> refused to start with the insecure-default SECRET_KEY error, even though CLI runs are meant to be exempt.

Solution

  • Also detect the CLI when the __main__ module is cli.py, not only when zou.cli is imported (which only the zou console-script entry point triggers). Server boot still refuses the default key.

The default-SECRET_KEY guard exempted the CLI by checking for "zou.cli"
in sys.modules, but that name only appears when the `zou` console script
imports it. Running `python zou/cli.py` or `python -m zou.cli` executes
cli.py as __main__, so the exemption missed those paths and the CLI
refused to start. Also match on the __main__ module being cli.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@frankrousseau
frankrousseau merged commit 4918727 into cgwire:main Jul 13, 2026
14 of 15 checks passed
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