Skip to content
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

HTTP Header X-XSS-Protection does not match #760

Open
seffparker opened this issue May 13, 2022 · 2 comments
Open

HTTP Header X-XSS-Protection does not match #760

seffparker opened this issue May 13, 2022 · 2 comments

Comments

@seffparker
Copy link

seffparker commented May 13, 2022

Describe the bug
The HTTP header X-XSS-Protection which present does not match, and we have to either match the string X-Xss-Protection or use case-insensitive regex pattern like "/(?i:X-XSS-Protection: 1;mode=block)/"

How To Reproduce
Apache conf:

  Header set X-XSS-Protection 1;mode=block

HTTP headers:

# curl -I localhost/index
HTTP/1.1 200 OK
Date: Fri, 13 May 2022 10:48:01 GMT
Server: Apache/2.4.41 (Ubuntu)
X-Powered-By: PHP/7.4.29
X-Content-Type-Options: nosniff
Content-Security-Policy: frame-ancestors 'self'
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Origin
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1;mode=block
Content-Type: application/json

Test rule:

http:
  http://localhost:{{ .Vars.http_port }}/index:
    status: 200
    timeout: 2000
    #method: GET
    headers:
    - "X-XSS-Protection: 1;mode=block"

Expected Behavior
Test passed.

Actual Behavior

.F..

Failures/Skipped:

HTTP: http://localhost:80/index: Headers: patterns not found: [X-XSS-Protection: 1;mode=block]

Total Duration: 0.044s
Count: 4, Failed: 1, Skipped: 0

Environment:

  • goss v0.3.16
  • Ubuntu 20
@ekelali
Copy link
Collaborator

ekelali commented Sep 6, 2022

Since http headers are case insentive, would it be more clear if Goss just lowercased it?

The yaml test file would have to be lowercase, but the challenge of guessing how Go mutates the headers would be gone.

@aelsabbahy aelsabbahy mentioned this issue Jun 25, 2023
3 tasks
@aelsabbahy aelsabbahy reopened this Jul 19, 2023
@aelsabbahy
Copy link
Member

Leaving this open. Making everything lowercase does fix the issue to some degree, but it is a breaking change for all existing users.

The challenge is go mutates the headers. I wonder if there's a way to skip that.. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants