Skip to content

RHINENG-32537: add override header to candlepin - #2363

Merged
dominikvagner merged 1 commit into
RedHatInsights:masterfrom
dominikvagner:fix-candlepin-override-header
Oct 15, 2026
Merged

dominikvagner merged 1 commit into
RedHatInsights:masterfrom
dominikvagner:fix-candlepin-override-header

Conversation

@dominikvagner

@dominikvagner dominikvagner commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This makes Patchman add a x-rh-override-exposed header to Candlepin requests which is needed after the API has moved to Akamai. The header value is consumed from the content sources candlepin secret. If this header is configured, the debug requests are turned off to prevent logging the secret value.
And the Candlepin CA environment variable is made optional as it should no longer be used.

Summary by Sourcery

Support Akamai-backed Candlepin requests with an optional override header while protecting its secret value.

New Features:

  • Add support for configuring and sending the Red Hat override header with Candlepin requests.

Bug Fixes:

  • Prevent Candlepin debug logging from exposing the configured override secret.

Enhancements:

  • Make the Candlepin CA secret optional for deployments where it is no longer required.

Deployment:

  • Expose the optional Candlepin override header and CA values from the Candlepin secret in deployment configuration.

Tests:

  • Add coverage for override header propagation, debug logging behavior, and environment configuration.

This makes Patchman add a `x-rh-override-exposed` header to Candlepin
requests which is needed after the API has moved to Akamai.
The header value is consumed from the content sources candlepin secret.
If this header is configured, the debug requests are turned off to
prevent logging the secret value.
And the Candlepin CA environment variable is made optional as it should
no longer be used.
@dominikvagner
dominikvagner requested a review from a team as a code owner October 15, 2026 10:45
@sourcery-ai

sourcery-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR adds optional Candlepin override-header support by loading the secret from configuration, attaching it to client requests, and disabling HTTP debug dumps whenever it is configured to avoid secret leakage. It also makes the CA secret optional, wires both values through deployment manifests, and adds request and configuration tests.

File-Level Changes

Change Details Files
Inject the optional override secret into all Candlepin client requests while preventing its exposure through trace-level HTTP dumps.
  • Read the override value from core configuration.
  • Set the x-rh-override-exposed default header when configured.
  • Disable request debugging whenever the secret header is present.
  • Add coverage for header propagation and debug behavior across GET and PUT requests.
base/candlepin/candlepin.go
base/candlepin/candlepin_test.go
Expose the Candlepin override header as environment-backed configuration.
  • Add a configuration field for CANDLEPIN_X_RH_OVERRIDE_EXPOSED.
  • Test loading both configured and empty values from the environment.
base/utils/config.go
base/utils/config_test.go
Update deployment secret wiring for deployments with or without the Candlepin CA and override secret.
  • Mark the Candlepin CA secret key optional.
  • Map the optional x-rh-override-exposed secret key into the new environment variable for both application workloads.
deploy/clowdapp.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. When configured, the client sends the secret header on Candlepin requests, where it may enable override behavior; if that value is wrong or exposed, requests could have effects that reverting the client change would not undo. Disabling HTTP dumps reduces one leak path, but does not undo a request already processed by Candlepin.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.04%. Comparing base (6710aae) to head (3aacd9e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2363      +/-   ##
==========================================
+ Coverage   58.89%   59.04%   +0.14%     
==========================================
  Files         151      151              
  Lines        9706     9712       +6     
==========================================
+ Hits         5716     5734      +18     
+ Misses       3386     3372      -14     
- Partials      604      606       +2     
Flag Coverage Δ
unittests 59.04% <100.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dominikvagner
dominikvagner merged commit 85b1c76 into RedHatInsights:master Oct 15, 2026
9 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.

3 participants