Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@johnhout
Copy link

@johnhout johnhout commented Feb 23, 2021

Q A
Branch? main
Bug fix? yes/no
New feature? no
Deprecations? no
Tickets Ran into this issue on my own instead of adding an issue added a pull request.
License MIT

Implement a few headers for the PWA to protect the application against Clickjacking and XSS attacks based on the OWASP guidelines.

Implement a few headers for the PWA to protect the application against Clickjacking and XSS attacks.
@soyuka soyuka requested a review from dunglas February 23, 2021 13:54
# Add links to the API docs and to the Mercure Hub if not set explicitly (e.g. the PWA)
header ?Link `</docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation", </.well-known/mercure>; rel="mercure"`

# Set headers for protection against XSS, clickjacking and MIME-sniffing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this block be merged with the previous line defining the Link header?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, will update the pull request

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean can't we move ?Link </docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation", </.well-known/mercure>; rel="mercure" inside the header / { block?

@dunglas
Copy link
Member

dunglas commented Mar 16, 2021

@johnhout I updated your PR, but according to OWASP the X-XSS-Protection header is deprecated and should be replaced by a Content Security Policy, and the Referrer-Policy should be set. WDYT?

@francislavoie
Copy link
Contributor

This will need to be reorganized once #1893 is merged -- it's not correct to have ? header defaults in the same header handler as other rules.

@dunglas
Copy link
Member

dunglas commented Sep 13, 2022

We should use the Next.js config instead, so there will be set even if the user doesn't use Caddy: https://nextjs.org/docs/advanced-features/security-headers

@rvanlaak
Copy link
Contributor

rvanlaak commented Jun 8, 2025

I guess this PR was superseded by the merge of #1893 ?

@francislavoie
Copy link
Contributor

My PR did something different than this @rvanlaak it was fixing a config bug related to ? conditional header setting.

I don't think this PR is needed though, those additional "security headers" should be set in the API Platform app itself (via a middleware) as needed and not set in the web server. Those security headers are an application-layer concern, not a webserver-layer.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.