Skip to content

fix(infra): rewrite trivy jq evaluation with null-safe stream handling (#320) - #450

Open
Bilalishaq7 wants to merge 3 commits into
Stellar-Search:mainfrom
Bilalishaq7:fix/infra-trivy-severity-gate-320
Open

fix(infra): rewrite trivy jq evaluation with null-safe stream handling (#320)#450
Bilalishaq7 wants to merge 3 commits into
Stellar-Search:mainfrom
Bilalishaq7:fix/infra-trivy-severity-gate-320

Conversation

@Bilalishaq7

Copy link
Copy Markdown
Contributor

Summary

Refactored the Trivy security scan evaluation in .github/workflows/ci.yml to prevent silent no-op failures. The previous jq expression used stream addition (.Misconfigurations[]? + .Vulnerabilities[]?), which evaluated to an empty stream (0) whenever a scan output omitted the .Misconfigurations key.

The new implementation handles missing keys explicitly using null-safe array merging (.Vulnerabilities // [], .Misconfigurations // [], .Secrets // []), outputs JSON directly to file to preserve set -o pipefail semantics, and blocks vulnerable images from publishing to GHCR.

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Smart contract change

Related Issue

Closes #320

Testing

  • Tested locally on Testnet
  • No TypeScript / Rust errors
  • Docs updated if needed

Infra / Docs Sync

  • If this PR changes infrastructure (k8s/ manifests, workflows, scripts), docs/* claims were verified against the manifests (deployment, database, indexer, runbooks)

Screenshots (if UI change)

N/A (CI/CD Infrastructure Update)

@Bilalishaq7

Copy link
Copy Markdown
Contributor Author

Gate Verification Successful:

The workflow failure confirms that the new null-safe jq evaluation correctly catches High/Critical findings (previously swallowed as 0). The gate is now actively enforcing container security as intended by Issue #320.

@AbuJulaybeeb AbuJulaybeeb 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.

fix failing ci and update branch

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.

Infra: The Trivy severity gate is a no-op — its jq expression always evaluates to 0, so images publish however many CRITICALs they carry

2 participants