-
Notifications
You must be signed in to change notification settings - Fork 157
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
issue #3495 - more selectively scope searches to patient compartment #3498
Conversation
Specifically, avoid adding the implicit compartment parameter(s) when the interaction is covered by one or more tokens with the 'user/' or 'system/' prefix ("context type") Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
fhir-smart/src/main/java/com/ibm/fhir/smart/AuthzPolicyEnforcementPersistenceInterceptor.java
Show resolved
Hide resolved
fhir-smart/src/main/java/com/ibm/fhir/smart/AuthzPolicyEnforcementPersistenceInterceptor.java
Show resolved
Hide resolved
.filter(s -> s.getResourceType() == ResourceType.Value.RESOURCE || s.getResourceType().value().equals(resourceType)) | ||
.filter(s -> hasPermission(s.getPermission(), requiredPermission)) | ||
.findAny(); | ||
|
||
if (resource == null) { | ||
// For `patient` scopes, if no resource was retrieved, which happens with history/search |
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.
what about deleted resources? The resource value will be null for those too
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.
we don't call this from afterDelete
, but we do call it from afterHistory
and so I agree this is worth testing...I'll give it a try and maybe add a test
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.
this wasn't really from this PR, but instead from #3423
however, i confirmed that, with those changes, we now reject a history interaction if any one of the resource versions in the history was a delete...i'll see if i can address that in this PR. if not, i'll open a separate issue for it
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 made some changes to try addressing this one. please have another look
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.
Also in the file, therefor
should be therefore
Also addressed review comments by adding class-level javadoc Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
dbbb102
to
7ad8f13
Compare
This fixes an issue that we introduced with #3423 where we reject history interactions that include one or more DELETE entries in their response bundle (because we cannot check them for patient compartment membership since they contain no resource content). However, now that we reject history interactions that involve patient compartment resource types (unless the approving scope is of type 'user' or 'system'), it should always be safe to ignore the delete entries in the afterHistory call. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
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
Specifically, avoid adding the implicit compartment parameter(s) when
the interaction is allowed by one or more scopes with the 'user/' or
'system/' prefix ("context type")
Signed-off-by: Lee Surprenant lmsurpre@us.ibm.com