Commit 6f880114 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu Committed by GitLab Release Tools Bot

Prevent quick actions regex from backtracking

parent 08c95ed3
......@@ -29,9 +29,7 @@ module Gitlab
# Anything, including `/cmd arg` which are ignored by this filter
# `
`\n*
.+?
\n*`
`.+?`
)
}mix.freeze
......
......@@ -352,6 +352,14 @@ RSpec.describe Gitlab::QuickActions::Extractor do
expect(commands).to eq(expected_commands)
expect(msg).to eq expected_msg
end
it 'fails fast for strings with many newlines' do
msg = '`' + "\n" * 100_000
expect do
Timeout.timeout(3.seconds) { extractor.extract_commands(msg) }
end.not_to raise_error
end
end
describe '#redact_commands' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment