fix: replace unwraps on user input with proper error handling#280
Merged
vieiralucas merged 1 commit intomainfrom Apr 12, 2026
Merged
fix: replace unwraps on user input with proper error handling#280vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
- StepFunctions: handle missing StartAt field with InvalidDefinition error - SNS: handle serde_json::to_string failure gracefully in SetTopicAttributes - S3: handle invalid SSE header values in multipart upload initiation - Bedrock: replace bare .unwrap() after map lookups with .expect() documenting the safety invariant (key validated while holding write lock)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parsed["StartAt"].as_str().unwrap()on user-provided JSON now returnsInvalidDefinitionerror instead of panickingserde_json::to_string().unwrap()inSetTopicAttributesnow falls back to original value on serialization failurealgo.parse().unwrap()for SSE headers in multipart upload now silently skips invalid header values.unwrap()calls after map lookups replaced with.expect()documenting the safety invariant (key validated while holding write lock)Test plan
cargo clippy --workspace --all-targets -- -D warningspasses cleancargo fmt --checkpasses cleanSummary by cubic
Replaced unwraps on user-controlled input to prevent panics and return clear errors. Documented safety invariants for internal map lookups in
fakecloud-bedrock.Bug Fixes
fakecloud-stepfunctions: Missing StartAt now returns InvalidDefinition instead of panicking.fakecloud-sns:SetTopicAttributescompacts Policy JSON and falls back to original value if serialization fails.fakecloud-s3: Multipart upload ignores invalid SSE header values instead of inserting invalid headers.Refactors
fakecloud-bedrock: Replaced bare.unwrap()after validated map lookups with.expect(...)and comments explaining the invariant.Written for commit 8da9dfa. Summary will update on new commits.