chore: publish IntegraCI build modules 732ec6c83925
This commit is contained in:
1 parent
7a84930dea
commit
5f8a24d014
133 files changed
+18990
-2
No files matched your search
@@ -0,0 +1,71 @@
|
||||
# iac-scan
|
||||
|
||||
> **UNVERIFIED SCAFFOLD** — run `dagger develop` + `dagger functions` + test
|
||||
> against a matching Dagger engine (engineVersion `v0.21.7`) before use. The
|
||||
> Go in `main.go` has NOT been compiled or validated by Dagger codegen in
|
||||
> this environment (`dagger develop` is unavailable, and the `dag` global
|
||||
> plus the `*Directory` / `*Container` / `*Secret` / `*File` types are
|
||||
> generated). Do not assume it works as-is.
|
||||
|
||||
IntegraCI IaC (Infrastructure-as-Code) security scanning Dagger module. Runs
|
||||
[Trivy](https://trivy.dev/) (`trivy config`) — or optionally
|
||||
[Checkov](https://www.checkov.io/) — over a source directory containing
|
||||
Terraform / Helm / Dockerfile / Kubernetes manifests, counts
|
||||
misconfigurations by severity, and optionally POSTs the result to the
|
||||
IntegraCI API.
|
||||
|
||||
It mirrors the structure and idioms of the sibling `sast-scan` module.
|
||||
|
||||
## Functions
|
||||
|
||||
### `scan`
|
||||
|
||||
Runs an IaC misconfiguration scan and returns a `ScanResult`.
|
||||
|
||||
| Param | Required | Default | Description |
|
||||
| ------------ | -------- | --------- | ------------------------------------------------- |
|
||||
| `source` | yes | — | Source directory to scan (Terraform/Helm/K8s/…) |
|
||||
| `tool` | no | `trivy` | IaC tool: `trivy` \| `checkov` \| `none` |
|
||||
| `api-url` | no | — | IntegraCI API URL for posting results |
|
||||
| `token` | no | — | JWT token for API authentication |
|
||||
| `service-id` | no | — | Service ID to link scan results |
|
||||
| `version` | no | — | Commit SHA / image tag the scan applies to |
|
||||
|
||||
When `tool=none`, the scan is skipped and a result with `skipped=true` is
|
||||
returned. Results are POSTed to the generic scan-ingest endpoint
|
||||
(`POST /api/v1/scans`, `scan_type="iac"`) only when both `api-url` and
|
||||
`token` are set. The per-severity counts populate the typed columns; the
|
||||
`iac_critical` / `iac_high` counters are mirrored into `report_data`, which is
|
||||
where the deploy OPA gate reads them (`golden_standard.rego`
|
||||
`scan_results.iac_critical` / `iac_high`).
|
||||
|
||||
## Usage
|
||||
|
||||
> These commands are illustrative and have NOT been run here. Verify against
|
||||
> a live Dagger engine first.
|
||||
|
||||
```sh
|
||||
# Scan and post results to the IntegraCI API
|
||||
dagger call scan \
|
||||
--source . \
|
||||
--api-url http://localhost:8000 \
|
||||
--token "$TOKEN" \
|
||||
--service-id "$SVC_ID"
|
||||
|
||||
# Scan with Checkov instead of Trivy
|
||||
dagger call scan --source . --tool checkov
|
||||
|
||||
# Scan only (no API post)
|
||||
dagger call scan --source .
|
||||
|
||||
# Skip scanning
|
||||
dagger call scan --source . --tool none
|
||||
```
|
||||
|
||||
## Verifying the scaffold
|
||||
|
||||
```sh
|
||||
dagger develop # generate the SDK + codegen
|
||||
dagger functions # confirm the 'scan' function is exposed
|
||||
gofmt -l main.go # confirm formatting (should print nothing)
|
||||
```
|
||||
Reference in new issue
Block a user