components/prism-puppet.js


Log

Author Commit Date CI Message
Michael Schmidt e2630d89 2021-09-26T11:52:18 ESLint: Added `regexp/sort-alternatives` rule (#3093)
Michael Schmidt 79d22182 2021-06-08T13:50:35 FIxed some cases of quadratic worst-case runtime (#2922)
Michael Schmidt e644178b 2020-12-28T18:19:11 Added test for polynomial backtracking (#2597)
Michael Schmidt c2f6a644 2020-10-25T23:42:25 Fixed multiple cases of vulnerable regexes (#2584)
Golmote 0c139d1f 2018-03-26T21:05:43 Puppet: Make heredoc, comments, regexps and strings greedy. Update known failures and tests.
Golmote cc80ccda 2018-03-13T08:15:56 Remove most of the cloning occurrences in language definitions.
Nick Fagerlund b9a9de53 2016-06-15T16:17:08 Puppet highlighter: Fix over-greedy regexp detection The `regex` token was allowing /regexps/ to start after the word `node` or after any non-word character. This ends up being too greedy! For example, take this common code, using variable interpolation in a string that represents a file path: file { "${master_config_dir}/.ssh": ensure => file, owner => 'jenkins', group => 'jenkins', mode => '0600', } The highlighter will start a regexp at `/.ssh`, in the middle of the string, and continue for however many lines it takes to reach another slash. So instead, let's be more conservative about where we might find a regexp. I suggest: - After `node`. - After one of the following characters: `~=([{,` - This catches usage in variable assignment, the `=~`/`!~` operators, function calls, case statement and selector blocks, arrays, and data type objects that accept parameters (`Pattern[/.../]`, etc.). - After `=>` (and the lesser-used `+>`) for hashes and resource attributes. - At the start of a line, for, e.g., the LHS of the `in` operator. (I'm not 100% sure we should cover this case for a simple highlighter like Prism, and it's the one I'd most expect to cause problems later, but... I think it's ok...) This commit appears to fix the worst of the mid-string blowouts.
Golmote 0b4e1d3d 2015-10-17T10:32:59 Add support for Puppet configuration