Skip to content

Sanitize metric and resource names in error responses#1232

Open
sophieliu15 wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
sophieliu15:fix-b-511329898
Open

Sanitize metric and resource names in error responses#1232
sophieliu15 wants to merge 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.
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