Skip to content

OCPBUGS-78802: Fix token auth annotation to use opt-in instead of opt-out#15998

Closed
TheRealJon wants to merge 1 commit intoopenshift:mainfrom
TheRealJon:token-auth-annotation-bug
Closed

OCPBUGS-78802: Fix token auth annotation to use opt-in instead of opt-out#15998
TheRealJon wants to merge 1 commit intoopenshift:mainfrom
TheRealJon:token-auth-annotation-bug

Conversation

@TheRealJon
Copy link
Member

@TheRealJon TheRealJon commented Feb 5, 2026

Summary

Fixes regression where operators without explicit token-auth-aws: "true" annotation incorrectly show the ARN role field in the subscription form on AWS STS clusters.

Problem

Cluster Observability Operator (and similar operators) have features.operators.openshift.io/token-auth-aws: "false" but the ARN field was still showing in the subscription form on 4.21, even though it worked correctly in 4.20.

Root Cause

Regression introduced in commit a931fbd (Sep 9, 2024) during the "Fix JSON annotation parsing issue and harden related code" refactor.

Before refactor (correct opt-in behavior):

if (tokenAuthAWS === 'true' && isAWSSTSCluster(...)) {
  infrastructureFeatures.push(InfraFeatures.tokenAuth);
}

After refactor (buggy opt-out behavior):

const awsTokenAuthIsSupported =
  clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] !== 'false';

This changed the logic from opt-in to opt-out:

  • ❌ Missing annotation → defaults to supported (shows ARN field)
  • undefined !== 'false'true (shows ARN field)
  • 'false' !== 'false'false (hides ARN field)

Solution

Restore opt-in behavior by changing condition from !== 'false' to === 'true':

const awsTokenAuthIsSupported =
  clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] === 'true';

Now operators must explicitly opt-in by setting the annotation to "true" to show credential fields.

Changes

  • Fixed token auth logic for both AWS and Azure annotations in operator-hub-utils.ts
  • Updated 4 existing tests to include explicit 'true' annotations
  • Added 2 new regression tests:
    • Verifies TokenAuth excluded when annotation is "false"
    • Verifies TokenAuth excluded when annotation is missing

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed token authentication feature gating logic for AWS STS and Azure workload identity federation clusters to require explicit 'true' configuration values instead of accepting any non-false values.
  • Tests

    • Added test coverage validating token authentication feature behavior across different cluster configurations and annotation states.

Restore correct opt-in behavior for token-auth-aws/azure annotations.
Operators must explicitly set the annotation to "true" to show ARN/credential
fields in subscription form on STS/WIF clusters.

Regression introduced in a931fbd changed logic from opt-in (=== 'true')
to opt-out (!== 'false'), causing operators without annotation or with
annotation set to "false" to incorrectly show credential fields.

This fix ensures Cluster Observability Operator and similar operators
with token-auth-aws: "false" don't show ARN field, matching 4.20 behavior.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci openshift-ci bot requested review from rhamilto and spadgett February 5, 2026 16:33
@openshift-ci openshift-ci bot added the component/olm Related to OLM label Feb 5, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 5, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TheRealJon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This change updates the TokenAuth feature gating logic in the operator-hub utilities to enforce stricter validation. The implementation shifts from accepting any value except 'false' to requiring the explicit string 'true' for the awsTokenAuthIsSupported and azureTokenAuthIsSupported conditions. Corresponding test coverage is expanded to validate behavior across multiple scenarios: when annotations are explicitly true, false, or absent for AWS STS and Azure WIF clusters. All existing test inputs are updated to include the new TokenAuth annotations.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the core change: fixing token auth annotations from opt-out (!== 'false') to opt-in (=== 'true') logic across AWS and Azure credential handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 5, 2026

@TheRealJon: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-console fb282fe link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@TheRealJon TheRealJon changed the title Fix token auth annotation to use opt-in instead of opt-out OCPBUGS-78802: Fix token auth annotation to use opt-in instead of opt-out Mar 18, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 18, 2026
@openshift-ci-robot
Copy link
Contributor

@TheRealJon: This pull request references Jira Issue OCPBUGS-78802, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

Fixes regression where operators without explicit token-auth-aws: "true" annotation incorrectly show the ARN role field in the subscription form on AWS STS clusters.

