Dagger
Search

dast

No long description provided.

Installation

dagger install github.com/context-and-oss/cicd/src/composites/dast@v5.1.5

Entrypoint

Return Type
Dast
Example
dagger -m github.com/context-and-oss/cicd/src/composites/dast@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
func (m *MyModule) Example() *dagger.Dast  {
	return dag.
			Dast()
}
@function
def example() -> dagger.Dast:
	return (
		dag.dast()
	)
@func()
example(): Dast {
	return dag
		.dast()
}

Types

Dast 🔗

Dast scans running applications, then packages the detached evidence in a separate call. It runs on its own cadence — not inside the commit stage.

package() 🔗

Package wraps a detached scan evidence file, writes the GitHub comment, and optionally sends the Teams notification. It deliberately accepts no Service: callers persist Scan’s File on the host first, so exporting the returned Directory cannot retain or wait on a live runner tunnel.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
evidenceFile !-

Evidence file produced by Scan and detached onto the caller’s filesystem.

commitShaString !-

Git commit SHA used for evidence provenance.

branchString !-

Git branch name.

repoUrlString !-

Repository URL.

teamsWebhookSecret -

Teams incoming webhook URL for notifications.

runUrlString -

CI pipeline run URL shown in the notification.

Example
dagger -m github.com/context-and-oss/cicd/src/composites/dast@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
 package --evidence file:path --commit-sha string --branch string --repo-url string
func (m *MyModule) Example(evidence *dagger.File, commitSha string, branch string, repoUrl string) *dagger.Directory  {
	return dag.
			Dast().
			Package(evidence, commitSha, branch, repoUrl)
}
@function
def example(evidence: dagger.File, commitsha: str, branch: str, repourl: str) -> dagger.Directory:
	return (
		dag.dast()
		.package(evidence, commitsha, branch, repourl)
	)
@func()
example(evidence: File, commitSha: string, branch: string, repoUrl: string): Directory {
	return dag
		.dast()
		.package(evidence, commitSha, branch, repoUrl)
}

scan() 🔗

Scan scans a running application and returns its evidence file.

One entry point, shape as a parameter (ADR-005). –app selects which of the three sources ScanWeb is given, and it is always explicit:

  • url → the consumer runs the application somewhere the engine can reach, and passes –target. cicd built none of it, so the evidence states that the running code’s provenance is not attested.
  • service → the consumer runs the application on the CI runner (a compose stack, a dotnet run) and passes –service=tcp://localhost:5000. cicd binds it under a fixed alias and composes the address itself. Same provenance caveat: it is the consumer’s process.
  • container → cicd builds the image from –src and –dockerfile, starts it inside the engine and scans that. This is the only shape whose evidence can say the scanned code is the code this commit produced.

The application is never deployed and never published — the same ADR-001 line the commit stage holds. cicd starts a container only for –app container, and starts nothing else beside it: no database, no sidecar, no host Docker socket. An application that needs a stack around it is the consumer’s to start, which is what –app service is for.

The gate is ScanWeb’s: findings at or above –fail-on fail the run, and a readiness probe that never got a served response fails it at every threshold including NONE, because a target that was never reached produces a report of zero alerts that is otherwise byte-identical to a clean scan.

A service-shaped result must be exported immediately as a single File. The reusable workflow writes it to the runner, then passes that detached file to Package in a fresh Dagger call. Returning a Directory retains the service graph, while transporting a large File through contents can leave the CLI waiting after both calls report DONE.

Return Type
File !
Arguments
NameTypeDefault ValueDescription
commitShaString !-

Git commit SHA — used to label the built image and for evidence provenance.

branchString !-

Git branch name.

repoUrlString !-

Repository URL.

appString !"url"

— shape — Which source the scan runs against: url|service|container. Always explicit (ADR-001 — cicd never auto-detects the shape).

srcDirectory -

Source directory holding the Dockerfile. Required for –app container, and refused for the other two shapes, which build nothing.

dockerfileString !"Dockerfile"

Path to the Dockerfile relative to src.

platformString !"linux/amd64"

Target platform for the built image.

targetString -

Full HTTP/S URL of a running target the engine can reach. Required for –app url.

serviceService -

A service to bind and scan, e.g. –service=tcp://localhost:5000 for an application the workflow started on the runner. Required for –app service.

portInteger !8080

— address (–app service and –app container; –app url carries its own) — Port the application answers on.

schemeString !"http"

http or https.

basePathString !"/"

Path the application is served under.

healthPathString -

Path the readiness probe requests. Defaults to the base path.

readyTimeoutSecondsInteger !120

How long to wait for the application to answer before recording a non-run.

modeString !"baseline"

— scan — Scan mode: baseline (passive) | api (from a document) | full (active).

apiSpecFile -

API document to drive –mode api from. Mutually exclusive with –api-spec-path.

apiSpecPathString -

Path the application serves its API document on, e.g. /swagger/v1/swagger.json. Mutually exclusive with –api-spec.

apiFormatString !"openapi"

Format of the API document: openapi | soap | graphql.

ruleConfigFile -

ZAP rule configuration (-c). Every rule it names is reported in the evidence, including any that raised no alert.

maxDurationMinutesInteger !0

Cap the whole scan at this many minutes (ZAP -T). 0 means no cap; an uncapped active scan against a slow target can run for hours.

profileString -

The configuration the application ran under, e.g. “Staging”. Recorded in the evidence and never interpreted — cicd cannot check the claim.

authenticatedBoolean -

Set when the scan exercised a real login. Absent means the findings describe the anonymous surface only, and the evidence says so.

failOnString !"HIGH"

Minimum severity that fails the pipeline: CRITICAL|HIGH|MEDIUM|LOW|NONE. ZAP’s maximum risk is High, so CRITICAL can never fail over findings and the evidence warns when it is used.

Example
dagger -m github.com/context-and-oss/cicd/src/composites/dast@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
 scan --commit-sha string --branch string --repo-url string --app string --dockerfile string --platform string --port integer --scheme string --base-path string --ready-timeout-seconds integer --mode string --api-format string --max-duration-minutes integer --fail-on string
func (m *MyModule) Example(commitSha string, branch string, repoUrl string, app string, dockerfile string, platform string, port int, scheme string, basePath string, readyTimeoutSeconds int, mode string, apiFormat string, maxDurationMinutes int, failOn string) *dagger.File  {
	return dag.
			Dast().
			Scan(commitSha, branch, repoUrl, app, dockerfile, platform, port, scheme, basePath, readyTimeoutSeconds, mode, apiFormat, maxDurationMinutes, failOn)
}
@function
def example(commitsha: str, branch: str, repourl: str, app: str, dockerfile: str, platform: str, port: int, scheme: str, basepath: str, readytimeoutseconds: int, mode: str, apiformat: str, maxdurationminutes: int, failon: str) -> dagger.File:
	return (
		dag.dast()
		.scan(commitsha, branch, repourl, app, dockerfile, platform, port, scheme, basepath, readytimeoutseconds, mode, apiformat, maxdurationminutes, failon)
	)
@func()
example(commitSha: string, branch: string, repoUrl: string, app: string, dockerfile: string, platform: string, port: number, scheme: string, basePath: string, readyTimeoutSeconds: number, mode: string, apiFormat: string, maxDurationMinutes: number, failOn: string): File {
	return dag
		.dast()
		.scan(commitSha, branch, repoUrl, app, dockerfile, platform, port, scheme, basePath, readyTimeoutSeconds, mode, apiFormat, maxDurationMinutes, failOn)
}