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

The URL for sending CSP reports doesn't work #613

Closed
niekberenschot opened this issue Aug 2, 2020 · 7 comments
Closed

The URL for sending CSP reports doesn't work #613

niekberenschot opened this issue Aug 2, 2020 · 7 comments

Comments

@niekberenschot
Copy link

niekberenschot commented Aug 2, 2020

When trying the DSN url it will result in a 404 error:
Line from nginx log:
"POST /api/8/security/?sentry_key= HTTP/1.0" 404 22 "-"

All the other urls for example 'csp' instead of 'security' will result in a 403.
Line from web log:
[WARNING] django.security.csrf: Forbidden (CSRF cookie not set.): /api/8/csp/ (status_code=403 request=<WSGIRequest: POST u'/api/8/csp/?sentry_key='>)

I don't know why the CSP end-point isn't found.
For the other url's i think the expected status code should be a 404.

@BYK
Copy link
Collaborator

BYK commented Aug 3, 2020

You need to use Relay for these end points now. See #598 and #590.

@BYK BYK closed this as completed Aug 3, 2020
@niekberenschot
Copy link
Author

I'm using the relay. I just used the install.sh file and enabled SSL.

I get the following errors in the relay log:

2020-08-10T08:29:32Z [rdkafka::client] ERROR: librdkafka: Global error: BrokerTransportFailure (Local: Broker transport failure): kafka:9092/bootstrap: Connect to ipv4#172.18.0.10:9092 failed: Connection refused (after 25ms in state CONNECT)
2020-08-10T08:29:33Z [rdkafka::client] ERROR: librdkafka: Global error: AllBrokersDown (Local: All broker connections are down): 1/1 brokers are down
2020-08-10T08:29:33Z [rdkafka::client] ERROR: librdkafka: Global error: BrokerTransportFailure (Local: Broker transport failure): kafka:9092/bootstrap: Connect to ipv4#172.18.0.10:9092 failed: Connection refused (after 0ms in state CONNECT)
2020-08-10T08:29:33Z [rdkafka::client] ERROR: librdkafka: Global error: AllBrokersDown (Local: All broker connections are down): 1/1 brokers are down
2020-08-10T08:29:33Z [relay_server::actors::upstream] ERROR: authentication encountered error: could not send request to upstream
  caused by: Failed to connect to host: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
  caused by: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
  caused by: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
2020-08-10T08:29:33Z [relay_server::actors::upstream] ERROR: authentication encountered error: could not send request to upstream
  caused by: Failed to connect to host: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
  caused by: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
  caused by: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
2020-08-10T08:29:34Z [relay_server::actors::upstream] ERROR: authentication encountered error: could not send request to upstream
  caused by: Failed to connect to host: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
  caused by: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
  caused by: Failed resolving hostname: no record found for name: web.google.internal. type: AAAA class: IN
2020-08-10T08:29:38Z [relay_server::actors::upstream] ERROR: authentication encountered error: could not send request to upstream
  caused by: Timeout while waiting for response
2020-08-10T08:29:41Z [relay_server::actors::upstream] ERROR: authentication encountered error: could not send request to upstream
  caused by: Failed to connect to host: Connection refused (os error 111)
  caused by: Connection refused (os error 111)
  caused by: Connection refused (os error 111)
2020-08-10T08:29:44Z [relay_server::actors::upstream] ERROR: authentication encountered error: could not send request to upstream
  caused by: Failed to connect to host: Connection refused (os error 111)
  caused by: Connection refused (os error 111)
  caused by: Connection refused (os error 111)

@niekberenschot
Copy link
Author

Additionally the minidump url works...

@BYK
Copy link
Collaborator

BYK commented Aug 11, 2020

I'm using the relay. I just used the install.sh file and enabled SSL.

The logs you shared suggest otherwise. The 404 and 403 errors and the UWSGIHandler suggest that those requests are going to sentry-web instead of relay. I'd check your Nginx config to make sure you have the correct routing (if you are using our repo without modification, this is done already).

Your relay logs suggest your relay instance cannot reach sentry-web or kafka. The kafka issue seems like a network routing issue but the sentry-web one seems like a DNS issue, at least to begin with.

@niekberenschot
Copy link
Author

Just tried a fresh install from master. The errors above only appear when installing for the first time. Everything seems to be running fine.

However, the security endpoint still results in a 404.

@BYK
Copy link
Collaborator

BYK commented Aug 17, 2020

However, the security endpoint still results in a 404.

@niekberenschot - our friends (@jan-auer) from the Relay team just informed me that the URL should be /api/8/csp-report/?sentry_key=<redacted> not /api/8/security/.

Okay that was some confusion between us. Can you just make sure that request is hitting Relay and not Sentry Web?

@jan-auer
Copy link
Member

@niekberenschot where did you get these URLs from? The "Client Keys" settings page should render the correct "Security Header Endpoint", which points to /api/8/security/. This endpoint is served by Relay as long as you satisfy the content-type requirement, which must be one of these.

Are you manually creating a CSP request or is your browser issuing one?

@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants