feat(libSceNKWebKit): implement WKSecurityOrigin C API exports #15853
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15853"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ashwin280802 on 2026-11-04T19:45:10Z.
What
Implements
WKSecurityOriginCopyDatabaseIdentifier,WKSecurityOriginCreateFromDatabaseIdentifierandWKSecurityOriginCreateFromStringinlibSceNKWebKit; they threwNotImplemented_nid_no_patchbefore.protocol_+encodeForFileName(host)+_port, andfile__0forfilein any case (SecurityOriginData.cpp:100-146). Parsing it back does not decode, accepts trailing junk after the port, treats port 0 as no port, and returns null for no separators or an unparsable or overflowing port. The host is kept as written and default ports are dropped (SecurityOrigin.cpp:130-157).http,https,ftp,ws,wssandfile(trimming, slashes and backslashes, userinfo, ports, forbidden host characters, drive letters). Default ports (ftp21,ws80,http80,wss443,https443) are dropped and an explicit port 0 is kept. Other schemes, schemes registered as no-access, invalid input and empty hosts give an opaque origin (empty protocol and host, null string,__0), as in SecurityOriginData.cpp:166-211 and WKSecurityOriginRef.cpp:38-70.std::runtime_errorinstead of returning a guess: IPv6 literals, percent-escapes, non-ASCII orxn--hosts, IPv4 forms andblob:. Scheme handlers are not modelled. Both are in the debt file.WKSecurityOriginCreateis unchanged and keeps its arguments as given, as the pinned API does.Open PRs:
tools/pr_overlap.pylisted 79 open PRs it could not clear (this PR is one of them), because they edit the same shared files (Export.cpp,InventoryExports.hpp, the debt file). I searched open PR titles forSecurityOrigin; no other PR implements these exports.Tested
Windows 11, MinGW-W64 g++ with Ninja, commit e0f14b1f31.
ctest --test-dir build-full -R ^(guest_)?nkwebkit_ -j4python3 tools/check_conventions.py --base origin/mainI changed 20 added conditions one at a time and the new test failed on all 20.
Not verified: the rest of the repository's tests, the Linux build and behaviour on a console. My local run of the wider suite flagged unrelated tests with
basein their names as not run; I did not run those or measure them onmain.Not covered by a test: the registered no-access scheme stays registered until the process exits (there is no unregister export), so the test that registers
httpruns last.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T04:45:43Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix invalid database identifiers being accepted as valid origins.
What I ran
1c2104bb72b105cb2966d3c862c844849914d847using the prepared diff and the pinned repository reader (repo_read.py).Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/URL.cpp:563accepts a database identifier whose port starts with digits but then contains junk.ParseUInt16AllowingTrailingJunkreturns the numeric prefix, so inputs such ashttp_host_80junkproduce a non-null origin instead of being rejected. This conflicts with the description’s stated behavior that unparsable ports return null, and the parser’s name indicates trailing junk is deliberately tolerated, but its return value does not distinguish that case from a valid port. Preserve the target behavior only if confirmed from the pinned source; otherwise reject the whole port suffix when parsing identifiers.Non-blocking
None.
Not verified
Export.cpp,InventoryExports.hpp, anddocs/dev/debt/libSceNKWebKit.mdwas excluded from the review folder.Export.cppandInventoryExports.hppchanges are shown in the diff; the debt-file change is shown in the diff. Other excluded full-file content was not read.description.md,commits.md,manifest.json,diff.patch,MimeExports.hpp,WebKitValueExports.hpp,Mime.cpp,URL.cpp, andTypes.hpp.To get this to a good state
Reject identifier port suffixes with trailing non-whitespace junk, and add a regression case such as
http_host_80junkexpecting null. Re-run the focused NKWebKit tests on the new head.Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T15:23:18Z.
Review: CHANGES_REQUESTED
Reviewed exact head
1c2104bb72b105cb2966d3c862c844849914d847. First, one existing concern can be retired: the pinned database-identifier parser deliberately usesparseIntegerAllowingTrailingJunk<uint16_t>, so the submitted80abc/8080abcexpectations are correct. A URL such ashttps://host:443junkremains a separate invalid-URL case.I found two remaining issues:
IsUnicodeCompatibleASCIIWhitespaceomits vertical tab (U+000B), although pinned WTF includes it.http_host_\v8080tailmust parse port 8080; the exact PR helper returned null. In a native A/B using the exact export bodies and repo object types, adding onlyc == u'\v'changed the fixture from exit 1 to exit 0 while overflow/no-digit cases remained rejected.WKSecurityOriginCreateFromStringuses a separate parser that rejects valid canonical IPv4, bracketed IPv6, and ASCII percent escapes in hosts (for example%65xample.test). Currentmainalready has the shared WTF URL/SecurityOrigin pipeline for these cases. Please route this export through that implementation rather than maintaining a second parser. Unicode andxn--hosts can remain explicitly limited until the common UTS46 work in #19562 lands; IPv4, IPv6 and ASCII host escapes are independent of that dependency.MinGW GCC 15.2 accepted the exact
URL.cppand all three export signatures with the declared Windows guest ABI. The runtime fixture used host calling convention only for native exception unwinding and an inert no-access test double; no console path was run. Hosted Windows built and passednkwebkit_baseandnkwebkit_securityoriginon this head, but its cases do not cover the two findings above.AI-assisted: yes
Pull request closed