Skip to content

Security: fail closed when auth is enabled but misconfigured #1460

@MaxGhenis

Description

@MaxGhenis

Summary

policyengine-household-api fails open when auth is enabled but misconfigured.

Severity

High

Impact

A production deployment with incomplete Auth0 configuration silently becomes public instead of refusing to start.

Affected code

  • policyengine_household_api/decorators/auth.py:97-130
  • config/production.yaml.example:19-24
  • policyengine_household_api/api.py:35-70

Details

If auth.enabled is true but auth0.address/auth0.audience are missing, _setup_authentication() logs a warning and installs NoOpDecorator().

Expected behavior

When auth is requested but config is invalid, startup should fail closed.

Suggested remediation

  • Raise a startup exception when auth is enabled but incomplete
  • Keep NoOpDecorator limited to explicit local/dev modes only
  • Add tests asserting misconfigured production auth prevents app startup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions