Skip to content

fix(libSceUserService): validate user in sceUserServiceGetPlatformPrivacyWs1 - #11071

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
slopgobblercobbler:fix/userservice-platform-privacy-validation
Oct 28, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
slopgobblercobbler:fix/userservice-platform-privacy-validation

Conversation

@slopgobblercobbler

@slopgobblercobbler slopgobblercobbler commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What

Validates the requested user ID in sceUserServiceGetPlatformPrivacyWs1 rather than discarding it with (void)user_id. When the user is not logged in (!IsUserLoggedIn(user_id)), returns USER_SERVICE_ERROR_NOT_LOGGED_IN (0x80960009), matching console error behavior and the existing pattern across libSceUserService. When logged in, returns USER_SERVICE_ERROR_INVALID_ARGUMENT if value == nullptr and sets *value = 0 returning USER_SERVICE_OK otherwise. Adds unit test coverage in core/libs/tests/GuestUserService.cpp and documents the implementation assumption and unmeasured console behavior in docs/dev/debt/libSceUserService.md.

Tested

  • Tested locally on Windows 11 with Clang C++20.
  • Unit test suite GuestUserService.cpp passes all assertions.
  • Verified python tools/check_conventions.py --base upstream/main --head HEAD passes cleanly with 0 findings.

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

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description currently ends mid-sentence in the What section (...USER_SERVICE_ERROR_NOT_LOGGED_IN (), and the conventions check reports both Tested and Checklist missing. Please complete the description using the repository template, including the test command/results and all required checklist fields. The build workflow skips the feature test targets for this path, so the description should distinguish any local checks from hosted checks.

@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

Completed the PR description using the repository template, detailing the local Windows unit test coverage (distinguished from skipped hosted checks) and checking off all required checklist items.

@MarcZX10

Copy link
Copy Markdown
Contributor

Thanks. I checked the live PR body after that note: it is still 234 characters and ends at return USER_SERVICE_ERROR_NOT_LOGGED_IN (; it contains only the What section, so the two conventions failures remain applicable. Please edit the PR description itself (not only add a comment) with the completed template. I will recheck the body and rerun its conventions status after the edit.

@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Updated the PR description via \gh pr edit\ with the complete repository template and checklist.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 2c4cb267546fe243cbb4335f89c2ad167ab27b06. The new guard matches the existing sceUserServiceGetAgeLevel behavior: reject a non-logged-in user before checking/writing the output, then return the default zero value for a logged-in user. The added cases check that outputs remain untouched on the not-logged-in path and that null-output precedence is consistent. The author reports the focused GuestUserService suite passing on Windows; I did not rerun that C++ suite locally. The latest hosted conventions check passes; feature test jobs are path-skipped.

@MarcZX10

Copy link
Copy Markdown
Contributor

Thanks for completing the description. One small cleanup: the live body appears to contain literal backslashes around identifiers (for example \sceUserServiceGetPlatformPrivacyWs1\) and ^Kalue == nullptr where it describes the output check. Could you correct those to normal Markdown/code formatting and value == nullptr so the summary accurately matches the implementation? The latest conventions check passes; this is a readability/accuracy note.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 9345 core/libs/prx/libSceUserService/Export.cpp

@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

Thanks @MarcZX10! Cleaned up the description formatting (removed accidental escapes and control characters). All checklist items and test details are now cleanly formatted.

@wachi35676

Copy link
Copy Markdown
Contributor

Tested head 2c4cb26754 merged onto main acb900c194, Windows 11 (WinLibs GCC 15.2.0, Release) and WSL2 Ubuntu 24.04 (GCC 13.3), BUILD_TESTING=ON. This adds the Linux run.

  • guest_user_service passes 3 of 3 runs on both hosts. With libSceUserService/Export.cpp from main and the test kept, it fails on both.
  • fix(libSceUserService): validate user login status in sceUserServiceGetGamePresets #11087 edits the same two files. The two heads merge cleanly, and guest_user_service passes 3 of 3 on Windows with both on main.
  • The new debt line says "A user who is not logged in returns 0x80960009 with or without an output." For this call that comes from sceUserServiceGetAgeLevel's measured order, not from a measurement of GetPlatformPrivacyWs1. Saying so would keep the entry accurate.

AI-assisted: yes (Claude Code); results above were run on this machine.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@slopgobblercobbler Thanks, the logic and tests look right. One small thing: the new body of sceUserServiceGetPlatformPrivacyWs1 is indented with one space, while the rest of Export.cpp uses four. Could you re-indent it? Then it's ready.

@slopgobblercobbler
slopgobblercobbler force-pushed the fix/userservice-platform-privacy-validation branch from 2c4cb26 to ff5da44 Compare October 27, 2026 15:52
@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Re-indented the body of sceUserServiceGetPlatformPrivacyWs1 to use clean 4-space indentation matching the rest of Export.cpp, updated the technical debt entry per review notes, rebased cleanly onto latest upstream/main (e0cd1259a), and verified with tools/check_conventions.py --base upstream/main --head HEAD (0 findings). Thank you!

@oneandonlydean
oneandonlydean merged commit 4484502 into boykopovar:main Oct 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants