Skip to content

test(enrichment): unit coverage for the IaC-misconfig analyzer pure scanner - #3279

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jaso0n0818:test/iac-misconfig-rules-2096
Jul 5, 2026
Merged

test(enrichment): unit coverage for the IaC-misconfig analyzer pure scanner#3279
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jaso0n0818:test/iac-misconfig-rules-2096

Conversation

@jaso0n0818

Copy link
Copy Markdown
Contributor

Closes #2096

What

Adds unit coverage for the pure exports of review-enrichment/src/analyzers/iac-misconfig.ts that the existing iac-misconfig.test.ts does not yet exercise. Kept in a companion file (iac-misconfig-rules.test.ts) so concurrent analyzer PRs don't collide with the existing suite.

The existing tests cover the container/cloud securityContext rules, Dockerfile build instructions, and the TLS/certificate-bypass family. This fills the remaining gaps the issue calls out:

  • Two-line correlation rules: wildcard-cors-credentials (wildcard origin + credentials together), insecure-cookie (SameSite=None without Secure=true), and prod-debug (debug enabled in a production config) — each reported at the max of the two contributing line numbers, and each not fired when only one half is present.
  • Single-line rules: public-bucket (public object-storage ACL, both the acl = "public-read" and public_access = true shapes) and hardcoded-service-url.
  • isRelevantConfigPath: relevant IaC/config types (Terraform, YAML/YML, Dockerfile(+suffix), docker-compose/compose, Helm values, dotenv(+env), JSON/TOML/INI/CONF, nginx.conf) vs ordinary source paths (.ts/.py/.md/.go/.css).
  • Finding shape + stable ordering: { file, line, kind } emitted in scan (line) order, plus a clean-config patch producing no findings.

Scope

Test-only. No source, wiring, or generated-artifact changes — the analyzer and its network entrypoint (scanIacMisconfig) are unchanged and out of scope per the issue. review-enrichment suite: all green (node --test).

@jaso0n0818
jaso0n0818 requested a review from JSONbored as a code owner July 5, 2026 00:32
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 5, 2026
@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 00:33:32 UTC

1 file · 1 AI reviewer · no blockers · readiness 80/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This is a test-only companion suite for the IaC misconfiguration analyzer's pure exports, and the assertions line up with the current scanner behavior in review-enrichment/src/analyzers/iac-misconfig.ts. The new coverage exercises relevant path matching, single-line findings, correlation findings, output shape, and ordering without touching production wiring. I do not see a reachable correctness defect in the diff, but a couple of the PR's stated negative-coverage claims are only partially backed by the added tests.

Nits — 5 non-blocking
  • nit: review-enrichment/test/iac-misconfig-rules.test.ts:60 covers the positive insecure-cookie correlation but not the promised one-half-present negatives, so add SameSite-only and secure-false-only assertions or narrow the PR description.
  • nit: review-enrichment/test/iac-misconfig-rules.test.ts:68 covers the positive prod-debug correlation but not the promised production-only/debug-only negatives, so the suite still leaves those correlation false-positive branches unpinned.
  • nit: review-enrichment/test/iac-misconfig-rules.test.ts:42 only proves the two-line correlation when the second contributor appears later; add a reversed-order case if the intended contract is specifically the max contributing line regardless of scan order.
  • At review-enrichment/test/iac-misconfig-rules.test.ts:60, add focused negatives such as `sameSite: none` alone and `secure: false` alone with `findings.filter((f) => f.kind === "insecure-cookie")` equal to `[]`.
  • At review-enrichment/test/iac-misconfig-rules.test.ts:68, add `NODE_ENV=production` alone and `debug: true` alone negatives for `prod-debug`.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2096
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 434 registered-repo PR(s), 263 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jaso0n0818; Gittensor profile; 434 PR(s), 7 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: jaso0n0818
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 434 PR(s), 7 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit f20f38d into JSONbored:main Jul 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(enrichment): unit coverage for the IaC-misconfig analyzer pure scanner

1 participant