feat(libSceNKWebKit): implement shouldHideReferrer #18804

Merged
AlexWhitehouse merged 2 commits from upstream-pr/18804 into main 2026-11-12 16:52:03 +00:00
AlexWhitehouse commented 2026-11-12 10:40:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-12T10:40:44Z.


What

libSceNKWebKit WebCore::SecurityPolicy::shouldHideReferrer(const URL&, const String&) (_ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE, NID V8i2vIgKigI) threw not implemented. This PR ports it from the PS5 WebKit tree the other NKWebKit ports use, 80f77e94:

The new src/SecurityPolicy.cpp starts with both files' notices.

Behaviour:

  • Rule: as upstream, the referrer is hidden when it isn't an http or https string, shown when it is http, and, when it is https, hidden only if the destination URL isn't https.
  • Referrer matching: the referrer string is matched the way protocolIsInternal does:
    • leading code units up to and including space (NUL and control characters too) are skipped;
    • tabs, CRs and LFs after that are skipped;
    • letters match case-insensitively, and the scheme must be followed by :.
  • Destination URL: checked through the existing URL::protocolIs export.
  • Strings: 8-bit and 16-bit referrers are handled alike. A null referrer reference throws.

The stub and its inventory row are removed, the NKWebKit count drops from 5970 to 5969, and a debt entry records that the console's ABI is unverified.

