Skip to content

fix(pytorch_xdit): stop leaking the HF token from the WAN benchmark - #323

Open
speriaswamy-amd wants to merge 1 commit into
speriaswamy/xdit-09-run-timeout-and-artifactsfrom
speriaswamy/xdit-10-token-redaction
Open

fix(pytorch_xdit): stop leaking the HF token from the WAN benchmark#323
speriaswamy-amd wants to merge 1 commit into
speriaswamy/xdit-09-run-timeout-and-artifactsfrom
speriaswamy/xdit-10-token-redaction

Conversation

@speriaswamy-amd

Copy link
Copy Markdown
Contributor

Part 10 of 12 in a stack that replaces #184. Base: #322.

Why

Two ways the HF token could reach a log or a test report from the WAN module. Both are already handled in the FLUX module; this brings WAN in line.

What changed

_redact_secrets was a no-op. The pattern was r"(HF_TOKEN=)\\S+" — inside a raw string that is a literal backslash followed by S, not the \S character class. It never matched, so every logged docker command carried the token in clear text. Corrected to r"(HF_TOKEN=)\S+" (FLUX uses the equivalent [^\s]+).

The hf_token fixture returned a bare str. Pytest includes fixture values in failure reports, so any failure in a test taking hf_token printed the token. It now returns _SecretValue, the wrapper FLUX already defines: truthy, stringifies to the token for command assembly, but its repr is <redacted>. Call sites unchanged.

Two ways the token could reach a log or report, both already handled in the
FLUX module and missing here.

_redact_secrets was a no-op. The pattern was r"(HF_TOKEN=)\\S+" — inside a raw
string that is a literal backslash followed by "S", not the \S character class,
so it never matched and every logged docker command carried the token in clear
text. Corrected to r"(HF_TOKEN=)\S+" (FLUX uses the equivalent [^\s]+).

The hf_token fixture returned a bare str. Pytest includes fixture values in
failure reports, so any failure in a test taking hf_token printed the token.
The fixture now returns _SecretValue, the wrapper the FLUX module already
defines: it is truthy and stringifies to the token for command assembly, but
its repr is "<redacted>". Call sites are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
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