Skip to content

Add EnvVarHeaderContentGuard - #8015

Open
decko wants to merge 7 commits into
pulp:mainfrom
decko:pulp-2257-envvar-header-guard
Open

Add EnvVarHeaderContentGuard#8015
decko wants to merge 7 commits into
pulp:mainfrom
decko:pulp-2257-envvar-header-guard

Conversation

@decko

@decko decko commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds EnvVarHeaderContentGuard so a Base64-encoded request header can be checked against a content-app environment variable (fixes #8007). Rotation is a deploy/env change, not a DB update of HeaderContentGuard.header_value.
  • env_var must be listed in ENVVAR_HEADER_CONTENT_GUARD_ALLOWED_VARS (default []). The secret is never stored or returned by the API.
  • Unit and functional tests use ENVVAR_HEADER_GUARD_TEST_SECRET from the Pulp container env (injected via template_config.yml / CI pulp_env).

Test plan

  • pytest -k envvar_header unit tests (secret + allowlist set in the pulp container)
  • pytest -k envvar_header functional tests (create guard, 403 without/wrong header, 404 with matching Base64 header, 400 for disallowed env_var, access policy present)
  • Confirm OpenAPI path /pulp/api/v3/contentguards/core/envvar_header/ and that GET does not expose a secret value

Related: PULP-2257, pulp-service prototype pulp/pulp-service#1420

Assisted-by: Cursor Grok 4.6

Made with Cursor

decko and others added 2 commits August 26, 2026 18:33
Validate a Base64-encoded request header against a content-app
environment variable so shared secrets can rotate without updating
guard records. Names must be listed in
ENVVAR_HEADER_CONTENT_GUARD_ALLOWED_VARS.

fixes pulp#8007

Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
decko and others added 5 commits August 26, 2026 19:18
Reject names not in ENVVAR_HEADER_CONTENT_GUARD_ALLOWED_VARS before
decoding the request header.

Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the env and allowlist in template_config.yml; do not hand-edit
the plugin-template output.

Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
CLI support needs a separate pulp-cli PR; the REST API is available now.

Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant