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

'Unknown Content-type' when logging CSP violations in Firefox 62 #10202

Open
1 of 3 tasks
ukch opened this issue Oct 19, 2018 · 3 comments
Open
1 of 3 tasks

'Unknown Content-type' when logging CSP violations in Firefox 62 #10202

ukch opened this issue Oct 19, 2018 · 3 comments

Comments

@ukch
Copy link

ukch commented Oct 19, 2018

Important Details

How are you running Sentry?

  • On-Premise docker [Version xyz]
  • Saas (sentry.io)
  • Other [briefly describe your environment]

Description

I am setting up a CSP for my site and attempting to log violations to Sentry, but I have noticed that requests from my browser (Firefox) are returning status 400 and are not being logged to Sentry.

My CSP header looks like the following:

default-src 'self';
base-uri 'none';
form-action 'none';
frame-ancestors 'none';
report-uri https://sentry.io/api/{ID}/security/?sentry_key={KEY};

Firefox is trying to log violations by using 'fetch' to post JSON to the endpoint, but is receiving the following response:

{
    "error": "Invalid Content-Type"
}

It looks as if Firefox is not specifying the Content-Type header for the request, but is sending valid JSON.

Possible Solution

Perhaps Sentry could make a reasonable guess as to the request's content type if the Content-Type header is not speficied?

@reedloden
Copy link
Contributor

I wouldn't be surprised if this is due to the lack of effective-directive, which leads to Sentry just dropping all CSP reports from Firefox.

See also https://bugzilla.mozilla.org/show_bug.cgi?id=1192684.

@BYK
Copy link
Member

BYK commented Oct 21, 2020

I guess this is here to stay based on that bugzilla ticket.

@BYK
Copy link
Member

BYK commented Oct 21, 2020

@dcramer @mitsuhiko do we want to invest into this?

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

5 participants