Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5e58f552
Commit
5e58f552
authored
Feb 11, 2021
by
Philip Cunningham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip trailing whitespace from validation response
Strips trailing whitespace before checking site validation.
parent
93c2848c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
ee/app/services/dast_site_validations/validate_service.rb
ee/app/services/dast_site_validations/validate_service.rb
+1
-1
ee/changelogs/unreleased/philipcunningham-strip-newlines-from-http-response-in-dast-site-valida.yml
...strip-newlines-from-http-response-in-dast-site-valida.yml
+5
-0
ee/spec/services/dast_site_validations/validate_service_spec.rb
...c/services/dast_site_validations/validate_service_spec.rb
+8
-0
No files found.
ee/app/services/dast_site_validations/validate_service.rb
View file @
5e58f552
...
...
@@ -41,7 +41,7 @@ module DastSiteValidations
case
dast_site_validation
.
validation_strategy
when
'text_file'
response
.
content_type
==
'text/plain'
&&
response
.
body
==
token
response
.
content_type
==
'text/plain'
&&
response
.
body
.
rstrip
==
token
when
'header'
response
.
headers
[
DastSiteValidation
::
HEADER
]
==
token
else
...
...
ee/changelogs/unreleased/philipcunningham-strip-newlines-from-http-response-in-dast-site-valida.yml
0 → 100644
View file @
5e58f552
---
title
:
Strip trailing whitespace from DAST site validation HTTP response body
merge_request
:
53951
author
:
type
:
changed
ee/spec/services/dast_site_validations/validate_service_spec.rb
View file @
5e58f552
...
...
@@ -129,6 +129,14 @@ RSpec.describe DastSiteValidations::ValidateService do
it_behaves_like
'a validation'
context
'when the http response body has trailing newlines after the token'
do
let
(
:token
)
{
dast_site_validation
.
dast_site_token
.
token
+
"
\n\n
"
}
it
'does not raise an exception'
do
expect
{
subject
}.
not_to
raise_error
(
DastSiteValidations
::
ValidateService
::
TokenNotFound
)
end
end
context
'when content type is incorrect'
do
let
(
:headers
)
{
{
'Content-Type'
=>
'text/html; charset=UTF-8'
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment