Repository navigation
π fix(redact): mask URL passwords fused into the program - #4508
Merged
Merged
Conversation
An unbalanced quote in the checkout path makes tox keep the rest of an INI command line as one argument, so a later URL lands inside the program. tox shortens a program below the working directory to a relative path, and pathlib collapses the URL's scheme:// to scheme:/, which the URL rule does not match. The command echo, the per-command log and the retry warning then printed the password. Mask the program before shortening it as well. The pass after shortening stays, because it catches a secret flag that sits right after the working directory.
for more information, see https://pre-commit.ci
The flag-after-cwd case passed on the merge base: the redaction after relative_to already masked --token=hunter2. Only the URL userinfo case fails without the fix, so it is the one test kept.
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.
When the folder tox runs in has an unbalanced quote in its name (
Bob's proj, or a CI checkout named after a branch such asit's-fixed), tox keeps an INI command that starts with that folder as one argument. π tox then printed any URL password on that line in the command echo and in the.tox/<env>/logfiles, so anyone reading the CI console or the uploaded logs saw it, although the usage guide says tox masks URL user info in command displays. Once this merges, those outputs mask it too. This addresses draft advisory GHSA-rpq3-qxcr-j53q.Output before (
-) and after (+) this change:The command display shortens a program inside the working folder to a relative path, and Python's
pathlibcollapses the double slash ofpostgresql://while doing so. The URL masking from #4334 only recognizesscheme://, so it missed the shortened text. The display now masks the program before shortening it, then masks the whole command again as before, which still catches a secret flag that follows the folder path.The command echo, the per-command log, the
exit Nline and thecommands_retrywarning now mask the password, on Linux and Windows alike. The command itself still fails to start, because the unbalanced quote breaks the INI command line, and the masked URL keeps the single slash. Quoting the program intox.inior using a TOML array avoids the fused argument altogether.Reported by oss-scanner: ANT-2026-P40XQLAR.