Commit Graph
170 Commits
Author SHA1 Message Date
Sylvestre Ledru 3fa0dd955d Bug 2036402 - Apply std::move in dom/security where values can be moved instead of copied r=tschuster
Differential Revision: https://phabricator.services.mozilla.com/D298101
2026-05-28 12:52:59 +00:00
serge-sans-paille 115d971353 Bug 2025273 - Activate modernize-loop-convert clang-tidy check r=media-playback-reviewers,webrtc-reviewers,profiler-reviewers,firefox-svg-reviewers,canaltinova,longsonr,mjf,alwu
This is mostly the result of running ./mach static-analysis check --fix
with the new linter activated, with the following caveats:

- use std::fill when it makes sense
- use appropriate names for the loop target variable
- fix constness
- use array default initialization instead of an explicit loop when it
  makes sense

Differential Revision: https://phabricator.services.mozilla.com/D289172
2026-03-26 12:27:13 +00:00
Sylvestre Ledru 9eb1a31a98 Bug 2023419 - Remove Emacs/Vim modelines from dom/ r=emilio,media-playback-reviewers,webidl,padenot
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287843
2026-03-16 21:02:32 +00:00
Malte Jürgens 8fa4f67d09 Bug 2004710 - Check that SRI hash is in base64 format r=tschuster
Differential Revision: https://phabricator.services.mozilla.com/D276183
2026-01-19 18:05:43 +00:00
Cristina Horotan 686314543e Revert "Bug 2004710 - Check that SRI hash is in base64 format r=tschuster" for causing wpt failures on preload/modulepreload.html
This reverts commit 57c3d08ee2.
2025-12-17 20:18:54 +00:00
Malte Jürgens 57c3d08ee2 Bug 2004710 - Check that SRI hash is in base64 format r=tschuster
Differential Revision: https://phabricator.services.mozilla.com/D276183
2025-12-17 15:38:57 +00:00
agoloman 97f2a0770e Revert "Bug 2004710 - Check that SRI hash is in base64 format r=tschuster" for causing mochitest failures @test_bug_1364262.html.
This reverts commit 5462742b3e.
2025-12-12 14:03:15 +00:00
Malte Jürgens 5462742b3e Bug 2004710 - Check that SRI hash is in base64 format r=tschuster
Differential Revision: https://phabricator.services.mozilla.com/D276183
2025-12-12 13:27:48 +00:00
serge-sans-paille f61f1d17c2 Bug 1996566 - Remove unused mfbt inclusion in dom/** r=emilio,media-playback-reviewers,dom-storage-reviewers,dom-worker-reviewers,jari,alwu,asuth
Differential Revision: https://phabricator.services.mozilla.com/D270172
2025-10-28 07:24:25 +00:00
serge-sans-paille 1667ec582b Bug 1995723 - Remove unused inclusion of mozilla/ArrayUtils.h r=necko-reviewers,application-update-reviewers,media-playback-reviewers,profiler-reviewers,win-reviewers,firefox-svg-reviewers,layout-reviewers,gstoll,canaltinova,bytesized,alwu,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D269573
2025-10-23 07:30:37 +00:00
Frédéric Wang c2bd2d00ec Bug 1940493 - Implement trusted-types-eval CSP script-src keyword. r=smaug
See https://github.com/w3c/webappsec-csp/pull/665

Differential Revision: https://phabricator.services.mozilla.com/D263352
2025-09-03 08:52:34 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Tom Schuster ac6d38cc6a Bug 1978062 - Remove individual security.mixed_content.upgrade_display_content prefs. r=freddyb,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D257853
2025-07-25 09:08:50 +00:00
Arul Thileeban Sagayam 4605c4ed1b Bug 1891465 - Ignore CSP directives with invalid bytes -r=freddy
Differential Revision: https://phabricator.services.mozilla.com/D228537
2025-06-25 15:40:46 +00:00
Tom Schuster a5e6ce2f4e Bug 1958232 - Allow eval in browser.xhtml and other priviliged contexts with a special pref. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D244306
2025-04-11 14:46:11 +00:00
Frédéric Wang d43f61b1ae Bug 1935434 Implement forgiving parsing for trusted-types CSP directive. r=smaug
Currently, we just discard the whole directive if an invalid token is
found. With this patch, we instead ignore such a token. Also improves
tests in should-trusted-type-policy-creation-be-blocked-by-csp-002.html
so that we really check that the original trusted-types directive is
preserved after serialization.

See https://github.com/w3c/webappsec-csp/pull/363#issuecomment-2160193577

Differential Revision: https://phabricator.services.mozilla.com/D243358
2025-03-31 05:09:13 +00:00
Cristina Horotan 19a336e9b4 Backed out changeset d53513a85e73 (bug 1935434) for causing GTest failures. CLOSED TREE 2025-03-30 10:49:21 +03:00
Frédéric Wang 58be4c8231 Bug 1935434 Implement forgiving parsing for trusted-types CSP directive. r=smaug
Currently, we just discard the whole directive if an invalid token is
found. With this patch, we instead ignore such a token. Also improves
tests in should-trusted-type-policy-creation-be-blocked-by-csp-002.html
so that we really check that the original trusted-types directive is
preserved after serialization.

See https://github.com/w3c/webappsec-csp/pull/363#issuecomment-2160193577

Differential Revision: https://phabricator.services.mozilla.com/D243358
2025-03-30 06:51:41 +00:00
Cristina Horotan 8054b349e8 Backed out changeset 3a01a7335e0b (bug 1935434) for causing GTest failures at CSPParser.BadPolicies. CLOSED TREE 2025-03-28 20:53:54 +02:00
Frédéric Wang 74c4beb1fa Bug 1956731 - Implement forgiving parsing for require-trusted-types-for directive. r=smaug
Currently, we only accepts require-trusted-types-for directive with
exactly one trusted-types-sink-group-keyword equals to "'script'".
Instead accept more than one trusted-types-sink-group-keyword and
maybe-not-quoted values other than "'script'", discarding the
directive if it does not contain any "'script'" value. This aligns with
the behavior of other browsers and make more tests pass.

Test changes:
- fix the "'script''script'" tests to match its description.
- add tests to check we also accept unquoted values.

See https://github.com/w3c/trusted-types/issues/580

Differential Revision: https://phabricator.services.mozilla.com/D243259
2025-03-28 12:26:20 +00:00
Frédéric Wang b35c2cb921 Bug 1935434 Implement forgiving parsing for trusted-types CSP directive. r=smaug
Currently, we just discard the whole directive if an invalid token is
found. With this patch, we instead ignore such a token. Also improves
tests in should-trusted-type-policy-creation-be-blocked-by-csp-002.html
so that we really check that the original trusted-types directive is
preserved after serialization.

See https://github.com/w3c/webappsec-csp/pull/363#issuecomment-2160193577

Differential Revision: https://phabricator.services.mozilla.com/D243358
2025-03-28 12:15:24 +00:00
Tom Schuster 511a471a97 Bug 1953853 - Suppress a warning that the browser.xhtml CSP is missing a report-uri. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D241948
2025-03-19 08:01:50 +00:00
Alexandru Marc b162f9d1c4 Backed out changeset 990f1f65ddcb (bug 1891465) for causing wpt failures @ invalid-bytes.html CLOSED TREE 2025-02-10 15:24:47 +02:00
Arul Thileeban Sagayam c5bd05c0d6 Bug 1891465 - Ignore CSP directives with invalid bytes -r=freddy
Differential Revision: https://phabricator.services.mozilla.com/D228537
2025-02-10 11:50:53 +00:00
Norisz Fay 7b47fe20b8 Backed out changeset 87689f65dc65 (bug 1891465) for causing wpt failures on invalid-bytes.html CLOSED TREE 2025-01-14 11:35:18 +02:00
Arul Thileeban Sagayam 576ec4a821 Bug 1891465 - Ignore CSP directives with invalid bytes -r=freddy
Differential Revision: https://phabricator.services.mozilla.com/D228537
2025-01-14 08:37:22 +00:00
Tom Schuster 9e11e10df2 Bug 1937224 - Log something for a bad CSP report-to group. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D232505
2025-01-06 11:58:14 +00:00
Mirko Brodesser 9c0b5753f8 Bug 1913077: part 2) Add TrustedHTML to Element.insertAdjacentHTML. r=smaug,peterv
For a potential performance-improvement see
<https://phabricator.services.mozilla.com/D216304>'s description.

Differential Revision: https://phabricator.services.mozilla.com/D216170
2024-09-02 10:41:17 +00:00
Emilio Cobos Álvarez a44b49af0b Bug 1910698 - Add a struct to represent JS caller location and more general warning source location. r=smaug,necko-reviewers,anti-tracking-reviewers,dom-storage-reviewers,pbz,kershaw,janv
Use it liberally across the tree. This could be cleaned up even more in the future.

Differential Revision: https://phabricator.services.mozilla.com/D218114
2024-08-01 17:12:48 +00:00
Otto Länd 9490b901dd Bug 1391243, 1860588: apply code formatting via Lando
# ignore-this-changeset
2024-07-23 21:27:28 +00:00
freyalaluna 7d0dc788db Bug 1391243 - Implementing Report-To Directive r=sefeng,farre
Updated Content Security Policy reporting to align with current W3C reporting standards. Reporting now supports
the usage of the report-to directive, which utilizes a client's response header field to determine where a report
should be sent upon a content security policy violation occurring. Unlike the previous report-uri directive, which
parsed endpoint URIs directly from the response header, report-to utilizes endpoint groups to store the URIs
that will receive the report. This patch handles the reception of a CSP violation, creation of a report from said
violation, and report delivery, while the parsing of the endpoint URIs are handled by D193461. While the deprecated
report-uri directive remains supported, it is now only used for reporting if a client does not specify a report-
to header.

Differential Revision: https://phabricator.services.mozilla.com/D197480
2024-07-23 20:53:53 +00:00
Mirko Brodesser b1b55b3af7 Bug 1901491: part 3) Implement ShouldTrustedTypePolicyCreationBeBlockedByCSP for Windows (not Workers) including reporting exceptions, excluding reporting violations. r=tschuster,webidl,saschanaz
Parsing the trusted-types directive's values is not added to
`nsCSPParser::sourceList` because the latter supports keywords not
supported by the trusted-types directive. E.g. 'report-sample'.
Additionally, the trusted-types directive supports keywords not
supported by any other directive, e.g. 'allow-duplicates'.

Reporting violations will be implemented in a separate part.

Differential Revision: https://phabricator.services.mozilla.com/D207549
2024-06-20 07:57:31 +00:00
Aron Cseh b1de931cde Backed out 4 changesets (bug 1901491) for causing build bustages on TrustedTypePolicyFactory.cpp CLOSED TREE
Backed out changeset f2d1bac2b78e (bug 1901491)
Backed out changeset 4e3e9ade5089 (bug 1901491)
Backed out changeset dd03de7652a1 (bug 1901491)
Backed out changeset 3e7f5c13f96b (bug 1901491)
2024-06-19 18:35:38 +03:00
Mirko Brodesser 963809680c Bug 1901491: part 3) Implement ShouldTrustedTypePolicyCreationBeBlockedByCSP for Windows (not Workers) including reporting exceptions, excluding reporting violations. r=tschuster,webidl,saschanaz
Parsing the trusted-types directive's values is not added to
`nsCSPParser::sourceList` because the latter supports keywords not
supported by the trusted-types directive. E.g. 'report-sample'.
Additionally, the trusted-types directive supports keywords not
supported by any other directive, e.g. 'allow-duplicates'.

Reporting violations will be implemented in a separate part.

Differential Revision: https://phabricator.services.mozilla.com/D207549
2024-06-19 12:51:29 +00:00
Mirko Brodesser 38c71c133c Bug 1890277: part 5) Rename nsCSPTrustedTypesDirectiveExpression to nsCSPTrustedTypesDirectivePolicyName. r=tschuster
See the following parts for why that's done.

Differential Revision: https://phabricator.services.mozilla.com/D208908
2024-05-06 08:21:06 +00:00
Mirko Brodesser 871f19fd7a Bug 1890277: part 4) Add CSPParser support for the trusted-types directive, guarded behind the Trusted Types pref. r=tschuster,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D207274
2024-04-26 07:38:21 +00:00
Aron Cseh a7a22c6623 Backed out 2 changesets (bug 1890277) for causing mochitest failures on browser_misused_characters_in_strings.js CLOSED TREE
Backed out changeset 2a4787f8a69b (bug 1890277)
Backed out changeset 0f7758a42dbd (bug 1890277)
2024-04-25 18:03:40 +03:00
Mirko Brodesser 59c22b11ca Bug 1890277: part 4) Add CSPParser support for the trusted-types directive, guarded behind the Trusted Types pref. r=tschuster,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D207274
2024-04-25 13:59:56 +00:00
Mirko Brodesser 8fe5df1d25 Bug 1890277: part 2) Add require-trusted-types-for directive to CSP parser, guarded behind the Trusted Types pref. r=tschuster,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206998
2024-04-18 07:51:14 +00:00
Tamas Szentpeteri f37778dc72 Backed out 2 changesets (bug 1890277) for causing mochitest failures in csp.properties. CLOSED TREE
Backed out changeset 0434b6d79459 (bug 1890277)
Backed out changeset 2e4a028c156f (bug 1890277)
2024-04-17 18:19:33 +03:00
Mirko Brodesser cb7397c2d4 Bug 1890277: part 2) Add require-trusted-types-for directive to CSP parser, guarded behind the Trusted Types pref. r=tschuster,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206998
2024-04-17 12:24:18 +00:00
Tamas Szentpeteri 1d5d1ce880 Backed out 2 changesets (bug 1890277) for causing build bustages in nsCSPParser.cpp and mochitest failures in csp.properties. CLOSED TREE
Backed out changeset a2f1117a5422 (bug 1890277)
Backed out changeset 2ac938a72185 (bug 1890277)
2024-04-17 13:46:54 +03:00
Mirko Brodesser 1dcaab1ea0 Bug 1890277: part 2) Add require-trusted-types-for directive to CSP parser, guarded behind the Trusted Types pref. r=tschuster,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206998
2024-04-17 09:39:54 +00:00
Mirko Brodesser e4ac740959 Bug 1890548: part 2) Factor details of warnings out of nsCSPParser::directive. r=tschuster
Differential Revision: https://phabricator.services.mozilla.com/D207037
2024-04-10 09:56:14 +00:00
Mirko Brodesser 6f767466d3 Bug 1890548: part 1) Check mCurDir.Length() == 0 before accessing mCurDir[0] in nsCSPParser::directive. r=tschuster
Differential Revision: https://phabricator.services.mozilla.com/D207036
2024-04-10 09:56:14 +00:00
Oliver Medhurst 9606978d1a Bug 1793560 - Remove navigate-to CSP directive r=tschuster
It has never shipped after being implemented years ago,
and was removed from spec in September 2022:
https://github.com/w3c/webappsec-csp/pull/564

Now skipping navigate-to WPT tests. Filed issue upstream for their future removal:
https://github.com/w3c/webappsec-csp/issues/608
Consensus seems to agree to remove, will do in follow up bug once landed.

Also removed our own tests.

Added a hack in StartDocumentLoad as just removing the navigate-to check call
breaks some inhertiance, see comment for more info.

Differential Revision: https://phabricator.services.mozilla.com/D181630
2024-01-03 16:43:12 +00:00
Tom Schuster 8c59b83f3a Bug 1867759 - Remove CSP feature rollout prefs. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D195227
2023-12-01 16:29:00 +00:00
Tooru Fujisawa 209a1f050c Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 12:31:30 +00:00
Natalia Csoregi e0d56104a6 Backed out 14 changesets (bug 1865005, bug 1864168, bug 1864155, bug 1862814, bug 1862693) for causing bustage on nsRFPService.cpp. CLOSED TREE
Backed out changeset a4f3e7625abf (bug 1865005)
Backed out changeset ab38141e470b (bug 1862814)
Backed out changeset a679b50dc4a9 (bug 1862814)
Backed out changeset e340886ce62a (bug 1862814)
Backed out changeset 1378502e64b0 (bug 1862814)
Backed out changeset 8ee94e5e79c2 (bug 1862814)
Backed out changeset 6d4ef1cdfabb (bug 1864168)
Backed out changeset 2c30c4d757fc (bug 1864168)
Backed out changeset d4db9576559b (bug 1864168)
Backed out changeset 8ffec0d83028 (bug 1864168)
Backed out changeset fa77d852b494 (bug 1864168)
Backed out changeset f6646771a26a (bug 1864168)
Backed out changeset 7bd0ff6986df (bug 1864155)
Backed out changeset 39867b503289 (bug 1862693)
2023-11-22 14:01:55 +02:00
Tooru Fujisawa 676bd2ea73 Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 11:13:54 +00:00