Skip to content

ci: disable two over-broad Semgrep registry rules with replacement coverage#291

Merged
Cre-eD merged 3 commits into
mainfrom
chore/semgrep-disable-noisy-registry-rules
May 24, 2026
Merged

ci: disable two over-broad Semgrep registry rules with replacement coverage#291
Cre-eD merged 3 commits into
mainfrom
chore/semgrep-disable-noisy-registry-rules

Conversation

@Cre-eD

@Cre-eD Cre-eD commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Cuts the 10 Semgrep WARNING findings the job has been posting on every PR (and on #289) by disabling two registry-pack rules whose threat models don't apply to SC code. Reachability-aware replacement coverage ships in actions#23.

Findings being silenced

All 10 are pre-existing intentional patterns:

MD5-as-fingerprint (7)use-of-md5 fires on every md5.Sum() regardless of context. SC call sites are:

File Use
pkg/clouds/pulumi/aws/static_website.go:166 upload-bundle checksum (S3 etag-style)
pkg/clouds/pulumi/gcp/bucket_uploader.go:55 upload-bundle checksum (S3 etag-style)
pkg/clouds/pulumi/gcp/gke_autopilot_stack.go:243,251, pkg/clouds/pulumi/kubernetes/kube_run.go:225,233 K8s annotation hash for Caddy restart trigger
pkg/clouds/pulumi/cloudflare/registrar.go:71 dedup suffix for Pulumi resource names on duplicate-name DNS records

yaml-into-interface{} (3)unsafe-deserialization-interface is calibrated to Python pickle/yaml.load (executes on unmarshal). Go's yaml.v3 / encoding/json don't execute. SC call sites:

File Use
pkg/assistant/chat/commands_project.go:943 obfuscate embedded YAML credentials before logging
pkg/assistant/security/secure_file_reader.go:93,339 redact secrets in user YAML before logging

The SC team already documented this exact reasoning in go-canon.yml round-6 triage, where they dropped their own equivalent yaml-unmarshal rule.

What still catches the real threats

Disabling these two rules does NOT lose coverage; the genuine patterns are caught by narrower rules in go-canon.yml:

  • MD5 in real crypto context — new go-md5-in-crypto-context rule (actions#23) fires on hmac.New(md5.New, ...) and on md5 result assigned to a variable named mac / hmac / signature / tag / auth / token / password / digest.
  • Untrusted-source → unmarshal → exec — taint-aware coverage in p/golang registry pack remains enabled. Only the generic shape-only rule is disabled.

Dependencies

Pinned to a branch SHA on actions. The reusable-workflow ref currently points at 2a7604ddac4fd9f912a1ab6896ac87c5b07bc537 (the head of actions#23). Before merging this PR, bump the pin to the main-merge SHA that actions#23 produces.

Test plan

  • actions#23 merges and CI is green
  • Bump reusable-workflow SHA pin to actions main-merge commit
  • CI re-run: Semgrep posts 0 WARNING findings
  • Spot-check: go-md5-in-crypto-context still fires if someone writes hmac.New(md5.New, key) — verified in actions#23 fixtures (8 new cases)

…verage

Cuts the 10 WARNING findings the Semgrep job posts on every PR by
disabling two registry rules whose threat models don't apply to SC
code. Reachability-aware replacement coverage lives in the shared
`go-canon.yml` ruleset:

  - `go.lang.security.audit.crypto.use_of_weak_crypto.use-of-md5`:
    fires on every md5.Sum() regardless of context. All 7 SC call
    sites are non-cryptographic fingerprints (S3-etag-style upload
    checksums, K8s annotation change-hashes, dedup suffix for Pulumi
    resource names on duplicate-name DNS records). Real MD5-in-crypto
    use is now caught by the narrower `go-md5-in-crypto-context`
    rule shipped in actions#23.

  - `go.lang.security.deserialization.unsafe-deserialization-interface
    .go-unsafe-deserialization-interface`: calibrated to Python
    pickle/yaml.load (which executes code on unmarshal). Go's yaml.v3
    and encoding/json do not execute on unmarshal; threat model
    doesn't transfer. The 3 SC call sites are credential
    obfuscators (commands_project.go, secure_file_reader.go) that
    walk untyped YAML specifically to redact secrets BEFORE logging.

Bumps the SC actions reusable-workflow pin to the head commit of
chore/semgrep-disable-rules-and-md5-refinement (actions#23, which
adds the `disabled-rules` input). Pin must be bumped to the
main-merge SHA before this PR merges.

Signed-off-by: Dmitrii Creed <creeed22@gmail.com>
@Cre-eD
Cre-eD requested a review from smecsia as a code owner May 24, 2026 15:52
@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown

Semgrep Scan Results

Repository: api | Commit: 4e79003

Check Status Details
✅ Semgrep Pass 0 total findings (no error/warning)

Scanned at 2026-05-24 16:40 UTC

@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown

Security Scan Results

Repository: api | Commit: 4e79003

Check Status Details
✅ Secret Scan Pass No secrets detected
✅ Dependencies (Trivy) Pass 0 total (no critical/high)
✅ Dependencies (Grype) Pass 0 total (no critical/high)
📦 SBOM Generated 528 components (CycloneDX)

Scanned at 2026-05-24 16:41 UTC

@Cre-eD
Cre-eD merged commit 7c1f578 into main May 24, 2026
21 checks passed
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