Repository navigation
fix: refuse an empty signing key for the size signatures (#53) - #59
Merged
Merged
Conversation
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.
Closes #53.
The signing key reaches
SizedFileNameas a closure (wp_salt('pollora/media')standalone,app.keywith the framework) and was never checked: an empty key gave an HMAC anyone can compute (an attacker could only trigger the generation of the declared sizes, bounded by the lock and the pixel/byte ceilings).signature()andfor()now throwInvalidMediaConfigurationException::emptySigningKey()for an empty or blank key; the message says to setAPP_KEYor the WordPress salts. The key is still resolved when signing, so a late key works. Names and signatures with a valid key are unchanged.The 12-hex truncation (48 bits) is kept: an online search of 2^48 is unrealistic and a longer signature would break the file names already issued.
A fallback route hit with an empty key now answers 500 instead of accepting a weak signature.
Checked: full suite (612) on five seeds, the new test fails without the fix, Pint, PHPStan, Rector dry-run on src. WordPress integration suite and coverage not run locally.