Problem

Cluster Observability Operator (and similar operators) have features.operators.openshift.io/token-auth-aws: "false" but the ARN field was still showing in the subscription form on 4.21, even though it worked correctly in 4.20.

Root Cause

Regression introduced in commit a931fbd (Sep 9, 2024) during the "Fix JSON annotation parsing issue and harden related code" refactor.

Before refactor (correct opt-in behavior):

if (tokenAuthAWS === 'true' && isAWSSTSCluster(...)) {
 infrastructureFeatures.push(InfraFeatures.tokenAuth);
}

After refactor (buggy opt-out behavior):

const awsTokenAuthIsSupported =
 clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] !== 'false';

This changed the logic from opt-in to opt-out:

  • ❌ Missing annotation → defaults to supported (shows ARN field)
  • undefined !== 'false'true (shows ARN field)
  • 'false' !== 'false'false (hides ARN field)

Solution

Restore opt-in behavior by changing condition from !== 'false' to === 'true':

const awsTokenAuthIsSupported =
 clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] === 'true';

Now operators must explicitly opt-in by setting the annotation to "true" to show credential fields.

Changes

  • Fixed token auth logic for both AWS and Azure annotations in operator-hub-utils.ts
  • Updated 4 existing tests to include explicit 'true' annotations
  • Added 2 new regression tests:
  • Verifies TokenAuth excluded when annotation is "false"
  • Verifies TokenAuth excluded when annotation is missing

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

  • Fixed token authentication feature gating logic for AWS STS and Azure workload identity federation clusters to require explicit 'true' configuration values instead of accepting any non-false values.

  • Tests

  • Added test coverage validating token authentication feature behavior across different cluster configurations and annotation states.

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 18, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 18, 2026

PR needs rebase.

Details

Instructions 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.

1 similar comment
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 18, 2026

PR needs rebase.

Details

Instructions 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.

@TheRealJon
Copy link
Member Author

Duplicate of #16051

@TheRealJon TheRealJon marked this as a duplicate of #16051 Mar 18, 2026
@TheRealJon TheRealJon closed this Mar 18, 2026
@openshift-ci-robot
Copy link
Contributor

@TheRealJon: This pull request references Jira Issue OCPBUGS-78802. The bug has been updated to no longer refer to the pull request using the external bug tracker. All external bug links have been closed. The bug has been moved to the NEW state.

Details

In response to this:

Summary

Fixes regression where operators without explicit token-auth-aws: "true" annotation incorrectly show the ARN role field in the subscription form on AWS STS clusters.

Problem

Cluster Observability Operator (and similar operators) have features.operators.openshift.io/token-auth-aws: "false" but the ARN field was still showing in the subscription form on 4.21, even though it worked correctly in 4.20.

Root Cause

Regression introduced in commit a931fbd (Sep 9, 2024) during the "Fix JSON annotation parsing issue and harden related code" refactor.

Before refactor (correct opt-in behavior):

if (tokenAuthAWS === 'true' && isAWSSTSCluster(...)) {
 infrastructureFeatures.push(InfraFeatures.tokenAuth);
}

After refactor (buggy opt-out behavior):

const awsTokenAuthIsSupported =
 clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] !== 'false';

This changed the logic from opt-in to opt-out:

  • ❌ Missing annotation → defaults to supported (shows ARN field)
  • undefined !== 'false'true (shows ARN field)
  • 'false' !== 'false'false (hides ARN field)

Solution

Restore opt-in behavior by changing condition from !== 'false' to === 'true':

const awsTokenAuthIsSupported =
 clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] === 'true';

Now operators must explicitly opt-in by setting the annotation to "true" to show credential fields.

Changes

  • Fixed token auth logic for both AWS and Azure annotations in operator-hub-utils.ts
  • Updated 4 existing tests to include explicit 'true' annotations
  • Added 2 new regression tests:
  • Verifies TokenAuth excluded when annotation is "false"
  • Verifies TokenAuth excluded when annotation is missing

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

  • Fixed token authentication feature gating logic for AWS STS and Azure workload identity federation clusters to require explicit 'true' configuration values instead of accepting any non-false values.

  • Tests

  • Added test coverage validating token authentication feature behavior across different cluster configurations and annotation states.

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/olm Related to OLM jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants