libNet: honour the option mask in sceHttpUriBuild #1069

Manually merged
github merged 2 commits from gh-pr/1069/head into gh-pr/1069/base 2026-11-26 09:42:00 +00:00
Owner

@⁠rohit267 on GitHub · 2026-10-05 13:15 UTC · original
rohit267:fix/http-uri-build-option → main · +112 −31 · 2 files · 2 commits · merged 2026-10-05 17:31 UTC

sceHttpUriBuild takes an option mask (SCE_HTTP_URI_BUILD_WITH_*) that selects which components of the SceHttpUriElement go into the output. HttpUriBuild logs it and ignores it, so every call returns the full URL.

Black Myth: Wukong (PPSA23226) calls it with SCHEME only and requires "https://" or "http://" back before it starts an HTTP request. The full URL fails that check, the request starter returns false, and the caller's "run on game thread and wait" helper returns early with its task still queued. The task holds by-reference captures of a stack frame that is already gone, and about 70 seconds into boot the game thread runs it and faults (null read at eboot+0x59662f). I chased this through guest register dumps, a guest breakpoint tracer and the game's own disassembly before finding that the URL check was the trigger.

With the mask honoured, the game gets past that point and reaches its title cinematic and menu.

Changes:

  • HttpUriBuild builds only the components selected by option: SCHEME 0x01, HOSTNAME 0x02, PORT 0x04, PATH 0x08, USERNAME 0x10, PASSWORD 0x20, QUERY 0x40, FRAGMENT 0x80.
  • A mask with none of the eight bits set still means "everything", so callers that never pass a mask behave as before.
  • A scheme-only build returns "https://": the authority marker belongs to the scheme chunk.
  • Port alone is returned bare; with a host it follows a ':'. The '@' appears only when credentials and a host are both present.

Testing:

  • New TestBuildHonoursOption in tests/HttpUriParseTests.cpp covers scheme-only, hostname, port, path, and the 0xff and 0 masks. http_uri_parse passes.
  • Full suite on the base I developed against (db17585): 51 of 52 pass; the one failure, shader_recompiler_compute, fails without this change too.
  • Rebased onto 72e4989: both changed files compile cleanly against current headers. I have not re-run the full suite on 72e4989.
  • Verified end to end in Wukong on Windows with an RTX 4070.
**@⁠rohit267** on GitHub · 2026-10-05 13:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1069) `rohit267:fix/http-uri-build-option` → `main` · +112 −31 · 2 files · 2 commits · merged 2026-10-05 17:31 UTC `sceHttpUriBuild` takes an `option` mask (`SCE_HTTP_URI_BUILD_WITH_*`) that selects which components of the `SceHttpUriElement` go into the output. `HttpUriBuild` logs it and ignores it, so every call returns the full URL. Black Myth: Wukong (PPSA23226) calls it with SCHEME only and requires "https://" or "http://" back before it starts an HTTP request. The full URL fails that check, the request starter returns false, and the caller's "run on game thread and wait" helper returns early with its task still queued. The task holds by-reference captures of a stack frame that is already gone, and about 70 seconds into boot the game thread runs it and faults (null read at eboot+0x59662f). I chased this through guest register dumps, a guest breakpoint tracer and the game's own disassembly before finding that the URL check was the trigger. With the mask honoured, the game gets past that point and reaches its title cinematic and menu. Changes: - `HttpUriBuild` builds only the components selected by `option`: SCHEME 0x01, HOSTNAME 0x02, PORT 0x04, PATH 0x08, USERNAME 0x10, PASSWORD 0x20, QUERY 0x40, FRAGMENT 0x80. - A mask with none of the eight bits set still means "everything", so callers that never pass a mask behave as before. - A scheme-only build returns "https://": the authority marker belongs to the scheme chunk. - Port alone is returned bare; with a host it follows a ':'. The '@' appears only when credentials and a host are both present. Testing: - New `TestBuildHonoursOption` in `tests/HttpUriParseTests.cpp` covers scheme-only, hostname, port, path, and the 0xff and 0 masks. `http_uri_parse` passes. - Full suite on the base I developed against (db17585): 51 of 52 pass; the one failure, `shader_recompiler_compute`, fails without this change too. - Rebased onto 72e4989: both changed files compile cleanly against current headers. I have not re-run the full suite on 72e4989. - Verified end to end in Wukong on Windows with an RTX 4070.
sceHttpUriBuild's `option` argument (SCE_HTTP_URI_BUILD_WITH_*) selects which
components of the SceHttpUriElement end up in the output. HttpUriBuild logged
the value and ignored it, always returning the full URL.

Black Myth: Wukong calls it with SCHEME alone and requires "https://" (or
"http://") back before it starts an HTTP request. The full URL fails that
check, so the request starter returns false. The caller's "run on game thread
and wait" helper then returns early while its task stays queued, still holding
by-reference captures of a stack frame that is already gone. About 70 seconds
into boot the game thread runs that task against the dead stack and faults
(null read at eboot+0x59662f). With the mask honoured the game gets past that
point and reaches its title cinematic and menu.

Bits: SCHEME 0x01, HOSTNAME 0x02, PORT 0x04, PATH 0x08, USERNAME 0x10,
PASSWORD 0x20, QUERY 0x40, FRAGMENT 0x80. A mask with none of the eight bits
set keeps the previous "everything" behaviour for callers that never pass one.
A scheme-only build returns "https://", the authority marker belonging to the
scheme chunk.

Adds TestBuildHonoursOption to http_uri_parse covering scheme-only, hostname,
port, path, and the 0xff / 0 cases.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:41:59 +00:00
github manually merged commit 26d907e7ed into gh-pr/1069/base 2026-11-26 09:42:00 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 13:21 UTC · original

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 508c01aa-de0e-4be6-9c6c-63d9b9199cde
📥 Commits

Reviewing files that changed from the base of the PR and between 72e4989b1e and 6f3930c85d.

📒 Files selected for processing (2)
  • src/libs/libNet.cpp
  • tests/HttpUriParseTests.cpp

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


📝 Walkthrough

Walkthrough

HttpUriBuild now uses the low eight option bits to select URI components. A zero mask selects all components. Scheme-only output for hierarchical URIs includes //; a port without a selected hostname is emitted without a colon. Tests cover individual component bits, combinations, and the full-URL behavior for masks 0 and 0xff.

Suggested reviewers: elijaowo, nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 6f393

The option-mask change is mergeable after normal checks. The full test suite has not been rerun since the rebase.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 6f393

The change is confined to URI construction and does not add network operations or privileges. Risk is limited, but downstream destination and authentication behavior cannot be fully assessed without the guest callers.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated changed exposure is URI text returned through an existing guest-callable function and its caller-provided output memory. The builder itself does not expand network authority. Effects on destinations, authentication, or restored request initiation remain unproven because guest consumers and runtime traces are unavailable.

Trust Boundaries and Controls

  • observed — The changed function remains a text-producing ABI utility, not a destination allowlist or authentication decision point. It selects and concatenates supplied fields; operational HTTP controls are exposed through separate entrypoints.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: sceHttpUriBuild now honors the option mask.
Description check ✅ Passed The description explains the option-mask behavior, the reason for the change, and the reported tests. It is directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 13:21 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1069#issuecomment-5995311372) <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1069?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> Navigate logical layers of code changes, visualize relationships, and explore their blast radius. <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `508c01aa-de0e-4be6-9c6c-63d9b9199cde` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 72e4989b1e1643c9237ba68ae4e3fe77fa489c63 and 6f3930c85d822048dec7ad6fb3c0204342a2d1f0. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/libs/libNet.cpp` * `tests/HttpUriParseTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough `HttpUriBuild` now uses the low eight option bits to select URI components. A zero mask selects all components. Scheme-only output for hierarchical URIs includes `//`; a port without a selected hostname is emitted without a colon. Tests cover individual component bits, combinations, and the full-URL behavior for masks `0` and `0xff`. **Suggested reviewers:** `elijaowo`, `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"6f3930c85d822048dec7ad6fb3c0204342a2d1f0" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `6f393` <!-- final_review_risk_coverage:{"sourceCommitId":"6f3930c85d822048dec7ad6fb3c0204342a2d1f0","coveredCommitId":"6f3930c85d822048dec7ad6fb3c0204342a2d1f0","kind":"reviewed"} --> The option-mask change is mergeable after normal checks. The full test suite has not been rerun since the rebase. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🔵 Low_ · up to `6f393` The change is confined to URI construction and does not add network operations or privileges. Risk is limited, but downstream destination and authentication behavior cannot be fully assessed without the guest callers. **Retained concerns** No architecture-level concerns identified. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The demonstrated changed exposure is URI text returned through an existing guest-callable function and its caller-provided output memory. The builder itself does not expand network authority. Effects on destinations, authentication, or restored request initiation remain unproven because guest consumers and runtime traces are unavailable. **Trust Boundaries and Controls** - _observed_ — The changed function remains a text-producing ABI utility, not a destination allowlist or authentication decision point. It selects and concatenates supplied fields; operational HTTP controls are exposed through separate entrypoints. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly identifies the main change: `sceHttpUriBuild` now honors the option mask. | | Description check | ✅ Passed | The description explains the option-mask behavior, the reason for the change, and the reported tests. It is directly related to the changeset. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1069)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.