Skip to content

Commit be9c8cf

Browse files
committed
fix: pin mkdocs-material version, scope docs.yaml permissions, annotate cache key hashing
- Pin mkdocs-material==9.7.6 in docs.yaml and ci.yaml (Scorecard Pinned-Dependencies alert #1) - Move pages/id-token write permissions to deploy job in docs.yaml - Add nolint annotations on SHA256 cache key derivation (not password storage); CodeQL alerts #10 and #11 dismissed as false positives Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 2d97a9f commit be9c8cf

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ jobs:
158158
- name: Install MkDocs
159159
shell: bash -Eeuo pipefail {0}
160160
run: |
161-
python3 -m pip install --user --break-system-packages mkdocs-material
161+
python3 -m pip install --user --break-system-packages mkdocs-material==9.7.6
162162
echo "$(python3 -m site --user-base)/bin" >> "$GITHUB_PATH"
163163
164164
- name: Build docs site

.github/workflows/docs.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ on:
1212

1313
permissions:
1414
contents: read
15-
pages: write
16-
id-token: write
1715

1816
concurrency:
1917
group: docs
@@ -29,7 +27,7 @@ jobs:
2927

3028
- name: Install MkDocs
3129
run: |
32-
python3 -m pip install --user --break-system-packages mkdocs-material
30+
python3 -m pip install --user --break-system-packages mkdocs-material==9.7.6
3331
echo "$(python3 -m site --user-base)/bin" >> "$GITHUB_PATH"
3432
3533
- name: Build site
@@ -45,6 +43,9 @@ jobs:
4543
needs: build
4644
runs-on: ${{ vars.RUNNER || 'ubuntu-latest' }}
4745
timeout-minutes: 5
46+
permissions:
47+
pages: write
48+
id-token: write
4849
environment:
4950
name: github-pages
5051
url: ${{ steps.deployment.outputs.page_url }}

internal/controller/prometheus.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func collectorCacheKey(config *attunev1alpha1.PrometheusConfig, opts *rsmetrics.
181181
}
182182
key := collectorConfigPrefix(config.Address, headers, tlsConfig)
183183
if opts != nil && opts.BearerToken != "" {
184-
sum := sha256.Sum256([]byte(opts.BearerToken))
184+
sum := sha256.Sum256([]byte(opts.BearerToken)) //nolint:gosec // cache key derivation, not password storage
185185
key += fmt.Sprintf("|bearer:%x", sum[:8])
186186
}
187187
if opts != nil && len(opts.QueryParameters) > 0 {
@@ -557,7 +557,7 @@ func (r *AttunePolicyReconciler) resolveDatadogCollector(ctx context.Context, po
557557

558558
// Cache the collector keyed by site + API key hash, with full
559559
// TTL eviction, capacity bound, and race-safe LoadOrStore.
560-
cacheKey := fmt.Sprintf("datadog:%s|%x", site, sha256.Sum256([]byte(apiKey)))
560+
cacheKey := fmt.Sprintf("datadog:%s|%x", site, sha256.Sum256([]byte(apiKey))) //nolint:gosec // cache key derivation, not password storage
561561
collector, err := r.getOrCreateCollectorByKey(cacheKey, "datadog:"+site, func() (rsmetrics.MetricsCollector, error) {
562562
inner := rsmetrics.NewDatadogCollector(site, apiKey, appKey, log.FromContext(ctx).WithName("datadog"))
563563
// Datadog: 300 requests/hour => ~0.08 QPS; burst of 3 for concurrent queries.

0 commit comments

Comments
 (0)