Repository navigation
Conversation
…ame, not a credential #1292 Signed-off-by: Nik Cubrilovic <[email protected]>
…wer-case run; pin bounds #1292 Signed-off-by: Nik Cubrilovic <[email protected]>
…uppressed; trade-off stated #1292 Signed-off-by: Nik Cubrilovic <[email protected]>
Merged
Contributor
Author
|
Landed in v0.0.159 as nik |
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.
Refs #1292 (the last open class: "a RequireJS path (
/js/) ... produces no item"; the issue's amended note saysMagento_Customer/js/change-email-passwordis still to be dropped).A value that is an AMD / RequireJS module path was reported as a generic secret under a
password,secret,tokenorapiKeykey: the older rooted-path rule only reads lower-case segments, soMagento_Customer/js/change-email-password(capitals, no leading slash) fell through. A new narrow rule,isModulePath, drops it:/, at most 128 characters, optionally behind a loader-plugin prefix (text!);-,_or.(camelCase parts and plurals included), each word from a list of module-path words (model,customer,password,template, ...), with at most two digits and three capitals after the first letter; a word outside the list makes the value report (the first version accepted any lower-case run, which letMagento_Customer/<30 random lower-case letters>through);Vendor_Modulehead (two CamelCase names of lower-case words, no digits) or ajssegment.Fuzz: random values with
/still reportisModulePathon random values, 300,000 per shape, seeded:Magento_Customer/<8-40 lower-case>0;<3 letters>/js/<8-40 lower-case>0; lower-case 8-40 with one to three slashes 0; URL-safe 24-64 with slashes 0;Magento_Customer/<3-7 lower-case>68 (227 per million; short tails that are a listed word such asapporapi). Before this change (any lower-case run was a segment) the lower-case head-plus-tail shapes passed 20,000 of 20,000 and a lower-case value with an exactjssegment 158 per million. The test pins 0 of 100,000 lower-case values and 0 of 2,000 each of the head-plus-tail shapes, and 0 of 20,000 mixed-alphabet values. Reported rate underpassword:is unchanged by this PR for values it does not drop.Only paths whose words are all in the module-path word list are suppressed; a path with an unlisted word reports as before. In a review sample of 30 real-looking Magento paths, 19 still reported for that reason. Trade-off: a passphrase made only of listed words in this shape can be suppressed. Measured cost in review: dense module-path input 10 to 40% slower; an 8 MB hostile dense-random-slash input 1.3 s to 3.3 s, RSS unchanged, below the 5 MB page cap in real runs.
The real paths in the test still drop:
Magento_Ui/js/form/element/abstract,Magento_Customer/js/change-email-password,text!Magento_Ui/templates/form/element/input,js/lib/secret-keeper, and the other six in the test.Tests
leaked-secrets-module-path-1292.test.ts: eleven module paths under four key names are not reported; a digit run, a long segment, a run of capitals, one segment, a module head with a drawn tail, and an over-long path are not module paths; the fuzzes above, a word outside the list, a fourth word, plurals, and exact bounds (digits 2/3, capitals 3/5, segment 32, path 128, thejs/head rule). Docs list the rule and its bounds.Skill change: none.
Mutants killed: digit bound (0, 3, 100), capitals bound 3 to 5,
jsrule removed or always true, words per segment 3 to 4, plural rule, segment and path length bounds.