Title: False positive in `go/log-injection` · Issue #9016 · github/codeql · GitHub
Open Graph Title: False positive in `go/log-injection` · Issue #9016 · github/codeql
X Title: False positive in `go/log-injection` · Issue #9016 · github/codeql
Description: Description of the false positive 📄 Code snippet CodeQL reports (via GitHub integration) that the following log write receives unsanitized user input: switch eventType := sanitizeUserInput(event.Type); eventType { // ... default: h.logge...
Open Graph Description: Description of the false positive 📄 Code snippet CodeQL reports (via GitHub integration) that the following log write receives unsanitized user input: switch eventType := sanitizeUserInput(event.Ty...
X Description: Description of the false positive 📄 Code snippet CodeQL reports (via GitHub integration) that the following log write receives unsanitized user input: switch eventType := sanitizeUserInput(event.Ty...
Opengraph URL: https://github.com/github/codeql/issues/9016
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False positive in `go/log-injection`","articleBody":"**Description of the false positive**\r\n\r\n📄 [Code snippet](https://github.com/triggermesh/triggermesh/blob/c8ed975ea7d2538ff32c79884d319fc8f408532e/pkg/sources/adapter/slacksource/slack.go#L128-L148)\r\n\r\nCodeQL reports (via [GitHub integration](https://github.com/github/codeql-action)) that the following log write receives unsanitized user input:\r\n\r\n```go\r\nswitch eventType := sanitizeUserInput(event.Type); eventType {\r\n// ...\r\ndefault:\r\n\th.logger.Warn(\"Content not supported: \", strconv.Quote(eventType)) // \u003c-- false positive 'go/log-injection'\r\n}\r\n```\r\n\r\nThis is untrue.\r\nThe user input is explicitly sanitized at the beginning of the switch case (in fact, we fixed it earlier this year thanks to CodeQL! 🙌 ):\r\n\r\n```go\r\nvar newlineToSpace = strings.NewReplacer(\"\\n\", \" \", \"\\r\", \" \")\r\n\r\n// sanitizeUserInput removes unwanted characters from the given string.\r\n// It also guarantees the safe logging of data that potentially originates from\r\n// user input (CWE-117, https://cwe.mitre.org/data/definitions/117.html).\r\nfunc sanitizeUserInput(s string) string {\r\n\treturn newlineToSpace.Replace(s)\r\n}\r\n```","author":{"url":"https://github.com/antoineco","@type":"Person","name":"antoineco"},"datePublished":"2022-05-03T08:33:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/9016/codeql/issues/9016"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4a727bbc-b3f0-989c-1588-d1c5642bdc3a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CF7E:FC316:573951:760C52:696AAC2E |
| html-safe-nonce | 059b9b6ec6b5b5a41980119aa7df1145ac9f00730271b6049dfb4c1637b9e76d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjdFOkZDMzE2OjU3Mzk1MTo3NjBDNTI6Njk2QUFDMkUiLCJ2aXNpdG9yX2lkIjoiMjc5ODAzMDE3ODQ1MTM2OTAwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a155ff4805c6f328fce5e33249b2ee7b6341acd3c63461445b2e8a08fa56bf64 |
| hovercard-subject-tag | issue:1223822385 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/codeql/9016/issue_layout |
| twitter:image | https://opengraph.githubassets.com/51f9c421188d265d48d1cb55ecd40d9893d79a7e859228efb1d7af46243b50a1/github/codeql/issues/9016 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/51f9c421188d265d48d1cb55ecd40d9893d79a7e859228efb1d7af46243b50a1/github/codeql/issues/9016 |
| og:image:alt | Description of the false positive 📄 Code snippet CodeQL reports (via GitHub integration) that the following log write receives unsanitized user input: switch eventType := sanitizeUserInput(event.Ty... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | antoineco |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3eaf9b8cf1badcd7041a8ad480b9d9b28bea0ef1cc821ca9ff20f2cc7f4fe4b9 |
| turbo-cache-control | no-preview |
| go-import | github.com/github/codeql git https://github.com/github/codeql.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 143040428 |
| octolytics-dimension-repository_nwo | github/codeql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143040428 |
| octolytics-dimension-repository_network_root_nwo | github/codeql |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd9a979046e6382bd084e2bd873bf65f797125ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width