question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I got this when validating my HTML. Time to add the report-to directive?

Warning: Content-Security-Policy HTTP header: Bad content security policy: A draft of the next version of CSP deprecates report-uri in favour of a new report-to directive.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
EvanHahncommented, Apr 7, 2021

@mjaggard helmet@4 and helmet-csp@3 added support for all directives by accepting any keys you provide.

You can use report-to with Helmet like this:

app.use(
  helmet({
    contentSecurityPolicy: {
      directives: {
        defaultSrc: ["'self'"],
        reportTo: ["foo"],
      },
    },
  })
);

Or if you prefer to use the CSP middleware by itself:

app.use(
  helmet.contentSecurityPolicy({
    directives: {
      defaultSrc: ["'self'"],
      reportTo: ["foo"],
    },
  })
);

Hope this answers your question.

0reactions
mjaggardcommented, Apr 7, 2021

@EvanHahn I can see https://github.com/helmetjs/csp/commit/b2d9fdf50a5ca63de8631c8b46f1ea0500bd74ba was merged into csp to solve this issue, but I can’t see any equivalent code in the helmet code base. Did this get missed or was it not included on purpose?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Report to Definition & Meaning - Merriam-Webster
: to be in a position directly below (someone, who is in charge of reviewing one's work, etc.) She reports to the president...
Read more >
REPORT TO (phrasal verb) definition and synonyms
Definition of REPORT TO (phrasal verb): have person as your manager.
Read more >
Meaning of report to someone in English - Cambridge Dictionary
Someone you report to at work is the person in authority over you who gives you tasks and checks that you do them:...
Read more >
report to somebody - Longman Dictionary
report to somebody meaning, definition, what is report to somebody: to be responsible to someone at work and...: Learn more.
Read more >
CSP: report-to - HTTP - MDN Web Docs
The Content-Security-Policy Report-To HTTP response header field instructs the user agent to store reporting endpoints for an origin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found