Skip to content

Commit cb600c4

Browse files
ci: add gitleaks secrets scanning on PRs [SVLS-8660]
- Add secrets-scan workflow triggered on PR and push to main - Pin gitleaks-action to SHA (v2.3.9) - Add .gitleaks.toml with documented allowlist structure for paths, regexes, and commits with maintenance guidance Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent faba926 commit cb600c4

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/workflows/secrets-scan.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Secrets Scan
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
gitleaks:
11+
name: Secrets Scan
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Run gitleaks
19+
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitleaks.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
title = "datadog-lambda-extension gitleaks config"
2+
3+
# This file configures gitleaks to suppress known false positives.
4+
# Only add entries here after confirming a finding is NOT a real secret.
5+
# If a real secret is found: rotate it immediately, then add the commit to [allowlist.commits].
6+
#
7+
# Maintenance workflow:
8+
# 1. gitleaks flags something on a PR
9+
# 2. Review the finding — is it a real secret or a false positive?
10+
# 3. Real secret → rotate immediately, fix the code, optionally add the commit hash below
11+
# 4. False positive → add the appropriate entry below with a comment explaining why
12+
13+
[allowlist]
14+
description = "Known false positives"
15+
16+
# paths: skip entire directories or files from scanning.
17+
# Use when a directory contains third-party code or test fixtures with fake data.
18+
# Examples:
19+
# "integration-tests/node_modules" — npm dependencies, not our code
20+
# "bottlecap/tests/fixtures" — test payloads with placeholder values
21+
# "docs/examples" — documentation examples with fake keys
22+
paths = [
23+
# npm dependencies bundled under integration-tests — not our code, would be noisy
24+
"integration-tests/node_modules",
25+
]
26+
27+
# regexes: suppress findings whose matched secret value matches one of these patterns.
28+
# Use for placeholder/example values that appear in source or docs but are not real secrets.
29+
# Examples:
30+
# '''your-api-key''' — generic placeholder in docs or scripts
31+
# '''my_test_key''' — unit test placeholder (bottlecap/tests/)
32+
# '''AKIAIOSFODNN7EXAMPLE''' — AWS example key from official AWS documentation
33+
# '''DD_API_KEY_EXAMPLE''' — Datadog placeholder used in README examples
34+
regexes = []
35+
36+
# commits: suppress all findings from a specific historical commit.
37+
# Use when a commit contained a now-rotated credential that cannot be rewritten
38+
# (e.g., it is already on the default branch or in a public tag).
39+
# Always document why the commit is suppressed and confirm the credential was rotated.
40+
# Examples:
41+
# "abc123def456" — rotated DD_API_KEY accidentally committed on 2024-01-15, key invalidated
42+
commits = []

0 commit comments

Comments
 (0)