Tested

  • New test: nkwebkit_securitypolicy (core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp) covers:
    • every combination of http, https, other-scheme and invalid referrers with http, https and other destination URLs;
    • case-insensitive schemes;
    • leading whitespace and control characters, and embedded tabs and newlines;
    • null and empty referrers;
    • 8-bit and UTF-16 referrers.
  • Linux x86-64 (Ubuntu 26.04, GCC 15, Release):
    • on main, the test fails with …shouldHideReferrer… not implemented;
    • with this PR, nkwebkit_securitypolicy, nkwebkit_wtfvalues, guest_nkwebkit_urls and nkwebkit_wtf pass.
  • Windows 11 (build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Release): nkwebkit_securitypolicy, nkwebkit_wtf and public_headers pass at 65e93bd36b, with no compiler warnings in the changed files. The branch was then rebased onto current main, where my #17726 had added a debt entry at the same spot; both are kept, and the count line now drops by one, which the original commit had missed. The focused tests pass again on Linux.
  • Mutation check: inverting the destination's https result fails with https://source/, expected 1 got 0.
  • python3 tools/check_conventions.py --base origin/main: all checks passed.
  • python3 tools/pr_overlap.py: no open PR implements this export. I compared the 72 NKWebKit PRs it lists: none changes this export, its NID or the new files, and #18357's implementation hunks aren't touched. My other NKWebKit PRs share the count line. Whichever merges second recounts.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5275874248 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18804). Originally posted by [AlexWhitehouse](https://github.com/AlexWhitehouse) on 2026-11-12T10:40:44Z. --- ### What libSceNKWebKit `WebCore::SecurityPolicy::shouldHideReferrer(const URL&, const String&)` (`_ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE`, NID `V8i2vIgKigI`) threw `not implemented`. This PR ports it from the PS5 WebKit tree the other NKWebKit ports use, 80f77e94: - [`SecurityPolicy.cpp` lines 59–73](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/page/SecurityPolicy.cpp#L59-L73): the policy; - [`URL.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/URL.cpp)'s `protocolIsInternal`: matching a scheme on the raw referrer string. The new `src/SecurityPolicy.cpp` starts with both files' notices. Behaviour: - **Rule:** as upstream, the referrer is hidden when it isn't an `http` or `https` string, shown when it is `http`, and, when it is `https`, hidden only if the destination URL isn't `https`. - **Referrer matching:** the referrer string is matched the way `protocolIsInternal` does: - leading code units up to and including space (NUL and control characters too) are skipped; - tabs, CRs and LFs after that are skipped; - letters match case-insensitively, and the scheme must be followed by `:`. - **Destination URL:** checked through the existing `URL::protocolIs` export. - **Strings:** 8-bit and 16-bit referrers are handled alike. A null referrer reference throws. The stub and its inventory row are removed, the NKWebKit count drops from 5970 to 5969, and a debt entry records that the console's ABI is unverified. ### Tested - **New test:** `nkwebkit_securitypolicy` (`core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp`) covers: - every combination of `http`, `https`, other-scheme and invalid referrers with `http`, `https` and other destination URLs; - case-insensitive schemes; - leading whitespace and control characters, and embedded tabs and newlines; - null and empty referrers; - 8-bit and UTF-16 referrers. - **Linux x86-64** (Ubuntu 26.04, GCC 15, Release): - on `main`, the test fails with `…shouldHideReferrer… not implemented`; - with this PR, `nkwebkit_securitypolicy`, `nkwebkit_wtfvalues`, `guest_nkwebkit_urls` and `nkwebkit_wtf` pass. - **Windows 11** (build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Release): `nkwebkit_securitypolicy`, `nkwebkit_wtf` and `public_headers` pass at 65e93bd36b, with no compiler warnings in the changed files. The branch was then rebased onto current `main`, where my #17726 had added a debt entry at the same spot; both are kept, and the count line now drops by one, which the original commit had missed. The focused tests pass again on Linux. - **Mutation check:** inverting the destination's `https` result fails with `https://source/, expected 1 got 0`. - `python3 tools/check_conventions.py --base origin/main`: all checks passed. - **`python3 tools/pr_overlap.py`:** no open PR implements this export. I compared the 72 NKWebKit PRs it lists: none changes this export, its NID or the new files, and #18357's implementation hunks aren't touched. My other NKWebKit PRs share the count line. Whichever merges second recounts. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PrivacyOnion commented 2026-11-12 10:53:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T10:53:22Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 07e0e25fa4:

  • Conventions: tools/check_conventions.py passed; git diff --check reported whitespace errors.
  • Build: nkwebkit_securitypolicy_tests built cleanly.
  • CTest (nkwebkit_securitypolicy):
    1/1 Test #3780: nkwebkit_securitypolicy ..........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified referrer policy logic in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: correctly hides referrers with schemes other than HTTP/HTTPS, shows HTTP referrers, and restricts HTTPS referrers to HTTPS destination URLs evaluated via _ZNK3WTF3URL10protocolIsENS_10StringViewE.
    • Verified scheme parser implementation ProtocolIs in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: correctly skips leading ASCII whitespace and control characters (codeUnit <= ' '), skips intra-scheme tabs, CRs, and LFs, performs case-insensitive ASCII matching, and validates the trailing ':' delimiter.
    • Verified WTF character buffer bounds and null validation in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: safely handles null string.impl, validates !impl.data by throwing std::invalid_argument('null WTF character buffer'), and correctly handles both 8-bit (hashAndFlags & 4) and UTF-16 character arrays within impl.length bounds.
    • Verified export declarations and ABI across core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp, InventoryExports.hpp, and Export.cpp: confirmed removal of the NotImplemented_nid_no_patch stub and matching APS5_VABI export signature for mangled symbol _ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE.
    • Verified technical debt accounting in docs/dev/debt/libSceNKWebKit.md: confirmed inventory stub counter decrement from 5970 to 5969, removal of the inventory table row for NID V8i2vIgKigI, and addition of the technical debt specification for WebCore::SecurityPolicy::shouldHideReferrer.
    • Verified test coverage in core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp: confirmed validation of 8-bit and UTF-16 strings, invalid destination URLs, case sensitivity, leading control characters, embedded newlines/tabs, and empty/null string objects.
  • Concerns:
    • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp:92: Missing nullptr check on url parameter. When a caller passes url = nullptr with an HTTPS referrer (e.g. referrer = \"https://source/\"), referrer is non-null so line 86 passes, and referrerIsSecureURL evaluates to true. Execution bypasses the early returns on lines 89 and 90 and reaches line 92 (bool urlIsSecureURL = _ZNK3WTF3URL10protocolIsENS_10StringViewE(url, {\"https\", 5, true});), which passes nullptr as the this pointer to WTF::URL::protocolIs, resulting in an unchecked null pointer dereference and segmentation fault instead of throwing std::invalid_argument as specified in docs/dev/debt/libSceNKWebKit.md ("Null accessed references or character buffers throw where upstream dereferences them").
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5873139207 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18804#pullrequestreview-5873139207). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T10:53:22Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `07e0e25fa4`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` reported whitespace errors. - **Build**: `nkwebkit_securitypolicy_tests` built cleanly. - **CTest** (`nkwebkit_securitypolicy`): ``` 1/1 Test #3780: nkwebkit_securitypolicy .......... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified referrer policy logic in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: correctly hides referrers with schemes other than HTTP/HTTPS, shows HTTP referrers, and restricts HTTPS referrers to HTTPS destination URLs evaluated via _ZNK3WTF3URL10protocolIsENS_10StringViewE. - Verified scheme parser implementation ProtocolIs in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: correctly skips leading ASCII whitespace and control characters (codeUnit <= ' '), skips intra-scheme tabs, CRs, and LFs, performs case-insensitive ASCII matching, and validates the trailing ':' delimiter. - Verified WTF character buffer bounds and null validation in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: safely handles null string.impl, validates !impl.data by throwing std::invalid_argument('null WTF character buffer'), and correctly handles both 8-bit (hashAndFlags & 4) and UTF-16 character arrays within impl.length bounds. - Verified export declarations and ABI across core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp, InventoryExports.hpp, and Export.cpp: confirmed removal of the NotImplemented_nid_no_patch stub and matching APS5_VABI export signature for mangled symbol _ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE. - Verified technical debt accounting in docs/dev/debt/libSceNKWebKit.md: confirmed inventory stub counter decrement from 5970 to 5969, removal of the inventory table row for NID V8i2vIgKigI, and addition of the technical debt specification for WebCore::SecurityPolicy::shouldHideReferrer. - Verified test coverage in core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp: confirmed validation of 8-bit and UTF-16 strings, invalid destination URLs, case sensitivity, leading control characters, embedded newlines/tabs, and empty/null string objects. - **Concerns**: - core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp:92: Missing nullptr check on `url` parameter. When a caller passes `url = nullptr` with an HTTPS referrer (e.g. `referrer = \"https://source/\"`), `referrer` is non-null so line 86 passes, and `referrerIsSecureURL` evaluates to `true`. Execution bypasses the early returns on lines 89 and 90 and reaches line 92 (`bool urlIsSecureURL = _ZNK3WTF3URL10protocolIsENS_10StringViewE(url, {\"https\", 5, true});`), which passes `nullptr` as the `this` pointer to `WTF::URL::protocolIs`, resulting in an unchecked null pointer dereference and segmentation fault instead of throwing `std::invalid_argument` as specified in `docs/dev/debt/libSceNKWebKit.md` (\"Null accessed references or character buffers throw where upstream dereferences them\"). - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-12 11:34:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T11:34:40Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 258aa99d8a:

  • Conventions: tools/check_conventions.py passed; git diff --check reported whitespace errors.
  • Build: nkwebkit_securitypolicy_tests built cleanly.
  • CTest (nkwebkit_securitypolicy):
    1/1 Test #3782: nkwebkit_securitypolicy ..........   Passed    0.04 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp that WebCore::SecurityPolicy::shouldHideReferrer checks the referrer pointer and throws std::invalid_argument("null WTF::String reference") before dereference, and verifies string.impl and impl.data before accessing characters (throwing std::invalid_argument("null WTF character buffer")).
    • Verified in ProtocolIs (SecurityPolicy.cpp) that scheme matching faithfully reproduces upstream WTF::protocolIsInternal: handles both 8-bit (impl.hashAndFlags & 4) and UTF-16 char16_t strings, skips leading whitespace and control characters (codeUnit <= ' '), skips embedded tabs and newlines ('\t', '\r', '\n'), performs case-insensitive ASCII comparison, and requires a trailing ':' without overflowing the protocol literal buffer.
    • Verified in SecurityPolicy.cpp that referrer policy logic strictly matches upstream WebCore: non-web referrers are hidden (returns true), HTTP referrers are allowed (returns false), and HTTPS referrers delegate to _ZNK3WTF3URL10protocolIsENS_10StringViewE with {"https", 5, true} to show only when the destination URL is HTTPS.
    • Verified that the export declaration in core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp and its definition in SecurityPolicy.cpp match the Itanium mangled name _ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE (NID V8i2vIgKigI) and APS5_VABI calling convention, with the stub cleanly removed from Export.cpp and InventoryExports.hpp.
    • Verified that docs/dev/debt/libSceNKWebKit.md records the technical debt entry for shouldHideReferrer, decrements the unresolved inventory count from 5967 to 5966, removes the inventory row, and contains zero prohibited comments in code.
    • Verified in core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp that test coverage exercises 8-bit and 16-bit referrers and destinations across HTTP, HTTPS, non-web schemes (ftp, file, data, relative), mixed-case schemes, leading control codes, embedded whitespace, null string objects, and invalid destination URLs.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5873695599 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18804#pullrequestreview-5873695599). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T11:34:40Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `258aa99d8a`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` reported whitespace errors. - **Build**: `nkwebkit_securitypolicy_tests` built cleanly. - **CTest** (`nkwebkit_securitypolicy`): ``` 1/1 Test #3782: nkwebkit_securitypolicy .......... Passed 0.04 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified in core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp that WebCore::SecurityPolicy::shouldHideReferrer checks the referrer pointer and throws std::invalid_argument(\"null WTF::String reference\") before dereference, and verifies string.impl and impl.data before accessing characters (throwing std::invalid_argument(\"null WTF character buffer\")). - Verified in ProtocolIs (SecurityPolicy.cpp) that scheme matching faithfully reproduces upstream WTF::protocolIsInternal: handles both 8-bit (impl.hashAndFlags & 4) and UTF-16 char16_t strings, skips leading whitespace and control characters (codeUnit <= ' '), skips embedded tabs and newlines ('\\t', '\\r', '\\n'), performs case-insensitive ASCII comparison, and requires a trailing ':' without overflowing the protocol literal buffer. - Verified in SecurityPolicy.cpp that referrer policy logic strictly matches upstream WebCore: non-web referrers are hidden (returns true), HTTP referrers are allowed (returns false), and HTTPS referrers delegate to _ZNK3WTF3URL10protocolIsENS_10StringViewE with {\"https\", 5, true} to show only when the destination URL is HTTPS. - Verified that the export declaration in core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp and its definition in SecurityPolicy.cpp match the Itanium mangled name _ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE (NID V8i2vIgKigI) and APS5_VABI calling convention, with the stub cleanly removed from Export.cpp and InventoryExports.hpp. - Verified that docs/dev/debt/libSceNKWebKit.md records the technical debt entry for shouldHideReferrer, decrements the unresolved inventory count from 5967 to 5966, removes the inventory row, and contains zero prohibited comments in code. - Verified in core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp that test coverage exercises 8-bit and 16-bit referrers and destinations across HTTP, HTTPS, non-web schemes (ftp, file, data, relative), mixed-case schemes, leading control codes, embedded whitespace, null string objects, and invalid destination URLs. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-12 14:14:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T14:14:37Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 71b9e7d0b6:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_securitypolicy_tests built cleanly.
  • CTest (nkwebkit_securitypolicy):
    1/1 Test #3792: nkwebkit_securitypolicy ..........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified _ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE validates referrer for nullptr throwing std::invalid_argument, and only queries destination protocol via _ZNK3WTF3URL10protocolIsENS_10StringViewE when the referrer is HTTPS.
    • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified ProtocolIs bounds safety when scanning protocol strings ('http' and 'https'), ensuring *protocol++ immediately returns upon encountering '\0' (evaluating codeUnit == ':') without out-of-bounds reads or invalid pointer dereferences.
    • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified character decoding correctly branches on impl.hashAndFlags & 4 to index 8-bit (unsigned char) or 16-bit (char16_t) buffers without signedness or narrowing defects, throwing std::invalid_argument on null impl.data.
    • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified scheme matching semantics faithfully reproduce upstream WebKit protocolIsInternal by skipping leading code units <= ' ', ignoring embedded '\t', '\r', and '\n', performing ASCII case-insensitive matching, and requiring a trailing colon.
    • core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp and Export.cpp: Verified correct extern "C" APS5_VABI signature, removal of the NotImplemented_nid_no_patch stub from Export.cpp and InventoryExports.hpp, and inclusion in libSceNKWebKit.hpp.
    • docs/dev/debt/libSceNKWebKit.md: Verified decrement of unimplemented exports count from 5965 to 5964, removal of NID V8i2vIgKigI from the inventory table, and addition of the technical debt entry documenting source origin and ABI verification status.
    • core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp: Verified comprehensive test coverage over combinations of http/https/custom schemes, 8-bit and UTF-16 string encodings, leading whitespace/control codes, embedded line breaks, and null string instances.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5875917132 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18804#pullrequestreview-5875917132). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T14:14:37Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `71b9e7d0b6`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_securitypolicy_tests` built cleanly. - **CTest** (`nkwebkit_securitypolicy`): ``` 1/1 Test #3792: nkwebkit_securitypolicy .......... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified _ZN7WebCore14SecurityPolicy18shouldHideReferrerERKN3WTF3URLERKNS1_6StringE validates referrer for nullptr throwing std::invalid_argument, and only queries destination protocol via _ZNK3WTF3URL10protocolIsENS_10StringViewE when the referrer is HTTPS. - core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified ProtocolIs bounds safety when scanning protocol strings ('http' and 'https'), ensuring *protocol++ immediately returns upon encountering '\0' (evaluating codeUnit == ':') without out-of-bounds reads or invalid pointer dereferences. - core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified character decoding correctly branches on impl.hashAndFlags & 4 to index 8-bit (unsigned char) or 16-bit (char16_t) buffers without signedness or narrowing defects, throwing std::invalid_argument on null impl.data. - core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp: Verified scheme matching semantics faithfully reproduce upstream WebKit protocolIsInternal by skipping leading code units <= ' ', ignoring embedded '\t', '\r', and '\n', performing ASCII case-insensitive matching, and requiring a trailing colon. - core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp and Export.cpp: Verified correct extern "C" APS5_VABI signature, removal of the NotImplemented_nid_no_patch stub from Export.cpp and InventoryExports.hpp, and inclusion in libSceNKWebKit.hpp. - docs/dev/debt/libSceNKWebKit.md: Verified decrement of unimplemented exports count from 5965 to 5964, removal of NID V8i2vIgKigI from the inventory table, and addition of the technical debt entry documenting source origin and ABI verification status. - core/libs/prx/libSceNKWebKit/tests/SecurityPolicy.cpp: Verified comprehensive test coverage over combinations of http/https/custom schemes, 8-bit and UTF-16 string encodings, leading whitespace/control codes, embedded line breaks, and null string instances. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Looks Good To Me
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!18804
No description provided.