Designing CI Pipelines and Trust Boundaries
A CI pipeline is a machine that runs code on behalf of people and systems you may not fully control, and it usually holds credentials that can change what reaches production. That combination makes it a security-relevant piece of the platform, as well as a quality gate. When a pull request, a package update, or a shared build script can cause a command to run on that machine, the pipeline’s design decides what that command can read, what it can write, and what evidence it leaves behind.
This article treats a CI pipeline as a set of stages with different levels of authority and walks through the decisions that keep an untrusted change from borrowing the authority of a trusted one. It covers build stages, credentials, untrusted changes, dependency controls, isolation, and the test evidence and artifacts a pipeline produces. The aim is that you can read a pipeline definition, say which code runs where with which credentials, and design a safer arrangement.
Prerequisites: the earlier article on packaging services and building reproducible artifacts introduced the idea that a build output has an identity (a content digest), that dependency versions must be pinned, and that a build should be as deterministic as its inputs allow. This article assumes those ideas and asks a different question: who is allowed to cause a build to run, and what can that build touch? It also assumes general programming knowledge, familiarity with Git branches and pull requests, and basic shell use.
Examples use GitHub Actions vocabulary because it is widely used and its behavior is documented publicly. The underlying questions (who triggers execution, which revision of the definition runs, what identity the job carries) apply to other CI systems, but their defaults and mechanisms differ, so check the product you use. Each snippet is labeled either as an illustration that was not executed or as a local run whose output is shown.
What the pipeline is, stage by stage
Continuous integration means integrating changes frequently and checking the combined result automatically. Operationally that check is a chain of stages. Writing the chain down with each stage’s inputs and authority is the first design step, because trust problems come from a stage that has more authority than its inputs deserve.
| Stage | Typical input | What runs | Authority it usually needs | Output |
|---|---|---|---|---|
| Trigger | A push, a pull request, a schedule, a tag | The CI platform’s event handling | Platform-level read access to the repository | A decision about which definition to run |
| Checkout | A specific commit | Git operations | Read access to source | A working directory |
| Restore dependencies | Manifest and lock file, package indexes, caches | Package manager; possibly build hooks from the packages themselves | Network access to approved indexes | Installed libraries |
| Build | Source plus dependencies | Compilers, bundlers, scripts from the repository | Normally none beyond the working directory | Build outputs |
| Test | Build outputs, fixtures | Test code from the repository | Normally none; sometimes a test database or service | Pass/fail results and reports |
| Package | Build outputs | Packaging tool | Normally none | A candidate artifact with a digest |
| Publish | A candidate artifact | Upload to an artifact repository or registry | Write access to that repository | A retained, identified artifact |
| Hand off | A published digest | A request to a deployment system | Permission to request deployment, not to perform it | A deployment request |
Read the “authority” column from top to bottom. Almost everything above publish needs little more than read access, yet those stages execute the most unreviewed code: test files, build scripts, package hooks. Publishing needs write access to a repository other systems trust, yet it runs only a fixed upload step. The central design rule follows from this contrast: the stages that run code the author of the pipeline did not write should hold the least authority, and the stages that hold authority should run only code the pipeline’s owners reviewed.
That rule shows up as a structure. A verification path runs on every proposed change, executes whatever the change contains, and carries no credentials beyond read access. A release path runs only for a change that passed review and was merged to a protected ref, and it is the only path that can publish. The artifact that verification tests and the artifact that release publishes must be tied together by a digest, as the next articles on deploying the same artifact across environments describe, because otherwise passing tests say nothing about what was published.
The following sketch shows that structure for GitHub Actions. It is an illustration written for this article, not executed, and the commit identifier is a placeholder you would replace with a real full-length SHA. The behavior it relies on was checked against GitHub’s workflow-syntax and secure-use documentation: specifying any permission sets all unspecified permissions to none, and GitHub recommends defaulting the token to read-only contents.
# .github/workflows/ci.yml (illustrative, not executed)
name: ci
on:
pull_request: # verification path: runs the proposed change
push:
branches: [main] # release path: runs only after merge
permissions:
contents: read # workflow-wide default; any permission not listed here is none
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@<full 40-character commit SHA>
- run: ./ci/build.sh
- run: ./ci/test.sh
publish:
needs: verify
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: release # a named environment can carry protection rules and its own secrets
permissions:
contents: read
id-token: write # lets this job request a short-lived identity token (see credentials below)
steps:
- uses: actions/checkout@<full 40-character commit SHA>
- run: ./ci/publish.sh
Three things in this file matter more than the syntax. The default permission is narrow and the publish job widens it only for that job. The publish job is conditional on the trigger and the branch, so a pull request cannot reach it. And the publish job names an environment, which is the hook where protection rules and environment-scoped secrets attach.
Trust boundaries in a pipeline
A trust boundary separates contexts that have different permissions, control, or assumptions. A CI system has more of them than the repository diagram suggests, because several parties can influence what executes:
- The author of a proposed change. Test files, build scripts, and package manifests in a pull request all execute on the runner if the pipeline runs them.
- The author of the pipeline definition. A workflow file is code, and a change to it changes what the pipeline does. In many setups the same pull request can edit both the code under test and the definition that tests it.
- The maintainers of dependencies. A package manager that builds a source distribution can run the package’s build backend and hooks on the runner. An installed library can run when your tests import it.
- The maintainers of the actions, plugins, and templates the pipeline calls. They execute with the job’s identity and see the job’s environment.
- The platform operator and the runner operator. For self-managed runners, that is you.
The build agent glossary entry makes the same point from the runner’s side: the people who can influence executed commands include job configurators, build-script authors, and test-code authors, and what matters is the credentials, files, and network the job can reach. The practical test for any stage is to list who can cause code to run in it and ask what that population would obtain.
Which revision of the pipeline runs
Three revisions are involved in any run, and they need not be the same one: the revision of the workflow definition that executes, the revision of the source that is checked out and built, and the revision of any shared definitions the workflow includes. Most trust mistakes come from assuming these coincide, or from not knowing which one a trigger selects.
GitHub’s documentation describes two relevant events. For pull_request, the workflow runs in the context of the pull request’s merge commit, and for a pull request from a fork the documentation states that secrets are not passed to the runner and that the GITHUB_TOKEN has read-only permissions. A maintainer may have to approve workflow runs from a first-time contributor to a public repository. For pull_request_target, the workflow runs in the context of the base repository’s default branch, which is designed so that unsafe code from the pull request head cannot alter the repository or steal secrets. Because that trigger carries privileges, GitHub’s guidance and GitHub Security Lab both warn against combining it with an explicit checkout of the pull request’s code: that combination runs untrusted code with privileges, a vulnerability pattern Security Lab calls a “pwn request.”
The consequence for design is a pair of questions to ask of every workflow. Did the definition that was changed actually execute on this branch, under this trigger? And is any privileged trigger checking out code that a contributor controls? Note the condition in the fork behavior above: those restrictions describe pull requests from forks. A pull request from a branch inside the same repository is not demoted by that mechanism, so what it can read depends on repository permission settings, organization policy, and how secrets are scoped, for example behind an environment with required reviewers. A verification job on an internal pull request is therefore a job to evaluate on its own permissions, not one to assume harmless.
A change can edit the rules that judge it
When the proposed change controls the list of checks that judge it, a failing check can be deleted by the same change. A small worked case shows the effect; it needs no code. Suppose the protected base requires three checks (unit tests, a dependency hash check, a secret scan) and a pull request edits the check list to contain only unit tests. If the dependency hash check would fail for that change, then evaluating the results against the pull request’s own list says “merge allowed”, while evaluating them against the base’s list says “blocked by dependency-hash-check”. The failing check exists in both evaluations. Only the definition of “required” differs.
The same case as a small model, run locally with Python 3.12 (an illustration of the logic, not a CI platform): the gate function takes a list of required checks and reports whether any of them failed for the pull request’s results.
# Illustrative model: which copy of the check list decides whether a change may merge?
base_checks = ["unit-tests", "dependency-hash-check", "secret-scan"]
# A proposed change that also edits the check list (for example, to skip a failing check):
pr_checks = ["unit-tests"]
results_for_pr = {"unit-tests": "pass", "dependency-hash-check": "fail", "secret-scan": "pass"}
def gate(checks):
failed =
return "merge allowed" if not failed else f"blocked by {failed}"
print("checks defined by the proposed change :", gate(pr_checks))
print("checks defined by the protected base :", gate(base_checks))
checks defined by the proposed change : merge allowed
checks defined by the protected base : blocked by ['dependency-hash-check']
The results are identical in both calls. Only the list passed to the gate differs, and the list is the part the proposed change controls.
Platforms offer several ways to close this: required status checks configured outside the repository’s own files, rulesets that name checks the branch must pass, a separate trusted definition that runs against proposed code, and code ownership rules that require designated reviewers for changes to workflow files. GitHub’s secure-use guidance recommends the last of these for workflow files. The point is not to prefer one mechanism but to make sure that the authority to define “required” does not sit with the people the check is meant to constrain.
Untrusted changes
“Untrusted” here does not mean malicious. It means that the pipeline has not yet decided to rely on the change. Every pull request is untrusted in that sense until review and checks complete, and a pull request from a contributor outside your organization is untrusted in a stronger sense.
Script injection through expression interpolation
CI definitions often interpolate event data into shell commands: a pull request title, a branch name, a commit message. If the platform substitutes that text into the script before the shell parses it, the data becomes part of the program. GitHub’s secure-use guidance recommends preferring an action over an inline script, and, when a script is needed, passing untrusted values through an intermediate environment variable so the script text stays fixed.
The mechanism is the same as SQL injection and easy to reproduce locally without any CI platform. The script below simulates a step that receives a hostile pull request title. The title contains a harmless echo, standing in for any command. The script was run locally with sh, needs no network, and writes two small script files; its output follows. In the first case the injected command prints a line containing INJECTED-COMMAND-RAN, and in the second the whole hostile title is printed as plain text.
#!/bin/sh
# Simulates a CI step that interpolates an untrusted value (a pull request title) into a shell script.
TITLE='x"; echo INJECTED-COMMAND-RAN; echo "'
echo "== unsafe: value pasted into the script text before the shell parses it =="
cat > unsafe_step.sh <<EOS
echo "Building for PR: $TITLE"
EOS
cat unsafe_step.sh
echo "-- output:"
sh unsafe_step.sh
echo
echo "== safer: value passed as an environment variable, script text is fixed =="
cat > safe_step.sh <<'EOS'
echo "Building for PR: $PR_TITLE"
EOS
cat safe_step.sh
echo "-- output:"
PR_TITLE="$TITLE" sh safe_step.sh
== unsafe: value pasted into the script text before the shell parses it ==
echo "Building for PR: x"; echo INJECTED-COMMAND-RAN; echo ""
-- output:
Building for PR: x
INJECTED-COMMAND-RAN
== safer: value passed as an environment variable, script text is fixed ==
echo "Building for PR: $PR_TITLE"
-- output:
Building for PR: x"; echo INJECTED-COMMAND-RAN; echo "
In the unsafe version, the generated script file shows the problem directly: the title closed the string and appended a second command, and the shell ran it. In the safer version, the script text is fixed and the shell reads the title as the value of a variable, so the quote characters are just characters. The environment-variable form is not magic. It works because the shell does not re-parse the value as syntax. If the script then passes the variable to eval or builds another command line from it unquoted, the injection returns.
Privileged triggers and the two-workflow pattern
Some automation needs write access in response to an untrusted change, for example posting a comment with test results on a pull request from a fork. Granting that to the workflow that runs the untrusted code recreates the pwn request. GitHub Security Lab’s recommended pattern splits the work. An unprivileged pull_request workflow runs the untrusted code and saves its results as an artifact. A second, privileged workflow triggered by workflow_run reads those results and performs the privileged action. GitHub’s guidance adds a condition: workflows triggered by workflow_run must treat artifacts uploaded by other workflows with caution. Artifact contents are data produced by untrusted code. The privileged workflow should parse them as data (a number, a fixed-format file) and never execute them, and should not interpolate them into commands.
A weaker alternative is to restrict a privileged trigger to pull requests that a maintainer has labeled as safe to test. Security Lab notes that this depends on manual review and remains vulnerable to races, since the code can change after the label is applied.
Credentials
Credentials in a pipeline answer one question: what can this job do beyond reading the repository? Design starts by listing what each stage actually needs and giving it only that.
Start from the identity every job already has
Most platforms give each job a built-in token to talk to the platform itself. GitHub’s guidance is to set the default GITHUB_TOKEN permission to read-only and raise permissions for individual jobs that need more. This follows the least privilege principle: permission is both an operation and a resource scope, and the default should be the smallest that lets an ordinary verification run.
Why a secret in the environment is wider than it looks
Secrets are commonly delivered to a job as environment variables. An environment variable belongs to a process and is inherited by every child process it starts. In a pipeline step that means the build tool, the test runner, every package hook, and every action that step calls can read it. The script below shows the difference between exporting a placeholder value for a whole step and scoping it to the one command that needs it. The value is a placeholder, not a real credential. The script was run locally, and its output follows: the child process sees the value in the first case, and in the second only the one command that received it does.
#!/bin/sh
export FAKE_DEPLOY_TOKEN="placeholder-not-a-real-secret"
echo "== step-wide environment: every child process inherits it =="
echo "test runner sees: $(sh -c 'echo ${FAKE_DEPLOY_TOKEN:-<unset>}')"
echo "== scoped to the one command that needs it =="
unset FAKE_DEPLOY_TOKEN
FAKE_DEPLOY_TOKEN="placeholder-not-a-real-secret" sh -c 'echo "deploy command sees: ${FAKE_DEPLOY_TOKEN:-<unset>}"'
echo "test runner sees: $(sh -c 'echo ${FAKE_DEPLOY_TOKEN:-<unset>}')"
== step-wide environment: every child process inherits it ==
test runner sees: placeholder-not-a-real-secret
== scoped to the one command that needs it ==
deploy command sees: placeholder-not-a-real-secret
test runner sees: <unset>
Scoping narrows who can read a value during the run, but it does not remove the value from the job. The secrets management practice behind this is: configuration references a secret, a component that receives the plaintext may persist it, and the useful question is which components end up holding plaintext. Two limits are worth knowing. First, platform log masking is a convenience, not a guarantee: GitHub’s documentation says automatic redaction is not guaranteed and that redaction relies on finding an exact match, so a transformed or structured value can slip through. Second, a job that holds a secret can send it anywhere its network allows, so secrets belong only in jobs that run reviewed code.
Short-lived identity instead of stored keys
For deployments to a cloud account, a long-lived key stored as a CI secret is a credential that works from anywhere until someone revokes it. OpenID Connect (OIDC) avoids storing it. The platform issues each job a signed identity token whose claims include an issuer (iss), an audience (aud), and a subject (sub) that identifies the specific workflow, often including repository and environment. The workflow needs the id-token: write permission to request it. The cloud side is configured with a trust relationship that states which claims it accepts, and it validates the token against those conditions before issuing temporary credentials.
This moves the security decision to the trust condition. A condition that accepts any sub from the platform’s issuer lets any workflow on the platform assume the role. A condition that names the repository, the protected branch or environment, and the audience limits the role to the intended job. An access token issued this way still has a lifetime, a scope, and a revocation story, so the permissions of the role it assumes remain a least-privilege decision. OIDC removes a stored long-lived secret. It does not decide what the role may do.
What exposure looks like
Public incident reports show how a build-time secret leaks without anything dramatic happening on the victim’s side. In March 2025, the maintained GitHub Action tj-actions/changed-files was compromised (CVE-2025-30066), as was reviewdog/action-setup@v1 (CVE-2025-30154). CISA’s alert states that the malicious code could disclose secrets, including access keys, personal access tokens, npm tokens, and private keys, by exposing them in workflow logs. CISA’s recommended response included auditing use during the affected window, searching for exposed secrets (which might appear double-encoded in base64), and rotating every secret that may have been exposed. Those are facts from the alert. The interpretation for pipeline design is this article’s own: workflows that referenced the action by a mutable tag received new code without a repository change, and any job that ran it with secrets in its environment placed those secrets within reach of the new code. That is why the guidance on dependencies below pairs pinning with narrow job-level credentials, and why rotation, not log cleanup, is the response once a secret has been exposed.
Dependency controls
A pipeline consumes three kinds of dependencies that behave differently: language packages, the actions or plugins the pipeline itself calls, and base images or toolchains. All three can execute code on the runner, and for each the control question is the same: what exactly will be fetched, and who decided it.
Pins, locks, and hashes
A version range lets the resolver choose a newer package than the one you tested. A lock file records a resolved set, and installing from it makes the pipeline repeat that resolution. A version pin alone still names a version, not bytes: if a different file with the same name and version appears at the index, a name-and-version pin cannot tell. A content hash can.
pip’s hash-checking mode shows the difference. It is turned on by listing --hash for any requirement, or forced with --require-hashes. The documentation requires every requirement, including dependencies, to be pinned with == and hashed, because a partially hashed file would let unhashed packages through. A requirement line has the form name==1.2.3 --hash=sha256:<digest>. In the documented behavior, a package whose bytes differ from the recorded hash is rejected even when its name and version match, whereas a bare version pin accepts whatever file the index or local directory presents under that name and version. The transcript below was produced locally to show that behavior. It used two hand-built wheels of a placeholder package, demo_lib, with the same name and version but different contents, and the long error lines are truncated here. The requirements file pins demo_lib==1.0.0 with the SHA-256 of the genuine wheel.
$ pip install --no-index --find-links good --require-hashes -r requirements.txt
Installing collected packages: demo_lib
Successfully installed demo_lib-1.0.0
demo_lib.VALUE = genuine
$ pip install --no-index --find-links bad --require-hashes -r requirements.txt # same name and version, different bytes
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone ...
Expected sha256 9fffdd99242701f006b3987d8d8838716de02c2d5c8b1f117f75e21c10bf75b6
Got 103a2aed64061fbe3a401cc4f374dc588a0a971e0e1d68499107956068347482
$ pip install --no-index --find-links bad demo_lib==1.0.0 # a version pin without hashes
Successfully installed demo_lib-1.0.0
demo_lib.VALUE = tampered
$ pip install --no-index --find-links good --require-hashes -r req_nohash.txt # requirement without a hash
ERROR: Hashes are required in --require-hashes mode, but they are missing from some requirements. Here is a list of those requirements along with the hashes their downloaded a ...
The first install succeeds with the genuine wheel. The second offers different bytes under the same name and version and is rejected with the expected and received hashes. The third, a bare version pin, accepts the tampered file. The fourth shows that a requirement without a hash is refused in hash mode.
A bare version pin therefore does not protect against substituted content, and a requirement without a hash is refused in hash mode, which is the completeness rule at work. Two limits remain. The hash proves the bytes are the ones someone approved, and it says nothing about whether the approval was wise, so the first approval and every upgrade need review of the diff. And a hash obtained from the same index as the file does not independently establish approval; the hashes belong in your repository, reviewed with the change that introduces them.
Package names and where they resolve
A resolver that sees several package locations chooses among candidates by its own rules. Dependency confusion exploits this: a build resolves an internal package name to a public package that someone else published under that name. Hash checking blocks it only if the approved hash is for the intended file. The structural controls are a proxy or repository that binds protected internal names to an approved origin and blocks upstream fallback for them, and reserving or prefixing internal names in the public registry where the registry enforces it. Treat the choice of which index a build can reach as a policy: restricting the build’s network to the approved index removes a whole class of fetches. Software supply chain security covers the wider set of risks, and the later article on software supply chain controls returns to them in depth.
Actions and plugins
A reference such as owner/action@v3 names a tag. A tag is a label that the owner, or someone who takes over the owner’s account, can move. GitHub’s documentation states that pinning to a full-length commit SHA is currently the only way to use an action as an immutable release, because an attacker would have to produce a SHA-1 collision to substitute different content. The documentation also recommends auditing an action’s source so you know where it sends secrets, and offers repository and organization policies to enforce SHA pinning. Pinning has its own cost: you no longer receive fixes automatically, so pair it with a reviewed update process such as Dependabot, which the guidance mentions for keeping dependencies current.
Pinning also does not narrow what the action can do. An action pinned by commit still runs with the job’s token and environment. The two controls compose: pin for identity, scope credentials for blast radius.
Isolation
Isolation answers where code runs and what survives after it finishes. The relevant properties are separable, and treating them as one leads to false confidence.
- Per-job lifetime. Is the execution environment created for one job and destroyed afterward, or reused? A build agent that is reused accumulates caches, tool state, and credential residue, and a compromise in one job can persist into later jobs.
- Boundary strength. What separates the job from the host and from other jobs: a virtual machine, a container, or a shared process space? Not every runner type offers the same boundary, so check the documented isolation for the runner type you select.
- Reachable network and services. A discarded machine does not recall a token already sent elsewhere, and a shared package proxy or remote cache outlives the machine.
- Credentials available at start. What the job holds at bootstrap bounds what a compromised job can obtain.
GitHub’s secure-use guidance is direct about self-hosted runners: they do not have guarantees about running in ephemeral clean virtual machines and can be persistently compromised by untrusted code in a workflow, so they should almost never be used for public repositories. It recommends just-in-time runners, which perform at most one job before being removed. Private visibility does not remove the concern, because whoever can cause code to run on the runner (contributors, workflow authors, dependency maintainers) can reach its files, network, and credentials.
Three things survive a discarded job environment, and each needs its own control. External caches and volumes may carry poisoned content into the next job, so a cache your jobs write to is a trust boundary of its own, and untrusted runs should not write to caches that release jobs read. Credentials the job obtained stay valid until their lifetime ends or you revoke them, which is why short lifetimes and tested revocation matter. Shared resources such as a package proxy or a container daemon on the host can still be affected across jobs. A sandbox limits the environment code runs in, but its name says little about the real restrictions, so test the configured boundary: denied file access, blocked network destinations, and resource limits, while confirming that allowed work still succeeds.
SLSA’s build track gives a concrete list of what “isolated” is meant to guarantee at its third level: builds must not be able to access the platform’s secrets, interfere with each other when running concurrently, persist environmental changes between builds, be affected by cache poisoning from other builds, or make remote interactions that are not tracked. Use it as a checklist when you evaluate a build platform, with the caveat that it describes a level of assurance for the platform, not a property you get by choosing a particular product.
Test evidence and artifacts
A green check is a statement with a scope. The statement is “the configured checks passed for this revision under this definition.” It says nothing about behavior the checks did not exercise, and it says nothing about whether the artifact later deployed is the one that was tested. Keeping the claim and its scope together is the job of an evidence record.
What a test result can and cannot support
Passing unit and integration tests establishes the exercised cases under the conditions of the run: which components were real, which were replaced, which inputs were used. A test that mocks the service it claims to check cannot reveal a mismatch with the real service. A test whose expected value is computed by the same transformation under test can pass while both are wrong. Stating what is real and what is replaced in each suite is part of making the evidence readable.
The pipeline’s definition also determines whether the evidence is trustworthy. Evidence produced by a run whose check list the change itself edited, or whose runner persisted state from earlier jobs, supports a weaker claim than evidence from a protected definition on a fresh runner.
Binding evidence to an identity
A result is useful for promotion only if it can be tied to the specific bytes it covers. The record below is an illustrative example (not produced by a real pipeline) of the fields a downstream system would need: the source commit and workflow identity, the number of tests run and failed, and the SHA-256 digest of the artifact. The commit and run identifiers are placeholders, and the digest is an arbitrary example value.
{
"source": { "repository": "example/service", "commit": "<40-hex commit id>" },
"workflow": { "definition": ".ci/verify.yml", "definition_commit": "<40-hex commit id>", "run": "<run id>" },
"tests": { "suite": "tests/unit", "ran": 2, "failed": 0 },
"artifact": { "name": "service-1.0.0-py3-none-any.whl", "sha256": "<64-hex digest of the artifact>" }
}
A downstream stage can now ask a precise question: does the digest of the artifact about to be deployed match a record whose tests passed, produced by the definition the owners trust? That is the check a release gate needs, and the next article on promoting one artifact across environments builds on it. A rebuild from the same commit does not satisfy the question automatically, because the output may differ. A reproducible build can establish that matching output bytes came from declared inputs, and the earlier article on reproducible artifacts covers how.
Artifacts as inputs, outputs, and evidence
Platforms retain workflow outputs as downloadable artifacts. On GitHub, build logs and artifacts are stored for 90 days by default, with the period configurable, and downloading requires read access to the repository. Two design consequences matter. Retention for release candidates must be set deliberately, since a rollback needs the earlier artifact and the platform default may be shorter than your rollback window. And artifacts produced by untrusted runs are untrusted input to whatever consumes them, as the workflow_run guidance above states. Publishing a release artifact to a repository with immutable identities is a separate act from keeping a run’s temporary output.
Build provenance records how an artifact was produced: the builder, the inputs, and the parameters. SLSA’s levels distinguish what a consumer can rely on. At level 1, provenance exists but may be unsigned or incomplete, which helps investigation but gives no protection against tampering. Level 2 adds a hosted build platform and authenticated provenance. Level 3 adds stronger isolation, with signing material that user-defined build steps cannot access. Provenance records a claim about origin; it does not show that the code is safe, and a verifier must check the signer, the expected source, and the expected process, as the glossary entry on provenance describes. Whether an artifact’s provenance is verified at build, at registry ingestion, or at deployment decides which compromises that check can catch.
Failure modes and operating responsibility
The following table connects common failures to what you would observe and the control that addresses them. It is a selection for this topic, not a complete taxonomy.
| Failure | What you observe | Control and its limit |
|---|---|---|
| Untrusted change reads a secret | A secret appears in logs or at an external endpoint; no repository change explains it | Run untrusted code in jobs with no secrets; scope credentials per step. Redaction is not a guarantee, so rotate after any exposure |
| Privileged trigger runs a contributor’s code | A workflow with write permissions executes code from a pull request | Avoid pairing a privileged trigger with a checkout of untrusted code; use the two-workflow pattern and parse artifacts as data |
| Change edits its own checks | A pull request that modifies the workflow merges with green status | Define required checks outside the proposed change; require review from designated owners for workflow files |
| Injection through interpolated event data | A title, branch name, or message becomes a command | Pass untrusted values through environment variables with fixed script text; never re-parse them as syntax |
| Substituted dependency | The same version string installs different content; a name resolves to an unintended origin | Hash-checked installs from a reviewed lock file; bind internal names to an approved origin; restrict build network access |
| Mutable action reference | A job runs different action code without any repository change | Pin to a full commit SHA and update through review; narrow job credentials regardless |
| Reused runner state | A later job inherits files, processes, or cached content | Ephemeral per-job runners; separate caches for untrusted and release runs |
| Long-lived cloud key | A key works from anywhere until revoked | OIDC with a narrow trust condition; short-lived credentials and tested revocation |
| Evidence not tied to the artifact | Tests passed, but the deployed bytes differ from the tested bytes | Record the artifact digest with the result; deploy by digest |
Responsibility needs assignment as well as mechanisms. Someone must own the review of pipeline changes, to a standard that accounts for what the delivery system grants, since a team that reviews application code carefully but approves pipeline edits quickly has kept the process and lost the point. Someone must own the trust condition on cloud roles, the runner images, and the update process for pinned dependencies. When many repositories share the same definitions, a shared pipeline template gives one place to fix a problem, with the caution that a template is also a single place where a mistake spreads.
The practical checklist for any existing pipeline is short. List, per stage, who can cause code to run and which credentials the job holds. Confirm which revision of the definition runs under each trigger. Confirm that the stages running untrusted code hold no secrets and no write permission. Confirm that dependencies are installed from pinned, hash-verified inputs and that action references are immutable. Confirm that runners are created per job, or state what persists. Confirm that every release artifact has an evidence record bound to its digest. These checks reduce risk. They do not prove a pipeline is secure, and each rests on platform behavior that you should recheck against current documentation when you change platforms or versions.
Limits of this treatment
The two shell scripts, the check-list model, and the pip transcript were run locally and show mechanisms, not the behavior of a particular CI platform. GitHub Actions itself was not run here, so the workflow sketch and the platform behaviors described come from the cited documentation and were not tested. The scripts use a placeholder secret value, and the record example uses placeholder identifiers. The failure table is a selection. Platform defaults and recommendations change, so confirm them against the current documentation before relying on them.
References
- GitHub Docs, Secure use reference
- GitHub Docs, Events that trigger workflows
- GitHub Docs, Workflow syntax for GitHub Actions
- GitHub Docs, OpenID Connect
- GitHub Docs, Downloading workflow artifacts
- GitHub Security Lab, Keeping your GitHub Actions and workflows secure: Preventing pwn requests
- SLSA v1.1, Requirements
- CISA, Supply Chain Compromise of Third-Party tj-actions/changed-files (CVE-2025-30066) and reviewdog/action-setup (CVE-2025-30154)
- pip documentation, Secure installs
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
