Add authorization check and input sanitization to TaskLogHandler#5237
Open
TristanInSec wants to merge 1 commit intogoogle:masterfrom
Open
Add authorization check and input sanitization to TaskLogHandler#5237TristanInSec wants to merge 1 commit intogoogle:masterfrom
TristanInSec wants to merge 1 commit intogoogle:masterfrom
Conversation
Add access.check_access_and_get_testcase() call to TaskLogHandler.get() to enforce per-testcase authorization, consistent with other handlers in the same file. Sanitize task_id and task_name parameters before interpolating into Cloud Logging filter queries to prevent filter injection.
Contributor
|
Hi @TristanInSec, LGTM, thank you for your contribution. I will perform some tests to ensure these changes do not break anything. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TaskLogHandlerat/testcase-detail/task-logis missing the authorization checks that all other handlers in the same file enforce. This patch:access.check_access_and_get_testcase(testcase_id)before serving task logs, consistent with the authorization pattern used by the main testcase detail handler and other endpoints inshow.pytask_idandtask_namequery parameters before interpolating them into Cloud Logging filter strings to prevent filter injectionChanges
show.py— Callaccess.check_access_and_get_testcase()inTaskLogHandler.get()to enforce per-testcase access control.testcase_status_events.py— Add_sanitize_log_filter_value()to strip characters (",\,\n,\r) that could break out of the quoted string context in Cloud Logging filter queries.