fix(pytorch_xdit): stop leaking the HF token from the WAN benchmark - #323
Open
speriaswamy-amd wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_secretswas a no-op. The pattern wasr"(HF_TOKEN=)\\S+"— inside a raw string that is a literal backslash followed byS, not the\Scharacter class. It never matched, so every logged docker command carried the token in clear text. Corrected tor"(HF_TOKEN=)\S+"(FLUX uses the equivalent[^\s]+).The
hf_tokenfixture returned a barestr. Pytest includes fixture values in failure reports, so any failure in a test takinghf_tokenprinted the token. It now returns_SecretValue, the wrapper FLUX already defines: truthy, stringifies to the token for command assembly, but itsrepris<redacted>. Call sites unchanged.