Skip to content

Add authorization check and input sanitization to TaskLogHandler#5237

Open
TristanInSec wants to merge 1 commit intogoogle:masterfrom
TristanInSec:fix-task-log-handler-auth
Open

Add authorization check and input sanitization to TaskLogHandler#5237
TristanInSec wants to merge 1 commit intogoogle:masterfrom
TristanInSec:fix-task-log-handler-auth

Conversation

@TristanInSec
Copy link
Copy Markdown

Summary

TaskLogHandler at /testcase-detail/task-log is missing the authorization checks that all other handlers in the same file enforce. This patch:

  • Adds 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 in show.py
  • Sanitizes task_id and task_name query parameters before interpolating them into Cloud Logging filter strings to prevent filter injection

Changes

show.py — Call access.check_access_and_get_testcase() in TaskLogHandler.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.

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.
@TristanInSec TristanInSec requested a review from a team as a code owner April 7, 2026 16:12
@decoNR
Copy link
Copy Markdown
Contributor

decoNR commented Apr 7, 2026

Hi @TristanInSec, LGTM, thank you for your contribution. I will perform some tests to ensure these changes do not break anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants