Skip to content

CodeQL - Limit polynomial regex to only match 1000 characters at most #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/octocatalog-diff/catalog-util/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def setup
facts_terminus = @options.fetch(:facts_terminus, 'yaml')
if facts_terminus == 'yaml'
cmdline << "--factpath=#{Shellwords.escape(File.join(@compilation_dir, 'var', 'yaml', 'facts'))}"
if @options[:fact_file].is_a?(String) && @options[:fact_file] =~ /.*\.(\w+)$/
if @options[:fact_file].is_a?(String) && @options[:fact_file] =~ /.*{1,1000}\.(\w+)$/
fact_file = File.join(@compilation_dir, 'var', 'yaml', 'facts', "#{@node}.#{Regexp.last_match(1)}")
FileUtils.cp @options[:fact_file], fact_file unless File.file?(fact_file) || @options[:fact_file] == fact_file
end
Expand Down
4 changes: 2 additions & 2 deletions spec/octocatalog-diff/tests/util/parallel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ def two(arg, _logger = nil)
expect(two_result.exception).to eq(nil)
expect(two_result.output).to match(/^two def \d+$/)

one_time = Regexp.last_match(1).to_i if one_result.output =~ /(\d+)$/
two_time = Regexp.last_match(1).to_i if two_result.output =~ /(\d+)$/
one_time = Regexp.last_match(1).to_i if one_result.output =~ /(\d+{1,1000})$/
two_time = Regexp.last_match(1).to_i if two_result.output =~ /(\d+{1,1000})$/
expect(one_time).to be < two_time
end

Expand Down