-
Notifications
You must be signed in to change notification settings - Fork 5
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
FI-2728: Prevent Test Runner from Crashing When Validator Response Contains Bad Characters #518
Conversation
Signed-off-by: Vanessa Fotso <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #518 +/- ##
==========================================
+ Coverage 79.65% 79.66% +0.01%
==========================================
Files 249 249
Lines 13177 13179 +2
Branches 1289 1283 -6
==========================================
+ Hits 10496 10499 +3
+ Misses 1932 1931 -1
Partials 749 749
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I was able to reproduce the issue while testing this. The ticket says "bad characters" but I think the only real culprit is the null character. Using mockoon I wasn't able to get a realistic response containing the null character, but I was able to get *a* response containing the null character, and that produced the same problem as Steve originally reported on the bulk data test kit PR a while back: the test runner hits an exception in SQLite and then the UI spins forever. Can you try again with a response specifically containing a null character? I was able to get a null character to paste with the (mac) terminal command echo "\u0000" | pbcopy
.
end | ||
operation_outcome_from_hl7_wrapped_response(JSON.parse(response.body)) | ||
rescue JSON::ParserError | ||
runnable.add_message('error', "Validator Response: HTTP #{response.status}\n#{response.body}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this runnable gets persisted to the DB, I think this might be where the change to handle null characters will need to be.
Co-authored-by: Dylan Hall <[email protected]>
Thanks! that helped. |
Signed-off-by: Vanessa Fotso <[email protected]>
Signed-off-by: Vanessa Fotso <[email protected]>
Signed-off-by: Vanessa Fotso <[email protected]>
Signed-off-by: Vanessa Fotso <[email protected]>
Signed-off-by: Vanessa Fotso <[email protected]>
'Validator response was an unexpected format. ' \ | ||
'Review Messages tab or validator service logs for more information.' | ||
end | ||
# Sanitize the response body by removing non-printable/control characters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of the comment and make a method called remove_invalid_characters
or something like that.
…ethod Signed-off-by: Vanessa Fotso <[email protected]>
Summary
Ticket Description: We saw an issue where a validator response contained a null character and it crashed the test runner, so it kept spinning forever. Since we don't control the validator and especially the tx server, make sure an unexpected response doesn't crash anything.
I was able to reproduce the issue by mocking the validator service with various unexpected response formats, including non-printable/control characters, which led to crashes when the test runner attempted to persist the response. By using Mockoon to simulate these edge cases, I confirmed that the issue was specifically related to non-printable characters in the response body, which caused SQLite exceptions during persistence.
Changes Made: