-
Notifications
You must be signed in to change notification settings - Fork 143
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
update the response code to 404 when deleting a memory that is not al… #2212
Conversation
…lowed to access Signed-off-by: Xun Zhang <xunzh@amazon.com>
@@ -325,7 +327,14 @@ public void deleteConversation(String conversationId, ActionListener<Boolean> li | |||
}, listener::onFailure); | |||
|
|||
} else { | |||
listener.onResponse(false); | |||
log.error("No access to delete the memory for " + conversationId); |
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.
From reading the code it seems like when we don't have have access to that conversation we mark this as "Resource not found exception".
Is that the correct understanding? If yes, that doesn't seem quite right.
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.
The Olly chatbot pen tester thinks that UNAUTHORIZED(401) would suggests the user that the memory id at least exists, which is considered as leaking information. So returning "Not Found"(404) is a better option because it only indicates that you cannot find 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 see, makes sense. Can we add a comment in the code then? So that later we don't find it confusing again?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2212 +/- ##
============================================
- Coverage 81.91% 81.89% -0.02%
+ Complexity 5719 5718 -1
============================================
Files 547 547
Lines 23064 23066 +2
Branches 2378 2378
============================================
- Hits 18892 18891 -1
- Misses 3227 3230 +3
Partials 945 945
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…lowed to access
Description
Return 404 not found when deleting a memory that is not allowed to access. Previously it returned only "success": "false"
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.