feat(libSceNKWebKit): implement SecurityOrigin canAccess, canRequest and canDisplay and the SecurityPolicy origin access allowlist #23772

Merged
opxdelwin merged 2 commits from upstream-pr/23772 into main 2026-11-30 02:10:29 +00:00
opxdelwin commented 2026-11-19 16:14:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by opxdelwin on 2026-11-19T16:14:36Z.


What

Implements the same-origin checks WebKit runs before a page reads another frame, fetches a resource or displays one, plus the per-origin allowlist an embedder uses to grant cross-origin access:

  • WebCore::SecurityOrigin::canAccess(const SecurityOrigin&), canRequest(const URL&) and canDisplay(const URL&) (new src/SecurityOriginAccess.cpp). These are 3.20 exports (LegacyExports.hpp) whose single-argument signatures predate the 11.x tree, so they follow WebKit SecurityOrigin.cpp@7dba47c08160 (Feb 2021, the parent of the canAccess -> isSameOriginDomain rename, after the Whitelist -> Allowlist rename). They read the 11.x SecurityOriginAbi.hpp layout from #22751, with isUnique() taken as the opaque SecurityOriginData index.
  • WebCore::SecurityPolicy::addOriginAccessAllowlistEntry, removeOriginAccessAllowlistEntry and resetOriginAccessAllowlists (src/SecurityPolicy.cpp). These are 11.x inventory exports, so they follow the pinned 11.x SecurityPolicy.cpp and OriginAccessEntry.cpp: a host-side, process-wide list keyed by the source SecurityOriginData, matched with OriginAccessEntry semantics (exact host, subdomains, IP addresses never subdomain-matched, empty host with subdomains = every host of that scheme). canRequest and canDisplay read it.
  • src/Mime.cpp gets CanDisplayOnlyIfCanRequest and ShouldTreatURLSchemeAsDisplayIsolated accessors over the existing scheme lists (built-in lists checked against WebKit's LegacySchemeRegistry.cpp).
  • Stubs removed from Export.cpp; declarations moved from LegacyExports.hpp/InventoryExports.hpp to SecurityOriginExports.hpp/SecurityPolicyExports.hpp.

Still throwing (NotImplemented_nid_no_patch), listed in the debt fragment: canRequest/canDisplay for blob: URLs (no blob origin cache), and canDisplay for a file origin with a file: URL (FileSystem::filesHaveSameVolume is a stub). canAccessStorage stays a stub (the 11.x layout has no m_storageBlockingPolicy). allowAccessTo patterns are not modelled because that export still throws, so the pattern list it would fill is always empty. The WKBundle allowlist exports are untouched.

Each ported function was compared line by line with the pinned source; the feed prefix list and maximumURLSize were diffed by script, and every licence notice is copied verbatim with a // Derived from line. The ported functions are identical to WebKit e12a212a531a apart from the canAccess name.

Tested

Linux (Docker, Ubuntu 24.04 image), Release, BUILD_TESTING=ON, on this branch rebased onto main c144015083:
ctest -R '^(nkwebkit_securityoriginaccess|nkwebkit_securityorigin|nkwebkit_securitypolicy|nkwebkit_mimetyperegistry|nkwebkit_contexturlschemes|nkwebkit_legacyschemeregistryqueries|nkwebkit_forwarding|nkwebkit_symbolset|public_headers.*)$'

  • GCC: 73/73 passed.
  • Clang: 69/73. The 4 failures (public_headers_compile_13/29/44/55) are -Winvalid-offsetof on Region in RegionExports.hpp and fail identically on main b8be4de452 with Clang (61/65); every nkwebkit_* test passes.
  • New nkwebkit_securityoriginaccess covers: canAccess (universal access, same object, opaque on either side, scheme/host/port, document.domain set on one or both sides, file origins with and without path separation); canRequest (default-port normalisation, different scheme/host/port, opaque self and target, document.domain ignored, file origins, blob: throws, universal access); the allowlist (case-insensitive entries, exact host, subdomains with and without the flag, IP addresses, empty host, duplicate add, remove of missing or differently-flagged entries, source origin with an equal tuple shares the list, opaque source ignored, reset); canDisplay (pathEnd at and above 0x04000000, local file path match, canLoadLocalResources, allowlist, each local load policy, file origin + file: URL throws, nested feed URLs, can-display-only-if-can-request and display-isolated schemes, local schemes); null pointers throw std::invalid_argument; origin refcounts unchanged.
  • tools/check_conventions.py --base upstream/main and tools/debt_fold.py --check pass.
  • Not run: Windows (the MSYS2 configure here fails downloading FFmpeg in 3rdparty/ffmpeg-core, unrelated), macOS, any title; not compared with a console module.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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

Summary by CodeRabbit

  • New Features
    • Web content now receives origin-based checks for access, requests, and display, including handling for local resources and isolated URL schemes.
    • Security policy supports adding, removing, and resetting origin access rules, with matching for destination protocols, domains, and optional subdomains.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5398598798 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23772). Originally posted by [opxdelwin](https://github.com/opxdelwin) on 2026-11-19T16:14:36Z. --- ### What Implements the same-origin checks WebKit runs before a page reads another frame, fetches a resource or displays one, plus the per-origin allowlist an embedder uses to grant cross-origin access: - `WebCore::SecurityOrigin::canAccess(const SecurityOrigin&)`, `canRequest(const URL&)` and `canDisplay(const URL&)` (new `src/SecurityOriginAccess.cpp`). These are 3.20 exports (`LegacyExports.hpp`) whose single-argument signatures predate the 11.x tree, so they follow WebKit [`SecurityOrigin.cpp@7dba47c08160`](https://github.com/WebKit/WebKit/blob/7dba47c0816064cba98c0aae6bb92ffd683eac85/Source/WebCore/page/SecurityOrigin.cpp) (Feb 2021, the parent of the `canAccess` -> `isSameOriginDomain` rename, after the Whitelist -> Allowlist rename). They read the 11.x `SecurityOriginAbi.hpp` layout from #22751, with `isUnique()` taken as the opaque `SecurityOriginData` index. - `WebCore::SecurityPolicy::addOriginAccessAllowlistEntry`, `removeOriginAccessAllowlistEntry` and `resetOriginAccessAllowlists` (`src/SecurityPolicy.cpp`). These are 11.x inventory exports, so they follow the pinned 11.x [`SecurityPolicy.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/page/SecurityPolicy.cpp) and [`OriginAccessEntry.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/page/OriginAccessEntry.cpp): a host-side, process-wide list keyed by the source `SecurityOriginData`, matched with `OriginAccessEntry` semantics (exact host, subdomains, IP addresses never subdomain-matched, empty host with subdomains = every host of that scheme). `canRequest` and `canDisplay` read it. - `src/Mime.cpp` gets `CanDisplayOnlyIfCanRequest` and `ShouldTreatURLSchemeAsDisplayIsolated` accessors over the existing scheme lists (built-in lists checked against WebKit's `LegacySchemeRegistry.cpp`). - Stubs removed from `Export.cpp`; declarations moved from `LegacyExports.hpp`/`InventoryExports.hpp` to `SecurityOriginExports.hpp`/`SecurityPolicyExports.hpp`. Still throwing (`NotImplemented_nid_no_patch`), listed in the debt fragment: `canRequest`/`canDisplay` for `blob:` URLs (no blob origin cache), and `canDisplay` for a `file` origin with a `file:` URL (`FileSystem::filesHaveSameVolume` is a stub). `canAccessStorage` stays a stub (the 11.x layout has no `m_storageBlockingPolicy`). `allowAccessTo` patterns are not modelled because that export still throws, so the pattern list it would fill is always empty. The `WKBundle` allowlist exports are untouched. Each ported function was compared line by line with the pinned source; the feed prefix list and `maximumURLSize` were diffed by script, and every licence notice is copied verbatim with a `// Derived from` line. The ported functions are identical to WebKit `e12a212a531a` apart from the `canAccess` name. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Linux (Docker, Ubuntu 24.04 image), Release, `BUILD_TESTING=ON`, on this branch rebased onto `main` c144015083: `ctest -R '^(nkwebkit_securityoriginaccess|nkwebkit_securityorigin|nkwebkit_securitypolicy|nkwebkit_mimetyperegistry|nkwebkit_contexturlschemes|nkwebkit_legacyschemeregistryqueries|nkwebkit_forwarding|nkwebkit_symbolset|public_headers.*)$'` - GCC: 73/73 passed. - Clang: 69/73. The 4 failures (`public_headers_compile_13/29/44/55`) are `-Winvalid-offsetof` on `Region` in `RegionExports.hpp` and fail identically on `main` b8be4de452 with Clang (61/65); every `nkwebkit_*` test passes. - New `nkwebkit_securityoriginaccess` covers: `canAccess` (universal access, same object, opaque on either side, scheme/host/port, `document.domain` set on one or both sides, file origins with and without path separation); `canRequest` (default-port normalisation, different scheme/host/port, opaque self and target, `document.domain` ignored, file origins, `blob:` throws, universal access); the allowlist (case-insensitive entries, exact host, subdomains with and without the flag, IP addresses, empty host, duplicate add, remove of missing or differently-flagged entries, source origin with an equal tuple shares the list, opaque source ignored, reset); `canDisplay` (`pathEnd` at and above 0x04000000, local file path match, `canLoadLocalResources`, allowlist, each local load policy, `file` origin + `file:` URL throws, nested feed URLs, can-display-only-if-can-request and display-isolated schemes, local schemes); null pointers throw `std::invalid_argument`; origin refcounts unchanged. - `tools/check_conventions.py --base upstream/main` and `tools/debt_fold.py --check` pass. - Not run: Windows (the MSYS2 configure here fails downloading FFmpeg in `3rdparty/ffmpeg-core`, unrelated), macOS, any title; not compared with a console module. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Web content now receives origin-based checks for access, requests, and display, including handling for local resources and isolated URL schemes. * Security policy supports adding, removing, and resetting origin access rules, with matching for destination protocols, domains, and optional subdomains. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
PrivacyOnion commented 2026-11-19 16:30:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T16:30:40Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 5ce70803d5:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_securityoriginaccess_tests built cleanly.
  • CTest (nkwebkit_securityoriginaccess):
    1/1 Test #4712: nkwebkit_securityoriginaccess ....   Passed    0.08 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/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/SecurityOriginExports.hpp, core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp, core/libs/prx/libSceNKWebKit/src/Mime.cpp, core/libs/prx/libSceNKWebKit/src/MimeAbi.hpp, core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp, core/libs/prx/libSceNKWebKit/src/SecurityOriginAccess.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Checked null-pointer guards in SecurityOriginAccess.cpp (Checked()) and SecurityPolicy.cpp (CheckedOrigin(), CheckedString()), confirming invalid_argument is thrown on null inputs.
    • Checked origin domain matching and DOM-modified domain comparison in ZNK7WebCore14SecurityOrigin9canAccessERKS0 against WebKit 11.x / 2021 SecurityOrigin.cpp rules.
    • Verified OriginAccessMap concurrency safety in SecurityPolicy.cpp, confirming std::lock_guard locker(originAccessMapLock) guards all reads and mutations across add, remove, reset, and access checks.
    • Verified deadlocks and recursive locking: SecurityOriginAccess.cpp calls SecurityPolicyIsAccessAllowed which locks originAccessMapLock; no callbacks or re-entrant locks are performed under lock.
    • Inspected URL scheme handling, display isolation, and local file checks in canDisplay and canRequest, verifying NotImplemented_nid_no_patch is called appropriately for blob URLs and unhandled local file volume checks with debt recorded.
    • Verified technical debt markdown fragment syntax in docs/dev/debt/changes/feat-libscenkwebkit-origin-access-checks.md and conformance to AGENTS.md rules.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5979121383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23772#pullrequestreview-5979121383). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-19T16:30:40Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `5ce70803d5`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_securityoriginaccess_tests` built cleanly. - **CTest** (`nkwebkit_securityoriginaccess`): ``` 1/1 Test #4712: nkwebkit_securityoriginaccess .... Passed 0.08 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/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/SecurityOriginExports.hpp`, `core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Mime.cpp`, `core/libs/prx/libSceNKWebKit/src/MimeAbi.hpp`, `core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp`, `core/libs/prx/libSceNKWebKit/src/SecurityOriginAccess.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Checked null-pointer guards in SecurityOriginAccess.cpp (Checked()) and SecurityPolicy.cpp (CheckedOrigin(), CheckedString()), confirming invalid_argument is thrown on null inputs. - Checked origin domain matching and DOM-modified domain comparison in _ZNK7WebCore14SecurityOrigin9canAccessERKS0_ against WebKit 11.x / 2021 SecurityOrigin.cpp rules. - Verified OriginAccessMap concurrency safety in SecurityPolicy.cpp, confirming std::lock_guard locker(originAccessMapLock) guards all reads and mutations across add, remove, reset, and access checks. - Verified deadlocks and recursive locking: SecurityOriginAccess.cpp calls SecurityPolicyIsAccessAllowed which locks originAccessMapLock; no callbacks or re-entrant locks are performed under lock. - Inspected URL scheme handling, display isolation, and local file checks in canDisplay and canRequest, verifying NotImplemented_nid_no_patch is called appropriately for blob URLs and unhandled local file volume checks with debt recorded. - Verified technical debt markdown fragment syntax in docs/dev/debt/changes/feat-libscenkwebkit-origin-access-checks.md and conformance to AGENTS.md rules. Looks Good To Me
MarcZX10 commented 2026-11-19 16:35:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T16:35:35Z.

Review: COMMENTED


Reviewed — no blocking findings

The core origin checks and allowlist implementation were reviewed at head 5ce70803d56af25a68f19bb470043531f7548c17; no checks were run in this review, and two changed files were unavailable for full-text inspection.

What I ran

No commands or tests were run. I inspected the prepared diff and targeted source ranges using repo_read.py.

Results

Check Result Note
Diff and targeted source review passed Core origin and policy logic read
Tests not run Only author-reported results available
Complete changed-file review not run Two files excluded by size

Findings

Blocking

None identified in the code inspected.

Non-blocking

None.

Not verified

Could not read the full text of core/libs/prx/libSceNKWebKit/Export.cpp or core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp; the diff showed their removed stubs and declarations. No tests were run. Other changed files were read only at changed lines or targeted ranges, rather than in full. The author reports GCC and Clang test results, but those were not independently verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5979203573 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23772#pullrequestreview-5979203573). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T16:35:35Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The core origin checks and allowlist implementation were reviewed at head `5ce70803d56af25a68f19bb470043531f7548c17`; no checks were run in this review, and two changed files were unavailable for full-text inspection. ## What I ran No commands or tests were run. I inspected the prepared diff and targeted source ranges using `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Core origin and policy logic read | | Tests | not run | Only author-reported results available | | Complete changed-file review | not run | Two files excluded by size | ## Findings ### Blocking None identified in the code inspected. ### Non-blocking None. ## Not verified Could not read the full text of `core/libs/prx/libSceNKWebKit/Export.cpp` or `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`; the diff showed their removed stubs and declarations. No tests were run. Other changed files were read only at changed lines or targeted ranges, rather than in full. The author reports GCC and Clang test results, but those were not independently verified. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-22 06:24:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T06:24:13Z.

Review: DISMISSED


Reviewed — changes requested

Changes are required before merge: correct allowlist matching so destination protocol and host comparisons follow WebKit’s ASCII case insensitive semantics for the origin tuple.

What I ran

Reviewed head 4e288faa63abc493c597c967c94cc9118f4b0516 using the prepared diff and repo_read.py; no commands or tests were run during this review. The author reports Linux GCC tests passing, with four Clang header test failures also present on main.

Results

Check Result Note
Diff and targeted source review passed Core implementation and tests read
Programmatic checks not run Author-reported results only

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp:271: SameTuple compares the source protocol and host with WTF::equal, which is case sensitive. WebKit origin tuple matching is ASCII case insensitive; consequently allowlist entries added for an origin may not be found when the equivalent origin tuple has different ASCII casing, despite the description claiming equal tuples share the list. Use the case insensitive comparison for both tuple fields.

Non-blocking

None.

Not verified

The complete file texts in the review bundle were available for all changed files except Export.cpp and InventoryExports.hpp, excluded as too large. Their removals were inspected in the diff. No tests were run. Windows, macOS, and console behavior were not verified.

To get this to a good state

Fix the source tuple comparison and add or adjust a regression test showing case-insensitive equivalent origins find the same allowlist; rerun the reported targeted checks on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6010754480 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23772#pullrequestreview-6010754480). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T06:24:13Z. **Review:** DISMISSED --- # Reviewed — changes requested Changes are required before merge: correct allowlist matching so destination protocol and host comparisons follow WebKit’s ASCII case insensitive semantics for the origin tuple. ## What I ran Reviewed head `4e288faa63abc493c597c967c94cc9118f4b0516` using the prepared diff and `repo_read.py`; no commands or tests were run during this review. The author reports Linux GCC tests passing, with four Clang header test failures also present on main. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Core implementation and tests read | | Programmatic checks | not run | Author-reported results only | ## Findings ### Blocking - `core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp:271`: `SameTuple` compares the source protocol and host with `WTF::equal`, which is case sensitive. WebKit origin tuple matching is ASCII case insensitive; consequently allowlist entries added for an origin may not be found when the equivalent origin tuple has different ASCII casing, despite the description claiming equal tuples share the list. Use the case insensitive comparison for both tuple fields. ### Non-blocking None. ## Not verified The complete file texts in the review bundle were available for all changed files except `Export.cpp` and `InventoryExports.hpp`, excluded as too large. Their removals were inspected in the diff. No tests were run. Windows, macOS, and console behavior were not verified. ## To get this to a good state Fix the source tuple comparison and add or adjust a regression test showing case-insensitive equivalent origins find the same allowlist; rerun the reported targeted checks on the updated head.
coderabbitai[bot] commented 2026-11-29 23:26:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T23:26:14Z.

Review: COMMENTED


Architecture findings (3)

  • Major — Three former stubs now authorize using fields read from a 3.20 caller's origin object under the 11.x layout. Each grants universal access before validating the origin discriminator. If the caller layout differs at that field, an ordinary origin could be treated as privileged. The layout mismatch is not established; local offset assertions do not resolve it.
Advisory architecture findings (2)

  • Minor — The new grant scope is deliberately process-wide: a later origin object with the same scheme, host, and port inherits a grant even after the creating object is destroyed. There is no page or context owner in the key, so a grant intended to end at a context boundary depends on explicit host cleanup. The production grant owner and teardown contract were not verified.
  • Minor — The existing local-load policy is a plain shared value. The new display path reads it to decide whether to skip local-resource restrictions. If the embedder permits policy changes concurrently with display decisions, the unsynchronized read and write make that decision unreliable. The supplied tests switch policies sequentially, and production thread confinement was not established.
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4bb0807a-042f-4b7e-81b8-f8d37ab57bc4
Commits

Reviewing files that changed from the base of the PR and between 97319cf0b9 and 3772f1f35a.

Files selected for processing: 11

  • core/libs/prx/libSceNKWebKit/Export.cpp
  • core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
  • core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp
  • core/libs/prx/libSceNKWebKit/include/SecurityOriginExports.hpp
  • core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp
  • core/libs/prx/libSceNKWebKit/src/Mime.cpp
  • core/libs/prx/libSceNKWebKit/src/MimeAbi.hpp
  • core/libs/prx/libSceNKWebKit/src/SecurityOriginAccess.cpp
  • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp
  • core/libs/prx/libSceNKWebKit/tests/SecurityOriginAccess.cpp
  • docs/dev/debt/changes/feat-libscenkwebkit-origin-access-checks.md
Files with no reviewable changes: 3

  • core/libs/prx/libSceNKWebKit/Export.cpp
  • core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
  • core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6105357315 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23772#pullrequestreview-6105357315). Originally posted by [coderabbitai[bot]](https://github.com/apps/coderabbitai) on 2026-11-29T23:26:14Z. **Review:** COMMENTED --- <!-- coderabbit-ai-generated:v1 --> **Architecture findings (3)** - **Major** — Three former stubs now authorize using fields read from a 3.20 caller's origin object under the 11.x layout. Each grants universal access before validating the origin discriminator. If the caller layout differs at that field, an ordinary origin could be treated as privileged. The layout mismatch is not established; local offset assertions do not resolve it. <details> <summary>Advisory architecture findings (2)</summary> <dl> <dd> <br> - **Minor** — The new grant scope is deliberately process-wide: a later origin object with the same scheme, host, and port inherits a grant even after the creating object is destroyed. There is no page or context owner in the key, so a grant intended to end at a context boundary depends on explicit host cleanup. The production grant owner and teardown contract were not verified. - **Minor** — The existing local-load policy is a plain shared value. The new display path reads it to decide whether to skip local-resource restrictions. If the embedder permits policy changes concurrently with display decisions, the unsynchronized read and write make that decision unreliable. The supplied tests switch policies sequentially, and production thread confinement was not established. </dd> </dl> </details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: Unavailable - **Branch**: Unavailable - **File**: No configuration file from this repository applied - **Commit**: Unavailable - **Layers**: defaults - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `4bb0807a-042f-4b7e-81b8-f8d37ab57bc4` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 97319cf0b9f85c0a34cf2c511cffdcba5c704173 and 3772f1f35aa708174a23ce024d6b589ba70a8317. </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 11</summary> <dl> <dd> <br> * `core/libs/prx/libSceNKWebKit/Export.cpp` * `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp` * `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp` * `core/libs/prx/libSceNKWebKit/include/SecurityOriginExports.hpp` * `core/libs/prx/libSceNKWebKit/include/SecurityPolicyExports.hpp` * `core/libs/prx/libSceNKWebKit/src/Mime.cpp` * `core/libs/prx/libSceNKWebKit/src/MimeAbi.hpp` * `core/libs/prx/libSceNKWebKit/src/SecurityOriginAccess.cpp` * `core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp` * `core/libs/prx/libSceNKWebKit/tests/SecurityOriginAccess.cpp` * `docs/dev/debt/changes/feat-libscenkwebkit-origin-access-checks.md` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-no-changes-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-no-changes.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files with no reviewable changes: 3</summary> <dl> <dd> <br> * core/libs/prx/libSceNKWebKit/Export.cpp * core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp * core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=754d1fc2-0ce6-4a71-92be-6d821a7112ee attempt=4e727fca-8112-44b7-a2dd-258d69d6e32d batch=1/1 -->
MarcZX10 commented 2026-11-29 23:31:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T23:31:27Z.

Review: COMMENTED


Reviewed — comments

The implementation covers the requested origin checks and allowlist, but I could not verify all changed files or the claimed test results in this review session.

What I ran

Reviewed head 3772f1f35aa708174a23ce024d6b589ba70a8317 using the prepared diff and the pinned repository reader. No tests or build commands were run.

Results

Check Result Note
Diff and changed-file manifest passed Prepared review artifacts inspected
Targeted source context passed Origin, policy, ABI, MIME, and test code read
Automated checks not run Results in the description are author-reported

Findings

Blocking

None verified in the code read.

Non-blocking

  • core/libs/prx/libSceNKWebKit/src/SecurityOriginAccess.cpp:87 treats the opaque SecurityOriginData index as the unique-origin marker. The debt note says the 3.20 object layout has not been compared with a console module. Verify this layout against the target module before relying on these checks for security decisions.
  • core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp:364 appends every allowlist entry, including duplicates. This matches the exercised add/remove behavior, but repeated additions can grow the process-wide list until each matching removal; consider deduplicating if callers may add entries repeatedly.

Not verified

Export.cpp was excluded from the review folder because it was too large, so its full text was not read. All other files listed as included in the manifest were available, but not every included file was read in full; in particular, large export headers and the complete 389-line test file were inspected only through their changes and relevant ranges. No tests were run, and console behavior and the ABI layout remain unconfirmed. The description reports Linux test outcomes, convention checks, and debt checks; those results were not independently verified.

To get this to a good state

Nothing is required. Optional follow-up: compare the origin layout against a 3.20 console module and consider deduplicating repeated allowlist entries.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6105379704 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23772#pullrequestreview-6105379704). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-29T23:31:27Z. **Review:** COMMENTED --- # Reviewed — comments The implementation covers the requested origin checks and allowlist, but I could not verify all changed files or the claimed test results in this review session. ## What I ran Reviewed head `3772f1f35aa708174a23ce024d6b589ba70a8317` using the prepared diff and the pinned repository reader. No tests or build commands were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed-file manifest | passed | Prepared review artifacts inspected | | Targeted source context | passed | Origin, policy, ABI, MIME, and test code read | | Automated checks | not run | Results in the description are author-reported | ## Findings ### Blocking None verified in the code read. ### Non-blocking - `core/libs/prx/libSceNKWebKit/src/SecurityOriginAccess.cpp:87` treats the opaque `SecurityOriginData` index as the unique-origin marker. The debt note says the 3.20 object layout has not been compared with a console module. Verify this layout against the target module before relying on these checks for security decisions. - `core/libs/prx/libSceNKWebKit/src/SecurityPolicy.cpp:364` appends every allowlist entry, including duplicates. This matches the exercised add/remove behavior, but repeated additions can grow the process-wide list until each matching removal; consider deduplicating if callers may add entries repeatedly. ## Not verified `Export.cpp` was excluded from the review folder because it was too large, so its full text was not read. All other files listed as included in the manifest were available, but not every included file was read in full; in particular, large export headers and the complete 389-line test file were inspected only through their changes and relevant ranges. No tests were run, and console behavior and the ABI layout remain unconfirmed. The description reports Linux test outcomes, convention checks, and debt checks; those results were not independently verified. ## To get this to a good state Nothing is required. Optional follow-up: compare the origin layout against a 3.20 console module and consider deduplicating repeated allowlist entries.
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!23772
No description provided.