fix: sanitize all invalid characters in checksum filenames#2886
Open
s3onghyun wants to merge 1 commit into
Open
fix: sanitize all invalid characters in checksum filenames#2886s3onghyun wants to merge 1 commit into
s3onghyun wants to merge 1 commit into
Conversation
normalizeFilename used the regexp [^A-z0-9], but A-z is the ASCII range 65-122, which includes the six characters [ \ ] ^ _ ` between Z and a. Those were left unsanitized in the on-disk checksum/timestamp filename, so a task name containing e.g. a backslash could corrupt the file path and break up-to-date detection. Use [^A-Za-z0-9] as intended.
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.
Description
normalizeFilename(ininternal/fingerprint) turns a task name into the on-disk checksum/timestamp filename, replacing invalid characters with-. It uses:A-zis the classic range bug: it spans ASCII 65 (A) to 122 (z), which includes the six characters betweenZanda—[ \\ ] ^ _ \``. Those are not sanitized. The intent (per the comment) was clearly[A-Za-z0-9]`.Concrete impact: a task name containing one of these characters (notably
\\, a path separator on Windows) leaks into the checksum/timestamp file path, which can corrupt the file location and breaksources:/generates:up-to-date detection for that task.Fix
[^A-z0-9]→[^A-Za-z0-9].Test
Extended
TestNormalizeFilenamewith cases for the leaked characters (\\,_,[,],^, ```). Fails before, passes after.Note: for any existing task whose name contains one of these characters, the normalized filename changes once, so the first run after upgrade recomputes the checksum (treated as not-up-to-date) — expected and harmless.