-
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
Unify approach for creating operation outcome issues across the codebase #2596
Labels
Comments
lmsurpre
added a commit
that referenced
this issue
Aug 3, 2021
Instead of ensuring that every string field is encoded for HTML (the previous approach for this PR), I reverted back to the original code which only encodes OperationOutcome.Issue.diagnostics. The plan is to more selectively encode specific fields that are known to contain user-provided content (#2596). Once that is done, I think we should remove the logic that encodes all of the diagnostic strings. Additionally, since we no longer encode the whole thing, I added Encode.forHtml back to the buildUnsupportedResourceTypeException helpers (but just around the user-provided portion of the error message). Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
lmsurpre
added a commit
that referenced
this issue
Aug 3, 2021
Instead of ensuring that every string field is encoded for HTML (the previous approach for this PR), I reverted back to the original code which only encodes OperationOutcome.Issue.diagnostics. The plan is to more selectively encode specific fields that are known to contain user-provided content (#2596). Once that is done, I think we should remove the logic that encodes all of the diagnostic strings. Additionally, since we no longer encode the whole thing, I added Encode.forHtml back to the buildUnsupportedResourceTypeException helpers (but just around the user-provided portion of the error message). Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
lmsurpre
added a commit
that referenced
this issue
Aug 17, 2021
… in AbstractOperation (#2594) * Introduce EncodingVisitor and use it to encode OperationOutcome for HTML Previously, we had logic to encode the "diagnostic" element. However, each place that populated issues with details needed its own encoding. With this change, we can encode all fields in the OperationOutcome consistently and perhaps the new visitor could be useful in some other contexts as well. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com> * Remove resource type checking from AbstractOperation Now that we ensure that the resource type is valid prior to invoking the operation, there's no need for having this check in AbstractOperation and therefor also no need to have the PROPNAME_PATH_PARAMETER in the OperationContext Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com> * Revert the change to FHIRResource.exceptionResponse Instead of ensuring that every string field is encoded for HTML (the previous approach for this PR), I reverted back to the original code which only encodes OperationOutcome.Issue.diagnostics. The plan is to more selectively encode specific fields that are known to contain user-provided content (#2596). Once that is done, I think we should remove the logic that encodes all of the diagnostic strings. Additionally, since we no longer encode the whole thing, I added Encode.forHtml back to the buildUnsupportedResourceTypeException helpers (but just around the user-provided portion of the error message). Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Team decision: use Encode.forHtml() in all the places where we're reflecting user input back in OperationOutcome issue messages. No separate utility. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are a number of different components across that codebase that generate operation outcome issues for a variety of reasons. I'd like to create a single set of utility methods for creating operation outcome issues (and operation outcome resources) and ensure that all components are using the same set of utilities. We have generally moved in this direction but things are still a bit scattered. These utility methods could took a flag that indicates whether user input is included in the message so that we could selectively encode before returning them to the client. It is a compromise between completely ad hoc approach and an "encode everything" approach.
The text was updated successfully, but these errors were encountered: