Skip to content

fix: backport Windows OIDC issuer URL fixes to release-1.4 - #111

Open
kdacosta0 wants to merge 2 commits into
release-1.4from
SECURESIGN-6182-windows-oidc-issuer-url-1.4
Open

kdacosta0 wants to merge 2 commits into
release-1.4from
SECURESIGN-6182-windows-oidc-issuer-url-1.4

Conversation

@kdacosta0

Copy link
Copy Markdown
Member

Backport of the Windows OIDC issuer and caller-supplied URL fixes from #110 to release-1.4.

Cherry-picked commits:

  • 8ad7cf2 fix: securesign-6182: honour a caller-supplied OIDC_ISSUER_URL on Windows
  • e2a7075 fix: securesign-6182: honour every caller-supplied URL in the Windows scripts

kdacosta0 and others added 2 commits November 9, 2026 14:23
…dows

tas-env-variables.ps1 always overwrote OIDC_ISSUER_URL with a value derived
from the cluster, even when the caller had already set one.

The derived value guesses the Keycloak realm path, and that guess only holds
for RHBK, which serves under /realms; legacy RH-SSO serves under
/auth/realms. A caller that knows its own issuer URL had it discarded on
Windows while tas-env-variables.sh honoured it everywhere else, so Windows
runs failed to authenticate for a reason unrelated to the test.

Guard the derivation the same way the shell script already does, and read
the route host from .status.ingress[0].host to match it. .spec.host is the
requested hostname and is empty when the route lets OpenShift generate one;
the status field always carries the admitted host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 8ad7cf2)
… scripts

Guarding OIDC_ISSUER_URL alone fixed one of five instances of the same bug,
and only in one of the two Windows scripts.

tas-env-variables.sh derives a value from `oc` only when the variable is
unset, for all six variables. Both Windows scripts unconditionally
overwrote TUF_URL, FULCIO_URL, REKOR_URL and REKOR_UI_URL. This matters
because e2e.yml exports exactly those four from kubectl and then sources the
env script: on Linux they survive, on Windows they were discarded and
re-derived from a cluster that may answer differently.

Guard all six in both scripts, and switch the .bat route lookup to
.status.ingress[0].host to match.

The .bat needs the flat goto form for OIDC_ISSUER_URL rather than a
parenthesised if: cmd expands %OIDC_ROUTE% when it parses the block, so
composing the URL inside one would read it before the for loop had set it.
The single-step lookups are safe on one line because `set X=%%i` takes the
for variable rather than an expanded %VAR%.

Neither script can be executed on macOS, so this is reviewed, not run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit e2a7075)
@qodo-for-securesign

Copy link
Copy Markdown

PR Summary by Qodo

Backport Windows OIDC issuer and URL override fixes to release-1.4

🐞 Bug fix 🕐 10-20 Minutes

Grey Divider

AI Description

• Preserve caller-supplied service URLs in both Windows environment scripts, matching the shell
 script.
• Derive the OIDC issuer from the admitted OpenShift route host only when no issuer is supplied.
Diagram

graph TD
  Caller["Caller environment"] --> Scripts["Windows scripts"] --> Check{"URL supplied?"}
  Check -->|No| OC["OpenShift lookup"] --> Exports["Session variables"] --> Tools["Signing tools"]
  Check -->|Yes| Exports
Loading
High-Level Assessment

Keep the conditional lookups in the existing Windows scripts. This matches the shell script's established behavior without introducing a new cross-platform dependency.

Files changed (2) +52 / -11

Bug fix (2) +52 / -11
tas-env-variables.batPreserve supplied URLs in Windows batch setup +12/-5

Preserve supplied URLs in Windows batch setup

• Queries OpenShift only for missing TUF, OIDC issuer, Fulcio, Rekor, and Rekor UI URLs. Derives the default issuer from the route's admitted host instead of its requested host.

tas-env-variables.bat

tas-env-variables.ps1Preserve supplied URLs in PowerShell setup +40/-6

Preserve supplied URLs in PowerShell setup

• Uses caller-supplied URLs when present and queries OpenShift for missing values. Derives the default OIDC issuer from the admitted route host while allowing callers to supply an issuer with a different realm path.

tas-env-variables.ps1

@qodo-for-securesign

Copy link
Copy Markdown

Code Review by Qodo


Action required

1. Caller URLs can run Windows commands 🐞 Bug
Description
The new guards in tas-env-variables.bat preserve inherited URLs, which are later expanded into
unquoted set and echo commands. If a caller supplies a URL such as https://host/?x=1&whoami,
Command Prompt treats &whoami as another command, while the derived environment values are
truncated.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new batch guards let caller-supplied URLs containing command metacharacters reach downstream command lines, where they can execute commands and corrupt derived values.

## Fix Focus Areas
- tas-env-variables.bat[7-16]
- tas-env-variables.bat[21-41]

## Recommended Fix
Check whether variables are defined without interpolating their contents into `if` expressions. Copy and display inherited values without letting Command Prompt parse their contents as command syntax; cover both the derived assignments and diagnostic output, including URLs containing `&` and quotes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


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.

1 participant