Skip to content
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

During JSON parsing, validate @type to be minimally valid. #1742

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

thomasvl
Copy link
Collaborator

@thomasvl thomasvl commented Jan 7, 2025

Upstream added a recent conformance test to ensure things fail for an empty @type or one that doesn't have atleast a single slash. This updates the library to do that validations during parsing from JSON only.

The change for this enforcement is pretty small (just the code in Sources/SwiftProtobuf/AnyMessageStorage.swift). The rest is to add a new error in the new SwiftProtobufError approach and then to update all of the apis to document that there are an additional type of error that could be throw.

Upstream added a recent conformance test to ensure things fail for an empty
`@type` or one that doesn't have atleast a single slash. This updates the
library to do that validations during parsing from JSON *only*.

The change for this enforcement is pretty small (just the code in
Sources/SwiftProtobuf/AnyMessageStorage.swift). The rest is to add a new error
in the new SwiftProtobufError approach and then to update all of the apis to
document that there are an additional type of error that could be throw.
@thomasvl thomasvl marked this pull request as ready for review January 7, 2025 18:47
Copy link
Collaborator

@tbkka tbkka left a comment

Choose a reason for hiding this comment

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

Looks great!

@thomasvl thomasvl merged commit e876103 into apple:main Jan 8, 2025
12 checks passed
@thomasvl thomasvl deleted the fix_conformance branch January 8, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants