Skip to content

Commit 538f03b

Browse files
author
Caleb
authored
Merge pull request #18 from oplik0/report-uri
2 parents 167bb90 + f55c729 commit 538f03b

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

secure/headers.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,25 @@ def report_to(self, report_to: ReportTo) -> "ContentSecurityPolicy":
339339
self._build("report-to", report_to.value)
340340
return self
341341

342+
def report_uri(self, *values: str) -> "ContentSecurityPolicy":
343+
"""Configure reporting endpoints in an older format
344+
345+
**Deprecated**
346+
This header has been deprecated in favor of report-to.
347+
However, as it is not yet supported in most browsers, it is recommended to set both headers.
348+
Browsers that support report-to will ignore report-uri if both headers are set.
349+
350+
Resouces:
351+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri
352+
353+
:param values: variable number of URIs
354+
:type values: str
355+
:return: ContentSecurityPolicy class
356+
:rtype: ContentSecurityPolicy
357+
"""
358+
self._build("report-uri", *values)
359+
return self
360+
342361
def sandbox(self, *values: str) -> "ContentSecurityPolicy":
343362
"""Enables sandbox restrictions
344363
@@ -466,7 +485,7 @@ class XXSSProtection:
466485
"""
467486
Enable browser Cross-Site Scripting filters
468487
469-
**Depreciated**
488+
**Deprecated**
470489
471490
Recommended to utilize `Content-Security-Policy`
472491
instead of the legacy `X-XSS-Protection` header.

0 commit comments

Comments
 (0)