Skip to content

fix: securesign-6182: honour caller-supplied URLs in the Windows env scripts [release-1.5] - #110

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

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

Conversation

@kdacosta0

@kdacosta0 kdacosta0 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Jira: SECURESIGN-6182

Backport of #109 to release-1.5. Extracted from #103, where it was unrelated baggage — that PR is about which CLI binaries get downloaded, this is about environment bootstrap on Windows.

The bug

tas-env-variables.sh derives a value from oc only when the variable is unset, for all six variables it manages. Both Windows scripts ignored what the caller had already set and unconditionally overwrote it.

This is not cosmetic. .github/workflows/e2e.yml exports TUF_URL, REKOR_URL, FULCIO_URL and REKOR_UI_URL from kubectl and then sources the env script. On Linux those survive; on Windows all four were discarded and re-derived from a cluster that may answer differently — or not at all.

For OIDC_ISSUER_URL the overwrite was worse than losing a value: the derived URL guesses the Keycloak realm path, and that guess only holds for RHBK, which serves under /realms. Legacy RH-SSO serves under /auth/realms, so a caller that knew its own issuer URL had it silently replaced with a wrong one.

Parity after this PR

Variable .sh .ps1 .bat
OIDC_ISSUER_URL guarded fixed fixed
OIDC_CLIENT_ID guarded already guarded already guarded
TUF_URL guarded fixed fixed
FULCIO_URL guarded fixed fixed
REKOR_URL guarded fixed fixed
REKOR_UI_URL guarded fixed fixed

No Go code touched. Merge #109 first.

🤖 Generated with Claude Code

@kdacosta0 kdacosta0 changed the title fix: securesign-6182: honour a caller-supplied OIDC_ISSUER_URL on Windows [release-1.5] fix: securesign-6182: honour caller-supplied URLs in the Windows env scripts [release-1.5] Nov 3, 2026
@kdacosta0
kdacosta0 marked this pull request as ready for review November 6, 2026 12:25
@kdacosta0
kdacosta0 marked this pull request as draft November 6, 2026 12:26
@qodo-for-securesign

qodo-for-securesign Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Preserve caller-supplied URLs in Windows environment scripts

🐞 Bug fix 🕐 20-40 Minutes

Grey Divider

AI Description

• Preserve caller-supplied service and OIDC URLs instead of overwriting them with cluster-derived
 values.
• Use the admitted Keycloak route host when an OIDC issuer URL must be derived.
Diagram

graph TD
  A["Caller environment"] --> B["Windows scripts"] --> C{"URL supplied?"} -- "Yes" --> F["Resolved URLs"] --> G["Sigstore exports"]
  C -- "No" --> D["OpenShift lookups"] --> F
  D --> E["Admitted route host"] --> F
Loading
High-Level Assessment

Guarding lookups in each existing Windows script matches the shell script without adding a shared bootstrap dependency. Unconditional cluster resolution was the source of the bug, while a cross-shell rewrite would add scope without improving this fix.

Files changed (2) +52 / -11

Bug fix (2) +52 / -11
tas-env-variables.batGuard batch URL lookups and use the admitted Keycloak host +12/-5

Guard batch URL lookups and use the admitted Keycloak host

• Preserves caller-supplied TUF, Fulcio, Rekor, Rekor UI, and OIDC issuer URLs. When the issuer is absent, derives it from the route's admitted host; a flat goto avoids premature cmd.exe variable expansion.

tas-env-variables.bat

tas-env-variables.ps1Preserve PowerShell URL overrides during environment bootstrap +40/-6

Preserve PowerShell URL overrides during environment bootstrap

• Uses existing environment values for five URLs and queries oc only for missing ones. Derives a missing OIDC issuer URL from the admitted Keycloak route host rather than the requested host.

tas-env-variables.ps1

@qodo-for-securesign

qodo-for-securesign Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Code Review by Qodo


View medium (1)
Remediation recommended
1. URL query strings corrupt Windows setup 🐞 Bug
Description
The new TUF_URL and REKOR_URL guards retain caller-supplied values that are later expanded into
unquoted set commands. When either URL contains a valid query-string &, Command Prompt treats
the remainder as another command, truncating the derived environment variable and potentially
executing that remainder.
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 batch file now preserves caller URLs, but later percent-expands them in unquoted commands; a URL containing `&` truncates derived variables and runs the remainder as a command.

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

## Recommended Fix
Make every command that uses a caller-supplied URL safe from Command Prompt metacharacter parsing, including derived `set` assignments and diagnostic output. Use safe expansion and quoting throughout, while retaining the variables in the caller's environment after the batch file returns; test with a URL containing `&`.

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

Dismiss ↗ | View ↗


kdacosta0 and others added 2 commits November 9, 2026 13:28
…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>
… 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>
@kdacosta0
kdacosta0 force-pushed the SECURESIGN-6182-windows-oidc-issuer-url-1.5 branch from 6cc7e42 to e2a7075 Compare November 9, 2026 12:29
@kdacosta0
kdacosta0 marked this pull request as ready for review November 9, 2026 12:50
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