build step runs your Dockerfile, and every RUN line in it is code. Anyone who can push a branch can change that code, and on a public repository so can anyone who opens a pull request from a fork. This page is for a security review: where a build runs, what confines it, what it can reach, and which of those you control. Each section links to the page with the detail.
Where a build runs
Both fallbacks are organisation settings that an owner or admin can turn off, and with both off every pipeline step stays on your own clusters. Ankra can also start builds on its build cluster outside a pipeline run, such as the first build of a new application, only while the build fallback is on; a build someone starts there by name still runs. Where your pipeline runs has both settings and the commands, and What Ankra keeps about a run lists the logs and results that reach Ankra wherever a step runs.
The image goes to the registry your application publishes to: your organisation’s private project in Ankra’s registry, unless the application names a registry of your own.
The builder in your cluster
Each build gets a pod of its own inankra-ci-build, running rootless BuildKit. The daemon starts inside that pod, builds one image and exits with it, so no daemon, layer store or process is shared with another build. The agent deletes the pod and the objects it created for the step when the step ends.
The build pod:
- runs as uid 1000, never as root, on a read-only root filesystem
- is never privileged, uses no host namespace or host path, and gets no Kubernetes service account token
- drops every Linux capability except
SETUIDandSETGID, which the builder needs to map its own user namespace - is admitted under the Pod Security Standards’ Baseline profile. Every other step runs in
ankra-ciunder the Restricted profile (What a step runs as) - runs Ankra’s own builder image, pinned by digest. A pipeline cannot name another
What the builder runs without
Rootless BuildKit builds inside an unprivileged user namespace it creates itself. That needs system calls and mounts that a container runtime’s default confinement denies, so the builder gives up some confinement an ordinary step keeps:- No seccomp filter. The build pod names no seccomp profile, because the Baseline profile forbids naming
Unconfined. On a kubelet that does not apply a default seccomp profile, the builder runs with none. On one that appliesRuntimeDefault, the builder cannot start and the build is refused asbuild_runtime_confined, or goes to Ankra’s build cluster while the build fallback is on. - AppArmor only when you choose it. Unless the cluster names an AppArmor profile for the builder, the runtime’s default applies, and on AppArmor nodes that default stops the builder. The
ankra-managedprofile confines the builder to the mounts and namespaces it needs: see Let Ankra load the AppArmor profile. - No process sandbox per
RUN. The commands your Dockerfile runs share the builder’s process namespace.
What a build can reach
Network. Every step gets a NetworkPolicy of its own, and a build’s allows no ingress. A build’s default tier,egress-https, allows DNS to the cluster’s own resolver and 443/TCP and 80/TCP to public addresses only. Private ranges, link-local addresses and every cloud metadata endpoint are excluded unless your organisation lists a range in ci_egress_allowed_cidrs. A NetworkPolicy only takes effect on a network plugin that enforces it, so check that yours does. The exact ranges are in the pipeline reference.
The registry. A build pushes by digest only, to a CI staging repository next to the application’s repositories. It never tags an image and never pushes to the repository you deploy from: only publish gives an image a tag, after the gate passed it (From the build to a deploy).
Secrets. A build cannot pass a secret into the image build. Build arguments are literal NAME=value entries written in the pipeline file, and one named after a declared secret is refused, so no secret ends up in a build argument, where it can be recorded in the image’s history and provenance. When a build needs a private package, fetch it in a run stage that declares the secret, then copy it into the image from the workspace, which is the build’s context.
The layer cache. The BuildKit layer cache lives next to the images in the CI staging repository. A run on the default branch writes the trusted cache that later builds read. Pull request runs and other branches share a separate branch cache, which a default-branch or tag build never reads, so a pull request cannot poison the image the default branch builds. A run from a fork neither reads nor writes either. See Caching.
What a pull request cannot change
Anyone who can push can change what a pipeline does: its stages, scripts and Dockerfile. What a run may touch comes only from the definition on the default branch, once an organisation administrator has approved it. For a build that covers any network beyondegress-https, its resources and placement, its caches, and the secrets and credentials of the run. A pull request that widens any of them still runs, under the approved authority, and its check says what was ignored.
Approving needs a person: a service account token is refused, and so is Ankra’s AI. See Logic is open, authority is closed for the full list of protected sections.
Pull requests from forks
Withfork_policy: read_only, the default, a pull request whose head lives in a fork runs restricted:
- no secrets, no credentials, and no registry login, so its build produces an image that is never pushed
- no shared cache, read or written
- network only for
checkout,buildandscan, and none for any other stage - a fixed budget: at most 8 matrix legs per stage, a 60-minute step timeout, 2 CPU and 4Gi per step, no sidecar services and 256 MiB of artifacts and logs per run
- never sent to Ankra’s build cluster, and never the source of a promoted image
fork_policy: trusted gives a fork’s head the pipeline’s full declared authority, but only once a reviewer with that authority approves the head; until then it runs with no secrets, no credentials and no network. none refuses fork pull requests. The fork policy is itself protected, so a pull request cannot change it for its own run. See Forks.
Ankra’s build cluster
When a build moves to Ankra’s build cluster, the builder receives the repository, the commit, a GitHub installation token to fetch it that expires within the hour, the Dockerfile path and the registry login the image is pushed with. Ankra’s build cluster has the details and the notice the step carries. The builders are a pool shared by every organisation that uses it:- Each builder runs its own rootless BuildKit daemon and takes one build at a time. Builds of different organisations run one after another on a builder, and builders can share a node.
- Before every build, the builder clears every layer, cache record and checkout its daemon kept, and refuses the build if it cannot. It clears them again afterwards, so every build starts cold.
- A build pushes with its own registry login only, never with a login another build used.
- One organisation runs at most three builds at a time there. A fourth waits in order.
From the build to a deploy
An image only moves forward when the stage before it passed:buildpushes the image by digest to the staging repository.scanruns Trivy, Semgrep and Checkov against that digest and your source, from images pinned by digest that a pipeline cannot replace. Trivy takes no settings from your repository.gatejudges the run’s own findings against your organisation’s image gate. A pipeline can make the gate stricter for itself, never looser, and a scanner that recorded nothing fails it.publishtags the exact digest the gate judged. It refuses when the gate is missing, failed or judged a different digest, and it never rebuilds.
enforce, an application also refuses to deploy an image from its registry that publish did not sign for your organisation, so an image built on a laptop or pushed there by hand is never rolled out. See One digest from commit to registry.
How to restrict it
Related
How Ankra Pipelines works
The moving parts, in diagrams.
Where your pipeline runs
Which cluster runs each step, and the settings that keep them on yours.
What Ankra Can See and Do
What leaves your cluster, where it is stored, and how to restrict it.
Shared Responsibility
Where Ankra’s responsibility ends and yours begins.