Skip to content

Rename rapidjson helper functions #114017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GrabYourPitchforks
Copy link
Member

Since rapidjson is a disallowed deserializer within Microsoft, signing off on .NET 10 will require us to attest that every call site into rapidjson processes only fully trusted input.

This is straightforward enough for a point-in-time assessment, but it does represent ongoing cost, and we don't want to risk introducing new call sites into this logic where we can't guarantee that the input is trustworthy. To facilitate this, I recommend renaming our rapidjson wrapping utility methods to parse_fully_trusted_raw_data and parse_fully_trusted_file, which clearly indicate at the invocation site that the caller passes only fully trustworthy data. This should reduce the risk of us violating the trust contract going forward and should simplify future attestations.

(Jeff, this is what I pinged you about via IM.)

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (7)
  • src/native/corehost/comhost/clsidmap.cpp: Language not supported
  • src/native/corehost/fxr/sdk_resolver.cpp: Language not supported
  • src/native/corehost/fxr/standalone/hostpolicy_resolver.cpp: Language not supported
  • src/native/corehost/hostpolicy/deps_format.cpp: Language not supported
  • src/native/corehost/json_parser.cpp: Language not supported
  • src/native/corehost/json_parser.h: Language not supported
  • src/native/corehost/runtime_config.cpp: Language not supported

Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@GrabYourPitchforks
Copy link
Member Author

Rebased on latest main to resolve merge conflicts.

@am11
Copy link
Member

am11 commented Mar 28, 2025

We could also consider switching to https://github.com/simdjson/simdjson.

@am11
Copy link
Member

am11 commented Mar 29, 2025

FWIW, here is the initial impl. main...am11:runtime:feature/corehost/simdjson (windows would require UTF-16/8 conversion as happens with rapidjson's non-insitu mode behind the scenes)

It's a size regression (which I'm not sure matters in read-world with corehost variants):

File Before (bytes) After (bytes) Change (KB) %
linux/arm64 corehost/libhostfxr.so 286,600 329,256 +42 KB 14.88%
linux/arm64 corehost/libhostpolicy.so 291,896 323,256 +31 KB 10.71%
linux/arm64 corehost/singlefilehost 11,235,480 11,267,664 +32 KB 0.29%
mac/arm64 corehost/libhostfxr.dylib 388,464 438,176 +49 KB 12.82%
mac/arm64 corehost/libhostpolicy.dylib 403,968 414,448 +10 KB 2.59%
mac/arm64 corehost/singlefilehost 10,708,160 10,718,448 +10 KB 0.10%

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.

2 participants