Commit 9c77918a authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Nick Thomas

Improve location fingerprint

Use colon as other parsers do
and move path to the first place
because it's the most important item
parent 55764aad
---
title: Improve DAST location fingerprints
merge_request: 10487
author:
type: changed
......@@ -46,7 +46,7 @@ module Gitlab
end
def generate_location_fingerprint(location)
Digest::SHA1.hexdigest("#{location['param']} #{location['method']} #{location['path']}")
Digest::SHA1.hexdigest("#{location['path']}:#{location['param']}:#{location['method']}")
end
end
end
......
......@@ -24,8 +24,8 @@ describe Gitlab::Ci::Parsers::Security::Dast do
end
it 'generates expected location fingerprint' do
expected1 = Digest::SHA1.hexdigest('X-Content-Type-Options GET ')
expected2 = Digest::SHA1.hexdigest('X-Content-Type-Options GET /')
expected1 = Digest::SHA1.hexdigest(':X-Content-Type-Options:GET')
expected2 = Digest::SHA1.hexdigest('/:X-Content-Type-Options:GET')
expect(report.occurrences.first[:location_fingerprint]).to eq(expected1)
expect(report.occurrences.last[:location_fingerprint]).to eq(expected2)
......
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