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.
Overview
This PR adds error message sanitization to the
ErrorHandlerclass to prevent Wave from exposing internal implementation details, class names, and stack traces in API error responses.What Changed
1. Added
sanitizeErrorMessage()MethodAdded a new private static method that removes sensitive internal details from error messages:
2. Updated Error Handling Logic
Modified the
handle()method to:3. Comprehensive Test Coverage
Created
ErrorHandlerTest.groovywith 9 test cases covering:Before/After Examples
Failed to convert argument [packages] for value [INVALID] due to: Cannot deserialize value of type 'io.seqera.wave.api.PackagesSpec$Type' from String "INVALID"Invalid value "INVALID"Cannot deserialize value of type 'io.seqera.wave.api.PackagesSpec$Type' at [Source: (String)"..."; line: 1, column: 24]Cannot deserialize value of type the specified typeInvalid type (through reference chain: io.seqera.wave.api.ContainerRequest["packages"]->io.seqera.wave.api.PackagesSpec["type"])Invalid typenullor emptyInvalid requestSecurity Improvement
Before: API clients received error messages containing:
io.seqera.wave.api.*)PackagesSpec$Type)After: API clients receive clean, user-friendly error messages: