Skip to content

Commit d688340

Browse files
authored
ci(codeql): honor alert suppression comments (#3745)
1 parent 753c3d5 commit d688340

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎.github/workflows/codeql.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ jobs:
6666
uses: github/codeql-action/init@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8
6767
with:
6868
languages: ${{ matrix.language }}
69+
# The alert suppression query marks the alerts that a `// codeql[<query-id>]`
70+
# comment covers with a SARIF suppressions field. The default queries still run.
71+
packs: codeql/go-queries:AlertSuppression.ql
6972

7073
- name: Autobuild
7174
uses: github/codeql-action/autobuild@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8

‎app/controlplane/internal/service/casredirect.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,5 +308,6 @@ func (s *CASRedirectService) setDownloadVerifierCookie(w http.ResponseWriter, fl
308308
cookie.MaxAge = -1
309309
cookie.Expires = time.Unix(1, 0)
310310
}
311+
// codeql[go/cookie-secure-not-set] Secure is true, and false only in development mode.
311312
http.SetCookie(w, cookie)
312313
}

‎internal/redaction/redaction.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ func (w *rewriter) redactLeaf(s, path string) string {
597597
w.count += n
598598

599599
var out string
600+
// codeql[go/unsafe-quoting] body is escaped by encodeStringBody, and the sink is a JSON decode.
600601
if err := json.Unmarshal([]byte(`"`+body+`"`), &out); err != nil {
601602
// A replacement cut through a JSON escape sequence. Drop the whole leaf
602603
// rather than risk leaving part of the secret behind.

0 commit comments

Comments
 (0)