Skip to content
This repository was archived by the owner on Aug 3, 2020. It is now read-only.
This repository was archived by the owner on Aug 3, 2020. It is now read-only.

Remove browser sniffing #97

@EvanHahn

Description

@EvanHahn

I plan to remove browser sniffing from the next major version of helmet-csp.

Different browsers have different support for Content Security Policies. Some only support certain directives, where some have different headers (like X-Webkit-CSP). Currently, this module sniffs the browser's User-Agent to figure out what headers to set. However, I'm planning to remove this from the next major version.

My reasons:

  1. Browser sniffing has been the source of many bugs due to its complexity.
  2. Browser sniffing makes this module difficult for me to maintain confidently.
  3. Modern browsers' CSP implementations are fairly stable, and user share of old browsers is dropping. That makes browser sniffing less useful.
  4. Content Security Policies are typically used as defense-in-depth rather than the first line of defense against attacks. For example, you should probably sanitize user input and not rely on CSP.
  5. Parsing and switching on the User-Agent is slower and uses more memory.

I opened this issue to track the work, but mostly to solicit feedback. If you rely on browser sniffing and would be sad to see it go, or if you have other thoughts, let me know!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions