-
Notifications
You must be signed in to change notification settings - Fork 159
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
Reject FHIR resources with control chars #2605 #2820
Conversation
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
fhir-model/src/main/java/com/ibm/fhir/model/util/ValidationSupport.java
Outdated
Show resolved
Hide resolved
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.
I think we need to compare performance.
I've updated the issue with my feedback. #2605 (comment) I have some optimizations that I've made to StringFormat usage for the error message assembly, that speeds processing up. The changes are captured in the comparision of the Original,Set,Byte/Integer check. All my tests were are the latest adoptopenjdk 11 |
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
included as a reply in the original issue and as noted above. |
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.
even at 30% and slower, I don't think this method will even register against the total time to parse a resource
I approved, but I don't think it addresses the "add a ModelConfig option to make this a warning instead of an error" part of the issue yet: #2605 (comment) Let me know if I just missed it, or if you're thinking to do a followup PR for that part. |
I was layering this as two separate changes to discuss; I plan to add the ModelConfig change with this PR. |
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
Implemented, waiting on ci/cd |
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.
LGTM
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
Originally I started off at the fhir-server module, and wrote a ReadInterceptor with a ReadableByteChannel which scanned for 1,2,3,4 byte sequences with forbidden bytes. It's a bit more complicated as they can be encoded as entity values or escaped unicode and not in the natural bytes.
I ended up taking those tests and pushing the tests down into fhir-model along with a test case from @lmsurpre and hardened ValidationSupport to check for Unicode characters which are forbidden.
The key changes are in ValidationSupport.
Signed-off-by: Paul Bastide pbastide@us.ibm.com