Repository navigation
Fix: validate HTTP status before treating response as pull secret - #1032
openshift-merge-bot[bot] merged 1 commit into
Conversation
GetPullSecret() posts to /api/accounts_mgmt/v1/access_token and treats the response body as the pull secret unconditionally. The ocm-sdk-go Send() call only returns an error on transport failure; any HTTP status (401, 403, 503, etc.) is returned as a normal response per the SDK's own doc comment. On a non-200 response, the error JSON body was being written to ~/.kube/ocm-pull-secret/config.json as if it were a valid podman/docker authfile. Because fetchPullSecretIfNotExist() only re-fetches when that file is absent, a single transient failure (or an account lacking the required entitlement) permanently poisons the cached authfile. Every subsequent `ocm backplane console` pull then fails with a generic "access denied" from podman, with no indication the real cause was an OCM-side error. This adds a status check so a non-200 response surfaces as an error instead of being cached as a broken credential. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
ChangesPull-secret response handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Merge Risk:
|
|
@cjnovak98: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1032 +/- ##
==========================================
- Coverage 56.63% 56.58% -0.06%
==========================================
Files 78 78
Lines 6191 6193 +2
==========================================
- Hits 3506 3504 -2
- Misses 2280 2283 +3
- Partials 405 406 +1
🚀 New features to boost your workflow:
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: geowa4 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
GetPullSecret() posts to /api/accounts_mgmt/v1/access_token and treats the response body as the pull secret unconditionally. The ocm-sdk-go Send() call only returns an error on transport failure; any HTTP status (401, 403, 503, etc.) is returned as a normal response per the SDK's own doc comment. On a non-200 response, the error JSON body was being written to ~/.kube/ocm-pull-secret/config.json as if it were a valid podman/docker authfile.
Because fetchPullSecretIfNotExist() only re-fetches when that file is absent, a single transient failure (or an account lacking the required entitlement) permanently poisons the cached authfile. Every subsequent
ocm backplane consolepull then fails with a generic "access denied" from podman, with no indication the real cause was an OCM-side error.This adds a status check so a non-200 response surfaces as an error instead of being cached as a broken credential.
What type of PR is this?
What this PR does / Why we need it?
Which Jira/Github issue(s) does this PR fix?
Special notes for your reviewer
Unit Test Coverage
Guidelines
Test coverage checks
Pre-checks (if applicable)
/label tide/merge-method-squash
Summary by CodeRabbit