Skip to content

Sanitize metric and resource names in error responses - #1232

Merged
sophieliu15 merged 1 commit into
GoogleCloudPlatform:masterfrom
sophieliu15:fix-b-511329898
Jul 27, 2026
Merged

Sanitize metric and resource names in error responses#1232
sophieliu15 merged 1 commit into
GoogleCloudPlatform:masterfrom
sophieliu15:fix-b-511329898

Conversation

@sophieliu15

Copy link
Copy Markdown
Member

Escape metricName and resourceName using %q format specifiers in error messages within pkg/adapter/translator/errors.go to prevent Reflected Cross-Site Scripting (XSS). Add unit tests in errors_test.go verifying that metric and resource names containing script/HTML tags are safely quoted in status error messages.

@sophieliu15
sophieliu15 requested a review from laoj2 July 23, 2026 15:07
Comment thread custom-metrics-stackdriver-adapter/pkg/adapter/translator/errors.go Outdated
Escape metricName and resourceName using %q format specifiers in error messages within pkg/adapter/translator/errors.go to prevent Reflected Cross-Site Scripting (XSS). Add unit tests in errors_test.go verifying that metric and resource names containing script/HTML tags are safely quoted in status error messages.
@sophieliu15
sophieliu15 requested a review from laoj2 July 27, 2026 13:46
@sophieliu15
sophieliu15 merged commit 9481b66 into GoogleCloudPlatform:master Jul 27, 2026
19 checks passed
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.

2 participants