[{"data":1,"prerenderedAt":3084,"buildId":3085},["ShallowReactive",2],{"blog-list":3},[4,1119,1653,2190],{"id":5,"title":6,"body":7,"cluster":1108,"date":1109,"description":1110,"draft":1111,"extension":1112,"keyword":1113,"meta":1114,"navigation":368,"path":1115,"seo":1116,"stem":1117,"__hash__":1118},"blog\u002Fblog\u002Fci-cd-pipeline-security-risks.md","CI\u002FCD pipeline security: 10 risks, with an attack for each",{"type":8,"value":9,"toc":1093},"minimark",[10,14,25,34,39,172,176,183,194,203,209,215,225,229,234,239,244,249,257,261,266,277,293,301,306,311,319,323,328,333,478,486,504,524,545,554,558,563,574,579,584,736,747,755,759,764,769,774,785,793,797,802,817,825,830,835,843,847,852,882,887,897,938,941,949,953,958,969,972,977,988,996,1000,1005,1010,1013,1018,1023,1031,1035,1038,1066,1073,1077,1089],[11,12,13],"p",{},"A build pipeline can read your source, holds your deploy credentials, and produces the thing production trusts. That is why CI\u002FCD pipeline security is its own problem. The application code can be clean and the pipeline can still ship a backdoor, leak a cloud key, or deploy a commit nobody reviewed.",[11,15,16,17,24],{},"The best map of this attack surface is the ",[18,19,23],"a",{"href":20,"rel":21},"https:\u002F\u002Fowasp.org\u002Fwww-project-top-10-ci-cd-security-risks\u002F",[22],"nofollow","OWASP Top 10 CI\u002FCD Security Risks",". This guide takes each risk in turn: what it is, an attack that exploits it, how to detect it and how to fix it, with real incidents linked to their primary sources.",[11,26,27,28,33],{},"The examples use GitHub Actions syntax. Our labs run on Gitea Actions, which is ",[18,29,32],{"href":30,"rel":31},"https:\u002F\u002Fdocs.gitea.com\u002Fusage\u002Factions\u002Fcomparison",[22],"designed to be compatible with it",".",[35,36,38],"h2",{"id":37},"the-owasp-top-10-cicd-security-risks-at-a-glance","The OWASP Top 10 CI\u002FCD security risks at a glance",[40,41,42,58],"table",{},[43,44,45],"thead",{},[46,47,48,52,55],"tr",{},[49,50,51],"th",{},"ID",[49,53,54],{},"Risk",[49,56,57],{},"The attack in one line",[59,60,61,73,84,95,106,117,128,139,150,161],"tbody",{},[46,62,63,67,70],{},[64,65,66],"td",{},"CICD-SEC-1",[64,68,69],{},"Insufficient flow control mechanisms",[64,71,72],{},"Push code to production without a second person seeing it",[46,74,75,78,81],{},[64,76,77],{},"CICD-SEC-2",[64,79,80],{},"Inadequate identity and access management",[64,82,83],{},"Use a stale or over-scoped token nobody remembers issuing",[46,85,86,89,92],{},[64,87,88],{},"CICD-SEC-3",[64,90,91],{},"Dependency chain abuse",[64,93,94],{},"Get the build to install your package instead of the real one",[46,96,97,100,103],{},[64,98,99],{},"CICD-SEC-4",[64,101,102],{},"Poisoned pipeline execution",[64,104,105],{},"Change what the pipeline runs, and let it run with its secrets",[46,107,108,111,114],{},[64,109,110],{},"CICD-SEC-5",[64,112,113],{},"Insufficient pipeline-based access controls",[64,115,116],{},"Turn one compromised step into access to everything the job can reach",[46,118,119,122,125],{},[64,120,121],{},"CICD-SEC-6",[64,123,124],{},"Insufficient credential hygiene",[64,126,127],{},"Find secrets in git history, build logs and image layers",[46,129,130,133,136],{},[64,131,132],{},"CICD-SEC-7",[64,134,135],{},"Insecure system configuration",[64,137,138],{},"Go from a low-privilege CI login to code execution on the server",[46,140,141,144,147],{},[64,142,143],{},"CICD-SEC-8",[64,145,146],{},"Ungoverned usage of third-party services",[64,148,149],{},"Compromise an action or integration that many pipelines trust",[46,151,152,155,158],{},[64,153,154],{},"CICD-SEC-9",[64,156,157],{},"Improper artifact integrity validation",[64,159,160],{},"Swap the artifact between build and deploy",[46,162,163,166,169],{},[64,164,165],{},"CICD-SEC-10",[64,167,168],{},"Insufficient logging and visibility",[64,170,171],{},"Do all of the above without an alert firing",[35,173,175],{"id":174},"cicd-sec-1-insufficient-flow-control-mechanisms","CICD-SEC-1: Insufficient flow control mechanisms",[11,177,178,182],{},[179,180,181],"strong",{},"What it is."," OWASP describes this as an attacker with access to source control, CI or an artifact repository being able to push code or artifacts all the way to production, because no step in the flow forces an independent review or approval.",[11,184,185,188,189,193],{},[179,186,187],{},"The attack."," The main branch is protected and needs a review. But a ",[190,191,192],"code",{},"release\u002F*"," branch also triggers the deploy workflow, and it has no protection rule. An attacker with an ordinary developer token pushes there and the pipeline deploys it. Auto-merge rules with weak criteria and users exempt from protection open the same path.",[11,195,196,197,202],{},"A real case: on 28 March 2021, ",[18,198,201],{"href":199,"rel":200},"https:\u002F\u002Fnews-web.php.net\u002Fphp.internals\u002F113838",[22],"two malicious commits were pushed to php-src"," on PHP's self-hosted git server, under the names of two core developers. They went straight onto the main branch with no review step in between. The project shut the server down and made its GitHub repositories canonical.",[11,204,205,208],{},[179,206,207],{},"How to detect it."," List every branch and tag pattern that can trigger a deploy and compare it with your protection rules. Alert on direct pushes to protected branches, on admin bypasses, and on any change to the protection rules themselves. Compare what runs in production with what the pipeline last deployed.",[11,210,211,214],{},[179,212,213],{},"How to fix it."," Protect every branch that feeds production, with no exempt users. Require a reviewer other than the author. Allow only artifacts built by the CI service identity to move toward production.",[11,216,217,220,221,33],{},[179,218,219],{},"Lab:"," ",[18,222,224],{"href":223},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fbypass-branch-protection-and-merge-unreviewed-code","Bypass branch protection and merge unreviewed code",[35,226,228],{"id":227},"cicd-sec-2-inadequate-identity-and-access-management","CICD-SEC-2: Inadequate identity and access management",[11,230,231,233],{},[179,232,181],{}," A pipeline spans many systems, each with its own human accounts, service accounts, bots, deploy keys and tokens. OWASP groups the failures into identities that are overly permissive, stale, local to one system, external, self-registered or shared.",[11,235,236,238],{},[179,237,187],{}," A contractor left a year ago. Their personal access token still works and can write to every repository in the organisation. Whoever finds it in an old backup or a leaked dotfile can push a tag that starts a release. Bots follow the same pattern: an integration that only comments on pull requests but holds a write token.",[11,240,241,243],{},[179,242,207],{}," Inventory every identity and token across source control, CI and registries, with scopes and last-used date. Flag tokens with no expiry, idle accounts, open self-registration and outside email domains.",[11,245,246,248],{},[179,247,213],{}," Put every system behind your identity provider and remove local accounts. Issue fine-grained tokens with an expiry. Replace shared accounts with one identity per purpose. Remove access when the work ends, not at the next audit.",[11,250,251,220,253,33],{},[179,252,219],{},[18,254,256],{"href":255},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fover-privileged-tokens-and-deploy-keys-from-read","Over-privileged tokens and deploy keys: from read access to release",[35,258,260],{"id":259},"cicd-sec-3-dependency-chain-abuse","CICD-SEC-3: Dependency chain abuse",[11,262,263,265],{},[179,264,181],{}," In OWASP's words, this is \"an attacker's ability to abuse flaws relating to how engineering workstations and build environments fetch code dependencies.\" The main techniques are dependency confusion, hijacked maintainer accounts, typosquatting and brandjacking.",[11,267,268,270,271,276],{},[179,269,187],{}," In February 2021 Alex Birsan published ",[18,272,275],{"href":273,"rel":274},"https:\u002F\u002Fmedium.com\u002F@alex.birsan\u002Fdependency-confusion-4a5d60fec610",[22],"Dependency Confusion: How I Hacked Into Apple, Microsoft and Dozens of Other Companies",": he registered internal package names on public registries, and builds pulled his versions instead of the private ones.",[11,278,279,280,288,289,292],{},"The same thing hit PyTorch. Between 25 and 30 December 2022, ",[18,281,284,285],{"href":282,"rel":283},"https:\u002F\u002Fpytorch.org\u002Fblog\u002Fcompromised-nightly-dependency\u002F",[22],"PyTorch-nightly installs on Linux pulled a malicious ",[190,286,287],{},"torchtriton"," from PyPI instead of from PyTorch's own index, because the PyPI index took precedence. Its binary collected environment variables, files from ",[190,290,291],{},"~\u002F.ssh"," and other data, and sent them out over DNS.",[11,294,295,300],{},[18,296,299],{"href":297,"rel":298},"https:\u002F\u002Fnvd.nist.gov\u002Fvuln\u002Fdetail\u002FCVE-2024-3094",[22],"CVE-2024-3094"," is the compromised-upstream case: malicious code in the official xz tarballs from version 5.6.0, extracted from a disguised test file during the liblzma build.",[11,302,303,305],{},[179,304,207],{}," Review lockfile changes in every pull request. For each internal package name, check whether the same name exists on the public registry. Watch for install scripts that make network calls during the build.",[11,307,308,310],{},[179,309,213],{}," Route all package downloads through an internal proxy. Use scoped names for private packages and bind each scope to your registry. Commit lockfiles and pin versions with hashes. Run install steps in a job that holds no secrets.",[11,312,313,220,315,33],{},[179,314,219],{},[18,316,318],{"href":317},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fdependency-confusion-against-a-private-package-index","Dependency confusion against a private package index",[35,320,322],{"id":321},"cicd-sec-4-poisoned-pipeline-execution-ppe","CICD-SEC-4: Poisoned pipeline execution (PPE)",[11,324,325,327],{},[179,326,181],{}," OWASP defines PPE as the ability of an attacker with access to source control, but not to the build environment, to inject commands that the pipeline then runs with its own identity. It comes in three forms: direct (edit the CI configuration), indirect (edit a file the configuration runs, such as a Makefile) and public (the same thing, from an anonymous fork of a public repository).",[11,329,330,332],{},[179,331,187],{}," The most common shape in GitHub Actions is a privileged trigger running untrusted code:",[334,335,340],"pre",{"className":336,"code":337,"language":338,"meta":339,"style":339},"language-yaml shiki shiki-themes github-dark","on: pull_request_target        # runs with the base repository's secrets\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n        with:\n          ref: ${{ github.event.pull_request.head.sha }}   # the PR author's code\n      - run: make test                                      # the PR author's Makefile\n        env:\n          DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}\n","yaml","",[190,341,342,363,370,380,388,399,407,421,429,443,459,467],{"__ignoreMap":339},[343,344,347,351,355,359],"span",{"class":345,"line":346},"line",1,[343,348,350],{"class":349},"sDLfK","on",[343,352,354],{"class":353},"s95oV",": ",[343,356,358],{"class":357},"sU2Wk","pull_request_target",[343,360,362],{"class":361},"sAwPA","        # runs with the base repository's secrets\n",[343,364,366],{"class":345,"line":365},2,[343,367,369],{"emptyLinePlaceholder":368},true,"\n",[343,371,373,377],{"class":345,"line":372},3,[343,374,376],{"class":375},"s4JwU","jobs",[343,378,379],{"class":353},":\n",[343,381,383,386],{"class":345,"line":382},4,[343,384,385],{"class":375},"  test",[343,387,379],{"class":353},[343,389,391,394,396],{"class":345,"line":390},5,[343,392,393],{"class":375},"    runs-on",[343,395,354],{"class":353},[343,397,398],{"class":357},"ubuntu-latest\n",[343,400,402,405],{"class":345,"line":401},6,[343,403,404],{"class":375},"    steps",[343,406,379],{"class":353},[343,408,410,413,416,418],{"class":345,"line":409},7,[343,411,412],{"class":353},"      - ",[343,414,415],{"class":375},"uses",[343,417,354],{"class":353},[343,419,420],{"class":357},"actions\u002Fcheckout@v4\n",[343,422,424,427],{"class":345,"line":423},8,[343,425,426],{"class":375},"        with",[343,428,379],{"class":353},[343,430,432,435,437,440],{"class":345,"line":431},9,[343,433,434],{"class":375},"          ref",[343,436,354],{"class":353},[343,438,439],{"class":357},"${{ github.event.pull_request.head.sha }}",[343,441,442],{"class":361},"   # the PR author's code\n",[343,444,446,448,451,453,456],{"class":345,"line":445},10,[343,447,412],{"class":353},[343,449,450],{"class":375},"run",[343,452,354],{"class":353},[343,454,455],{"class":357},"make test",[343,457,458],{"class":361},"                                      # the PR author's Makefile\n",[343,460,462,465],{"class":345,"line":461},11,[343,463,464],{"class":375},"        env",[343,466,379],{"class":353},[343,468,470,473,475],{"class":345,"line":469},12,[343,471,472],{"class":375},"          DEPLOY_KEY",[343,474,354],{"class":353},[343,476,477],{"class":357},"${{ secrets.DEPLOY_KEY }}\n",[11,479,480,481,33],{},"Whoever opens the pull request controls the Makefile, and the Makefile runs with the deploy key in its environment. GitHub Security Lab described this pattern in 2021 as a ",[18,482,485],{"href":483,"rel":484},"https:\u002F\u002Fsecuritylab.github.com\u002Fresources\u002Fgithub-actions-preventing-pwn-requests\u002F",[22],"\"pwn request\"",[11,487,488,489,494,495,500,501,503],{},"In December 2024 the Ultralytics Python package was compromised through its GitHub Actions workflows. ",[18,490,493],{"href":491,"rel":492},"https:\u002F\u002Fblog.pypi.org\u002Fposts\u002F2024-12-11-ultralytics-attack-analysis\u002F",[22],"PyPI's analysis"," lists versions 8.3.41, 8.3.42, 8.3.45 and 8.3.46 as affected and says the attack targeted the GitHub Actions cache used during the build. ",[18,496,499],{"href":497,"rel":498},"https:\u002F\u002Fblog.yossarian.net\u002F2024\u002F12\u002F06\u002Fzizmor-ultralytics-injection",[22],"William Woodruff's write-up"," traces the entry point to a ",[190,502,358],{}," workflow and a shell step that expanded the branch name unquoted.",[11,505,506,508,509,511,512,515,516,519,520,523],{},[179,507,207],{}," Search your workflows for ",[190,510,358],{}," and ",[190,513,514],{},"workflow_run",", for checkouts of the pull request head, and for ",[190,517,518],{},"${{ github.event... }}"," expressions inside ",[190,521,522],{},"run:"," blocks. Check which workflows can see secrets when the trigger comes from a branch or a fork.",[11,525,526,528,529,532,533,540,541,33],{},[179,527,213],{}," Build untrusted code with the plain ",[190,530,531],{},"pull_request"," trigger, with no secrets. Keep anything that needs credentials in a separate job that only runs after merge. Pass untrusted values through environment variables, never straight into a script. GitHub is also tightening the default: from 2 December 2026, ",[18,534,537,539],{"href":535,"rel":536},"https:\u002F\u002Fgithub.blog\u002Fchangelog\u002F2026-11-02-pull_request_target-blocked-by-default-december-2",[22],[190,538,358],{}," is blocked by default in public repositories"," unless an Actions event policy allows it. For the full breakdown, read ",[18,542,544],{"href":543},"\u002Fblog\u002Fpoisoned-pipeline-execution","poisoned pipeline execution: direct, indirect and public",[11,546,547,220,549,553],{},[179,548,219],{},[18,550,552],{"href":551},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fsteal-a-deploy-secret-from-a-pull-request","Steal a deploy secret from a pull request, in 30 minutes",". It is free.",[35,555,557],{"id":556},"cicd-sec-5-insufficient-pipeline-based-access-controls-pbac","CICD-SEC-5: Insufficient pipeline-based access controls (PBAC)",[11,559,560,562],{},[179,561,181],{}," A pipeline job can reach the source, the secrets, the network and often the cloud. OWASP's point is that each pipeline, and each step inside it, should get only the access it needs. When it gets more, one compromised step becomes a path to everything the job can touch.",[11,564,565,567,568,573],{},[179,566,187],{}," Between 31 January and 1 April 2021, Codecov's Bash Uploader was modified. The ",[18,569,572],{"href":570,"rel":571},"https:\u002F\u002Fabout.codecov.io\u002Fsecurity-update\u002F",[22],"altered script sent git remote information and environment variables"," from customers' CI runs to an external server. A coverage upload needs none of a pipeline's deploy credentials, but the script ran wherever the pipeline called it, with that job's full environment.",[11,575,576,578],{},[179,577,207],{}," For every job, compare the secrets and permissions it can access with what it uses. Look for runners shared across trust levels and build jobs with open outbound access.",[11,580,581,583],{},[179,582,213],{}," Scope secrets to the job that uses them, give the job token the least permission, and keep deploy credentials behind a protected environment:",[334,585,587],{"className":336,"code":586,"language":338,"meta":339,"style":339},"permissions:\n  contents: read            # default for every job in this workflow\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - run: make test        # no secrets here\n\n  deploy:\n    needs: test\n    if: github.ref == 'refs\u002Fheads\u002Fmain'\n    environment: production   # deploy secrets live here, behind its protection rules\n    runs-on: ubuntu-latest\n    steps:\n      - run: .\u002Fdeploy.sh\n",[190,588,589,596,609,613,619,625,633,639,649,662,666,673,683,694,708,717,724],{"__ignoreMap":339},[343,590,591,594],{"class":345,"line":346},[343,592,593],{"class":375},"permissions",[343,595,379],{"class":353},[343,597,598,601,603,606],{"class":345,"line":365},[343,599,600],{"class":375},"  contents",[343,602,354],{"class":353},[343,604,605],{"class":357},"read",[343,607,608],{"class":361},"            # default for every job in this workflow\n",[343,610,611],{"class":345,"line":372},[343,612,369],{"emptyLinePlaceholder":368},[343,614,615,617],{"class":345,"line":382},[343,616,376],{"class":375},[343,618,379],{"class":353},[343,620,621,623],{"class":345,"line":390},[343,622,385],{"class":375},[343,624,379],{"class":353},[343,626,627,629,631],{"class":345,"line":401},[343,628,393],{"class":375},[343,630,354],{"class":353},[343,632,398],{"class":357},[343,634,635,637],{"class":345,"line":409},[343,636,404],{"class":375},[343,638,379],{"class":353},[343,640,641,643,645,647],{"class":345,"line":423},[343,642,412],{"class":353},[343,644,415],{"class":375},[343,646,354],{"class":353},[343,648,420],{"class":357},[343,650,651,653,655,657,659],{"class":345,"line":431},[343,652,412],{"class":353},[343,654,450],{"class":375},[343,656,354],{"class":353},[343,658,455],{"class":357},[343,660,661],{"class":361},"        # no secrets here\n",[343,663,664],{"class":345,"line":445},[343,665,369],{"emptyLinePlaceholder":368},[343,667,668,671],{"class":345,"line":461},[343,669,670],{"class":375},"  deploy",[343,672,379],{"class":353},[343,674,675,678,680],{"class":345,"line":469},[343,676,677],{"class":375},"    needs",[343,679,354],{"class":353},[343,681,682],{"class":357},"test\n",[343,684,686,689,691],{"class":345,"line":685},13,[343,687,688],{"class":375},"    if",[343,690,354],{"class":353},[343,692,693],{"class":357},"github.ref == 'refs\u002Fheads\u002Fmain'\n",[343,695,697,700,702,705],{"class":345,"line":696},14,[343,698,699],{"class":375},"    environment",[343,701,354],{"class":353},[343,703,704],{"class":357},"production",[343,706,707],{"class":361},"   # deploy secrets live here, behind its protection rules\n",[343,709,711,713,715],{"class":345,"line":710},15,[343,712,393],{"class":375},[343,714,354],{"class":353},[343,716,398],{"class":357},[343,718,720,722],{"class":345,"line":719},16,[343,721,404],{"class":375},[343,723,379],{"class":353},[343,725,727,729,731,733],{"class":345,"line":726},17,[343,728,412],{"class":353},[343,730,450],{"class":375},[343,732,354],{"class":353},[343,734,735],{"class":357},".\u002Fdeploy.sh\n",[11,737,738,739,746],{},"Gitea Actions ",[18,740,742,743],{"href":30,"rel":741},[22],"ignores ",[190,744,745],{},"jobs.\u003Cjob_id>.environment",", so there the separation comes from separate repositories, runners or secret scopes.",[11,748,749,220,751,33],{},[179,750,219],{},[18,752,754],{"href":753},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fpipeline-based-access-control-a-build-job-that","Pipeline-based access control: a build job that should never reach production",[35,756,758],{"id":757},"cicd-sec-6-insufficient-credential-hygiene","CICD-SEC-6: Insufficient credential hygiene",[11,760,761,763],{},[179,762,181],{}," OWASP describes this as \"an attacker's ability to obtain and use various secrets and tokens\" spread through the pipeline, because of weak access control around them, insecure storage, or credentials that are too broad and live too long.",[11,765,766,768],{},[179,767,187],{}," A key was committed and then deleted, but it is still in the git history. A build argument carried a token into a container image, and it is still in a layer. A step printed a secret in a transformed form, so log masking missed it. Codecov says its attacker got in \"because of an error in Codecov's Docker image creation process that allowed the actor to extract the credential\" needed to modify the script.",[11,770,771,773],{},[179,772,207],{}," Scan the full git history, not just the current tree. Scan image layers and old build logs. Keep an inventory of long-lived keys with their age and owner.",[11,775,776,778,779,784],{},[179,777,213],{}," Stop storing long-lived cloud keys in CI. GitHub's guidance is that OpenID Connect lets a workflow ",[18,780,783],{"href":781,"rel":782},"https:\u002F\u002Fdocs.github.com\u002Fen\u002Factions\u002Freference\u002Fsecurity\u002Fsecure-use",[22],"\"create short-lived, well-scoped access tokens\""," instead. Where a static secret is unavoidable, rotate it on a schedule and restrict where it can be used. Block secrets at commit and push time, and use build secrets rather than build arguments in container builds.",[11,786,787,220,789,33],{},[179,788,219],{},[18,790,792],{"href":791},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fdig-secrets-out-of-git-history-build-logs","Dig secrets out of git history, build logs and image layers",[35,794,796],{"id":795},"cicd-sec-7-insecure-system-configuration","CICD-SEC-7: Insecure system configuration",[11,798,799,801],{},[179,800,181],{}," Source control servers, CI servers, runners and registries each have their own security settings. OWASP covers outdated components, default configurations, over-broad network access and systems running with admin rights on the host.",[11,803,804,806,807,812,813,816],{},[179,805,187],{}," Jenkins is the classic case. Its own documentation calls the script console ",[18,808,811],{"href":809,"rel":810},"https:\u002F\u002Fwww.jenkins.io\u002Fdoc\u002Fbook\u002Fmanaging\u002Fscript-console\u002F",[22],"\"a web-based Groovy shell into the Jenkins runtime\""," that \"can disable security, reconfigure security, even open a backdoor on the host operating system.\" Access needs the ",[190,814,815],{},"Administer"," permission, so any authorisation gap that grants it means code execution on the controller and every credential it stores.",[11,818,819,820,824],{},"Self-hosted runners are the other common gap. GitHub says they ",[18,821,823],{"href":781,"rel":822},[22],"\"should almost never be used for public repositories\"",". A runner that is not reset between jobs lets one job leave something behind for the next.",[11,826,827,829],{},[179,828,207],{}," Inventory each system with its version and owner, and check it against vendor advisories. Review who holds admin-level permissions. Check whether runners persist between jobs and what they can reach on the network.",[11,831,832,834],{},[179,833,213],{}," Patch, and manage configuration as code so it can be reviewed. Run builds on agents, not on the controller. Use ephemeral runners, restrict their network access, and never run the CI service as root.",[11,836,837,220,839,33],{},[179,838,219],{},[18,840,842],{"href":841},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Ffrom-a-login-to-code-execution-through-the","From a login to code execution through the script console",[35,844,846],{"id":845},"cicd-sec-8-ungoverned-usage-of-third-party-services","CICD-SEC-8: Ungoverned usage of third-party services",[11,848,849,851],{},[179,850,181],{}," Third parties connect through apps, OAuth grants, tokens, SSH keys, webhooks, and actions or plugins added with one line of configuration. OWASP's concern is that this takes seconds, often needs no approval, and runs with the pipeline's access.",[11,853,854,856,857,860,861,866,867,872,873,876,877,33],{},[179,855,187],{}," In March 2025 the ",[190,858,859],{},"tj-actions\u002Fchanged-files"," action was compromised. Per ",[18,862,865],{"href":863,"rel":864},"https:\u002F\u002Fnvd.nist.gov\u002Fvuln\u002Fdetail\u002FCVE-2025-30066",[22],"CVE-2025-30066",", tags v1 through v45.0.7 were modified on 14 and 15 March to point at a malicious commit. The ",[18,868,871],{"href":869,"rel":870},"https:\u002F\u002Fgithub.com\u002Fadvisories\u002FGHSA-mrrh-fwg8-r2c3",[22],"GitHub advisory"," says the code scanned the runner's memory for secrets, base64-encoded them and wrote them to build logs. Workflows that referenced those tags ran it. A related compromise of ",[190,874,875],{},"reviewdog\u002Faction-setup@v1"," on 11 March is tracked as ",[18,878,881],{"href":879,"rel":880},"https:\u002F\u002Fnvd.nist.gov\u002Fvuln\u002Fdetail\u002FCVE-2025-30154",[22],"CVE-2025-30154",[11,883,884,886],{},[179,885,207],{}," List every third-party action, plugin, app and webhook, with its permissions. Flag actions referenced by tag or branch instead of by commit.",[11,888,889,891,892,896],{},[179,890,213],{}," GitHub's guidance is to ",[18,893,895],{"href":781,"rel":894},[22],"\"pin references to actions to a commit SHA\"",", because \"a tag can be moved or deleted\" by whoever gains access to the action's repository:",[334,898,900],{"className":336,"code":899,"language":338,"meta":339,"style":339},"# a tag can be moved\n- uses: some-org\u002Fsome-action@v4\n# a full commit SHA cannot\n- uses: some-org\u002Fsome-action@\u003Cfull-40-character-commit-sha>   # v4.2.1\n",[190,901,902,907,919,924],{"__ignoreMap":339},[343,903,904],{"class":345,"line":346},[343,905,906],{"class":361},"# a tag can be moved\n",[343,908,909,912,914,916],{"class":345,"line":365},[343,910,911],{"class":353},"- ",[343,913,415],{"class":375},[343,915,354],{"class":353},[343,917,918],{"class":357},"some-org\u002Fsome-action@v4\n",[343,920,921],{"class":345,"line":372},[343,922,923],{"class":361},"# a full commit SHA cannot\n",[343,925,926,928,930,932,935],{"class":345,"line":382},[343,927,911],{"class":353},[343,929,415],{"class":375},[343,931,354],{"class":353},[343,933,934],{"class":357},"some-org\u002Fsome-action@\u003Cfull-40-character-commit-sha>",[343,936,937],{"class":361},"   # v4.2.1\n",[11,939,940],{},"Keep an allow-list of approved actions, review app permissions, remove integrations nobody uses, and verify signatures on incoming webhooks.",[11,942,943,220,945,33],{},[179,944,219],{},[18,946,948],{"href":947},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fwebhooks-and-integrations-forge-an-event-then-validate","Webhooks and integrations: forge an event, then validate signatures",[35,950,952],{"id":951},"cicd-sec-9-improper-artifact-integrity-validation","CICD-SEC-9: Improper artifact integrity validation",[11,954,955,957],{},[179,956,181],{}," OWASP describes an attacker with access to any one system in the pipeline being able to push \"malicious (although seemingly benign) code or artifacts down the pipeline\" because nothing validates code and artifacts along the way.",[11,959,960,962,963,968],{},[179,961,187],{}," SolarWinds is the reference case. CrowdStrike's analysis of the ",[18,964,967],{"href":965,"rel":966},"https:\u002F\u002Fwww.crowdstrike.com\u002Fen-us\u002Fblog\u002Fsunspot-malware-technical-analysis\u002F",[22],"SUNSPOT implant"," shows it watched for Orion builds and replaced one source file with a version containing the SUNBURST backdoor, then restored the original after the build. The source repository stayed clean, and the product that shipped contained the backdoor.",[11,970,971],{},"Codecov's compromise was found the other way round: a customer's checksum of the downloaded uploader did not match the one published on GitHub.",[11,973,974,976],{},[179,975,207],{}," At deploy time, check that the artifact's digest matches what CI produced and that it carries a valid signature from your pipeline's identity. Verify the hash of every script or binary a build downloads.",[11,978,979,981,982,987],{},[179,980,213],{}," Sign artifacts when they are built and verify the signature before every later step uses them. Generate provenance that records which pipeline built what, following ",[18,983,986],{"href":984,"rel":985},"https:\u002F\u002Fslsa.dev\u002F",[22],"SLSA",". Stop piping downloaded scripts straight into a shell without checking a published hash.",[11,989,990,220,992,33],{},[179,991,219],{},[18,993,995],{"href":994},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fsign-images-and-verify-before-deploy-with-cosign","Sign images and verify before deploy with cosign",[35,997,999],{"id":998},"cicd-sec-10-insufficient-logging-and-visibility","CICD-SEC-10: Insufficient logging and visibility",[11,1001,1002,1004],{},[179,1003,181],{}," OWASP describes an adversary carrying out malicious activity in the CI\u002FCD environment \"without being detected during any phase of the attack kill chain.\" Much of that activity uses programmatic access, which is often the least monitored.",[11,1006,1007,1009],{},[179,1008,187],{}," Every attack above can run through APIs with a token: change a protection rule, add a deploy key, upload an artifact. If the Git server's audit log was never enabled, or never leaves the server, none of it is seen.",[11,1011,1012],{},"The tj-actions compromise is the counter-example. The GitHub advisory says it \"was detected by StepSecurity when anomaly detection flagged an unauthorized outbound network call.\" A baseline of where your runners normally connect is enough to catch a build that phones home.",[11,1014,1015,1017],{},[179,1016,207],{}," Inventory every CI\u002FCD system, including registries and CD tools. Turn on audit and application logs, which are often off by default, and send them to one place.",[11,1019,1020,1022],{},[179,1021,213],{}," Alert on changes to branch protection, new tokens and deploy keys, new third-party apps, edits to workflow files, and outbound connections from runners to hosts they have never contacted.",[11,1024,1025,220,1027,33],{},[179,1026,219],{},[18,1028,1030],{"href":1029},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Faudit-logs-for-the-git-server-and-ci","Audit logs for the Git server and CI: what to keep and what to alert on",[35,1032,1034],{"id":1033},"cicd-security-best-practices-that-cover-several-risks-at-once","CI\u002FCD security best practices that cover several risks at once",[11,1036,1037],{},"Most of the fixes above reduce to a short list:",[1039,1040,1041,1045,1048,1051,1054,1057,1060,1063],"ul",{},[1042,1043,1044],"li",{},"Protect every branch that can deploy, with no exemptions (SEC-1).",[1042,1046,1047],{},"Give each identity and token an owner, a scope and an expiry (SEC-2).",[1042,1049,1050],{},"Pin dependencies and actions to hashes or commits, through a proxy you control (SEC-3, SEC-8).",[1042,1052,1053],{},"Never run code from a pull request in a job that holds secrets (SEC-4, SEC-5).",[1042,1055,1056],{},"Replace long-lived cloud keys with short-lived credentials from the job's identity (SEC-6).",[1042,1058,1059],{},"Use ephemeral runners with restricted network access (SEC-5, SEC-7).",[1042,1061,1062],{},"Sign what you build and verify it before you deploy (SEC-9).",[1042,1064,1065],{},"Send audit logs from every pipeline system to one place, and alert on changes to trust (SEC-10).",[11,1067,1068,1069,33],{},"A one-page version, with a check per risk, is in our ",[18,1070,1072],{"href":1071},"\u002Fchecklist","CI\u002FCD pipeline hardening checklist",[35,1074,1076],{"id":1075},"practise-each-attack-on-a-real-pipeline","Practise each attack on a real pipeline",[11,1078,1079,1080,1084,1085,33],{},"Every risk above maps to a lab in ",[18,1081,1083],{"href":1082},"\u002Fcourses\u002Fdevsecops","DevSecOps: CI\u002FCD Pipeline Security",". You attack a working Git server and CI runner in your browser, then rebuild the pipeline so the same attack fails. The first labs are ",[18,1086,1088],{"href":1087},"\u002Ffree","free to start",[1090,1091,1092],"style",{},"html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":339,"searchDepth":365,"depth":365,"links":1094},[1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107],{"id":37,"depth":365,"text":38},{"id":174,"depth":365,"text":175},{"id":227,"depth":365,"text":228},{"id":259,"depth":365,"text":260},{"id":321,"depth":365,"text":322},{"id":556,"depth":365,"text":557},{"id":757,"depth":365,"text":758},{"id":795,"depth":365,"text":796},{"id":845,"depth":365,"text":846},{"id":951,"depth":365,"text":952},{"id":998,"depth":365,"text":999},{"id":1033,"depth":365,"text":1034},{"id":1075,"depth":365,"text":1076},"ci-cd-security","2026-11-26","CI\u002FCD pipeline security through the OWASP Top 10 CI\u002FCD Security Risks: one real attack per risk, how to detect it, and how to fix it.",false,"md","ci cd pipeline security",{},"\u002Fblog\u002Fci-cd-pipeline-security-risks",{"title":6,"description":1110},"blog\u002Fci-cd-pipeline-security-risks","7QFujr9NSC8spdUB3QEoWWSa4ITMkjOY0fthpjLoqhI",{"id":1120,"title":1121,"body":1122,"cluster":1645,"date":1109,"description":1646,"draft":1111,"extension":1112,"keyword":1647,"meta":1648,"navigation":368,"path":1649,"seo":1650,"stem":1651,"__hash__":1652},"blog\u002Fblog\u002Fdependency-confusion.md","Dependency confusion: how a public package hijacks a build",{"type":8,"value":1123,"toc":1625},[1124,1127,1134,1138,1141,1169,1192,1202,1211,1215,1218,1223,1242,1245,1249,1259,1263,1266,1275,1279,1283,1303,1306,1310,1324,1343,1346,1350,1353,1400,1404,1408,1414,1442,1451,1492,1496,1508,1516,1522,1526,1539,1557,1571,1575,1588,1592,1598,1619,1622],[11,1125,1126],{},"Dependency confusion happens when a build that should install your internal package installs someone else's public package with the same name instead. The attacker never touches your repository or your private package index. They publish one package to a public registry and wait for your build to choose it.",[11,1128,1129,1130,33],{},"It is one of the cheapest software supply chain attacks to run, and one of the cheapest to prevent. This post covers how the attack works, why package managers allow it, two real cases, and the configuration that closes it. For the wider picture of supply chain attacks and build controls, see ",[18,1131,1133],{"href":1132},"\u002Fblog\u002Fsoftware-supply-chain-attacks","Software supply chain attacks and how builds stop them",[35,1135,1137],{"id":1136},"how-a-dependency-confusion-attack-works","How a dependency confusion attack works",[11,1139,1140],{},"The attack needs three conditions:",[1142,1143,1144,1157,1163],"ol",{},[1042,1145,1146,1149,1150,511,1153,1156],{},[179,1147,1148],{},"An internal package name the attacker can learn."," Names leak through ",[190,1151,1152],{},"package.json",[190,1154,1155],{},"requirements.txt"," files in public repositories, bundled JavaScript served to browsers, error messages and job posts.",[1042,1158,1159,1162],{},[179,1160,1161],{},"A build that can see both a private package index and a public one."," For example, pip configured with an internal index plus PyPI, or a registry proxy that merges internal and public packages under one URL.",[1042,1164,1165,1168],{},[179,1166,1167],{},"A resolver that picks the \"best\" version across all sources."," If the public package has a higher version number than the internal one, the resolver installs the public one.",[11,1170,1171,1172,1175,1176,1179,1180,1182,1183,1186,1187,1189,1190,33],{},"When those line up, the attacker publishes ",[190,1173,1174],{},"acme-billing"," version ",[190,1177,1178],{},"99.0.0"," to the public registry. The next build resolves ",[190,1181,1174],{},", sees ",[190,1184,1185],{},"1.4.2"," internally and ",[190,1188,1178],{}," publicly, and installs ",[190,1191,1178],{},[11,1193,1194,1195,511,1198,1201],{},"The attacker does not need your code to import the package. npm runs ",[190,1196,1197],{},"preinstall",[190,1199,1200],{},"postinstall"," scripts at install time, and Python source distributions can run code while they build. Code execution happens on the developer laptop or the CI runner the moment the install runs, with whatever credentials that machine holds.",[11,1203,1204,1205,1210],{},"OWASP lists dependency confusion as the first attack vector under ",[18,1206,1209],{"href":1207,"rel":1208},"https:\u002F\u002Fowasp.github.io\u002Fwww-project-top-10-ci-cd-security-risks\u002FCICD-SEC-03-Dependency-Chain-Abuse",[22],"CICD-SEC-3, Dependency Chain Abuse",": \"publication of malicious packages in public repositories with the same name as internal package names.\"",[35,1212,1214],{"id":1213},"why-package-managers-choose-the-public-package","Why package managers choose the public package",[11,1216,1217],{},"Package managers were built to find the newest compatible version of a name. Most have no concept of \"this name belongs to my organisation, never look for it anywhere else\" unless you configure one.",[1219,1220,1222],"h3",{"id":1221},"pip-and-extra-index-url","pip and --extra-index-url",[11,1224,1225,1228,1229,1232,1233,1238,1239,1241],{},[190,1226,1227],{},"--index-url"," sets the main index and ",[190,1230,1231],{},"--extra-index-url"," adds more. pip collects candidate versions from every index it is given and picks the best match; it does not treat your private index as the authority for your package names. The ",[18,1234,1237],{"href":1235,"rel":1236},"https:\u002F\u002Fpip.pypa.io\u002Fen\u002Fstable\u002Fcli\u002Fpip_install\u002F",[22],"pip documentation"," is direct about it: \"Using the ",[190,1240,1231],{}," option to search for packages which are not in the main repository (for example, private packages) is unsafe.\"",[11,1243,1244],{},"The common setup, PyPI as the main index and the internal server as an extra, is exactly the exposed one.",[1219,1246,1248],{"id":1247},"npm-and-unscoped-names","npm and unscoped names",[11,1250,1251,1252,1254,1255,1258],{},"An unscoped npm package name such as ",[190,1253,1174],{}," lives in one global namespace. If your project resolves it through a registry that also proxies the public npm registry, a public package with that name and a higher version can win. Scoped names such as ",[190,1256,1257],{},"@acme\u002Fbilling"," can be tied to a single registry, which is why scopes are part of the fix below.",[1219,1260,1262],{"id":1261},"private-registries-that-proxy-a-public-one","Private registries that proxy a public one",[11,1264,1265],{},"Many teams run Artifactory, Nexus, Azure Artifacts or a similar server as a single endpoint that serves internal packages and caches public ones. That looks safe because the build only has one URL. Whether it is safe depends on what the server does when the same name exists on both sides. If it merges versions from both, you have moved the confusion into the registry rather than removed it.",[11,1267,1268,1269,1274],{},"Azure Artifacts, for example, lets a feed owner decide per package whether versions from a public registry may be saved to the feed, and its ",[18,1270,1273],{"href":1271,"rel":1272},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fdevops\u002Fartifacts\u002Fconcepts\u002Fupstream-behavior",[22],"documentation"," says that option is off by default. Check what your own registry does; do not assume.",[35,1276,1278],{"id":1277},"real-dependency-confusion-attacks","Real dependency confusion attacks",[1219,1280,1282],{"id":1281},"alex-birsans-research-2021","Alex Birsan's research, 2021",[11,1284,1285,1286,1290,1291,1293,1294,1296,1297,1302],{},"In ",[18,1287,1289],{"href":273,"rel":1288},[22],"February 2021",", Alex Birsan published the research that named the attack. Working under bug bounty programmes and agreed tests, he found internal package names in ",[190,1292,1152],{}," files and published public packages with those names. A ",[190,1295,1197],{}," script reported back over DNS, which showed the company IP address the install came from, the username and the home directory. ",[18,1298,1301],{"href":1299,"rel":1300},"https:\u002F\u002Fwww.bleepingcomputer.com\u002Fnews\u002Fsecurity\u002Fresearcher-hacks-over-35-tech-firms-in-novel-supply-chain-attack\u002F",[22],"BleepingComputer"," reported that the packages ran inside more than 35 companies, including Microsoft, Apple, PayPal, Shopify, Netflix, Tesla, Yelp and Uber, and earned him over $130,000.",[11,1304,1305],{},"Microsoft assigned CVE-2021-24105 to Azure Artifacts and described the root cause as a design flaw in package managers rather than a bug, which can only be fixed through configuration. That framing still holds: there is no patch to install, only settings to get right.",[1219,1307,1309],{"id":1308},"pytorch-nightly-and-torchtriton-2022","PyTorch nightly and torchtriton, 2022",[11,1311,1312,1313,1315,1316,1318,1319,1323],{},"Between 25 and 30 December 2022, anyone who installed PyTorch nightly on Linux with pip also installed a malicious ",[190,1314,287],{}," from PyPI. PyTorch shipped ",[190,1317,287],{}," from its own nightly index, and someone registered the same name on PyPI. The ",[18,1320,1322],{"href":282,"rel":1321},[22],"PyTorch post-mortem"," says: \"Since the PyPI index takes precedence, this malicious package was being installed instead of the version from our official repository.\"",[11,1325,1326,1327,1330,1331,1334,1335,1338,1339,1342],{},"The malicious binary collected system information, ",[190,1328,1329],{},"\u002Fetc\u002Fpasswd",", ",[190,1332,1333],{},"$HOME\u002F.gitconfig",", files under ",[190,1336,1337],{},"$HOME\u002F.ssh"," and the first 1,000 files in the home directory, and sent them out through DNS queries. PyTorch removed the dependency, renamed it to ",[190,1340,1341],{},"pytorch-triton",", and registered a placeholder package on PyPI so the name could not be taken again.",[11,1344,1345],{},"Neither case needed a stolen credential or a code change. Both used ordinary resolver behaviour.",[35,1347,1349],{"id":1348},"how-to-check-whether-your-build-is-exposed","How to check whether your build is exposed",[11,1351,1352],{},"You can answer this in an afternoon:",[1039,1354,1355,1361,1367,1388,1394],{},[1042,1356,1357,1360],{},[179,1358,1359],{},"List every internal package name"," your builds install, across npm, PyPI, Maven, NuGet and anything else you publish internally.",[1042,1362,1363,1366],{},[179,1364,1365],{},"Check whether each name exists publicly."," A name that is free on the public registry is a name an attacker can take.",[1042,1368,1369,354,1372,1330,1375,1330,1378,1330,1381,1330,1384,1387],{},[179,1370,1371],{},"Read the install configuration your CI actually uses",[190,1373,1374],{},"pip.conf",[190,1376,1377],{},"PIP_EXTRA_INDEX_URL",[190,1379,1380],{},".npmrc",[190,1382,1383],{},"settings.xml",[190,1385,1386],{},"nuget.config",". Look for more than one source, or a public registry listed alongside the internal one.",[1042,1389,1390,1393],{},[179,1391,1392],{},"Check what your registry proxy does"," when the same name exists internally and publicly.",[1042,1395,1396,1399],{},[179,1397,1398],{},"Check your lockfiles"," for internal package names resolved from a public URL.",[35,1401,1403],{"id":1402},"how-to-prevent-dependency-confusion","How to prevent dependency confusion",[1219,1405,1407],{"id":1406},"use-a-single-source-and-make-it-the-authority","Use a single source, and make it the authority",[11,1409,1410,1411,1413],{},"Point every client at one index that you control, and remove ",[190,1412,1231],{}," from CI. That index can proxy public packages, but it should refuse public versions of names you own.",[334,1415,1419],{"className":1416,"code":1417,"language":1418,"meta":339,"style":339},"language-bash shiki shiki-themes github-dark","pip install --index-url https:\u002F\u002Fpypi.internal.example.com\u002Fsimple -r requirements.txt\n","bash",[190,1420,1421],{"__ignoreMap":339},[343,1422,1423,1427,1430,1433,1436,1439],{"class":345,"line":346},[343,1424,1426],{"class":1425},"svObZ","pip",[343,1428,1429],{"class":357}," install",[343,1431,1432],{"class":349}," --index-url",[343,1434,1435],{"class":357}," https:\u002F\u002Fpypi.internal.example.com\u002Fsimple",[343,1437,1438],{"class":349}," -r",[343,1440,1441],{"class":357}," requirements.txt\n",[11,1443,1444,1445,1450],{},"If you use uv, its ",[18,1446,1449],{"href":1447,"rel":1448},"https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002Fconcepts\u002Findexes\u002F",[22],"default index strategy"," stops at the first index that has a given package, and the docs say the intent is \"to prevent 'dependency confusion' attacks.\" You can also pin a package to one index so it is never looked up anywhere else:",[334,1452,1456],{"className":1453,"code":1454,"language":1455,"meta":339,"style":339},"language-toml shiki shiki-themes github-dark","[[tool.uv.index]]\nname = \"internal\"\nurl = \"https:\u002F\u002Fpypi.internal.example.com\u002Fsimple\"\nexplicit = true\n\n[tool.uv.sources]\nacme-billing = { index = \"internal\" }\n","toml",[190,1457,1458,1463,1468,1473,1478,1482,1487],{"__ignoreMap":339},[343,1459,1460],{"class":345,"line":346},[343,1461,1462],{},"[[tool.uv.index]]\n",[343,1464,1465],{"class":345,"line":365},[343,1466,1467],{},"name = \"internal\"\n",[343,1469,1470],{"class":345,"line":372},[343,1471,1472],{},"url = \"https:\u002F\u002Fpypi.internal.example.com\u002Fsimple\"\n",[343,1474,1475],{"class":345,"line":382},[343,1476,1477],{},"explicit = true\n",[343,1479,1480],{"class":345,"line":390},[343,1481,369],{"emptyLinePlaceholder":368},[343,1483,1484],{"class":345,"line":401},[343,1485,1486],{},"[tool.uv.sources]\n",[343,1488,1489],{"class":345,"line":409},[343,1490,1491],{},"acme-billing = { index = \"internal\" }\n",[1219,1493,1495],{"id":1494},"scope-internal-names-and-reserve-them-publicly","Scope internal names and reserve them publicly",[11,1497,1498,1499,1504,1505,1507],{},"On npm, publish internal packages under an organisation scope and map that scope to your registry, as the ",[18,1500,1503],{"href":1501,"rel":1502},"https:\u002F\u002Fdocs.npmjs.com\u002Fcli\u002Fv10\u002Fusing-npm\u002Fscope",[22],"npm scope docs"," describe. Commit the ",[190,1506,1380],{}," to each repository so CI uses the same mapping:",[334,1509,1514],{"className":1510,"code":1512,"language":1513,"meta":339},[1511],"language-text","@acme:registry=https:\u002F\u002Fnpm.internal.example.com\u002F\n","text",[190,1515,1512],{"__ignoreMap":339},[11,1517,1518,1519,1521],{},"Where scopes do not exist, register your internal names on the public registry as empty placeholder packages, as PyTorch did with ",[190,1520,287],{},". The name cannot be taken if you hold it.",[1219,1523,1525],{"id":1524},"lock-versions-and-hashes","Lock versions and hashes",[11,1527,1528,1529,1534,1535,1538],{},"A lockfile with hashes means a new version on any registry cannot enter the build without a reviewed change. With pip, ",[18,1530,1533],{"href":1531,"rel":1532},"https:\u002F\u002Fpip.pypa.io\u002Fen\u002Fstable\u002Ftopics\u002Fsecure-installs\u002F",[22],"hash-checking mode"," requires every requirement to be pinned with ",[190,1536,1537],{},"=="," and carry a hash:",[334,1540,1542],{"className":1416,"code":1541,"language":1418,"meta":339,"style":339},"pip install --require-hashes -r requirements.txt\n",[190,1543,1544],{"__ignoreMap":339},[343,1545,1546,1548,1550,1553,1555],{"class":345,"line":346},[343,1547,1426],{"class":1425},[343,1549,1429],{"class":357},[343,1551,1552],{"class":349}," --require-hashes",[343,1554,1438],{"class":349},[343,1556,1441],{"class":357},[11,1558,1559,1560,1563,1564,1567,1568,1570],{},"With npm, ",[190,1561,1562],{},"npm ci"," installs exactly what ",[190,1565,1566],{},"package-lock.json"," says and fails if it does not match ",[190,1569,1152],{},". In both cases, review lockfile diffs for a changed source URL, not just a changed version.",[1219,1572,1574],{"id":1573},"treat-package-installation-as-code-execution","Treat package installation as code execution",[11,1576,1577,1578,1581,1582,1584,1585,1587],{},"Install steps run third-party code. Run them in a job that holds no deploy secrets, add ",[190,1579,1580],{},"--ignore-scripts"," to ",[190,1583,1562],{}," where your dependencies allow it, and restrict the runner's outbound network to the registries it needs. Birsan's packages and the ",[190,1586,287],{}," binary both reported back over DNS, so egress rules should cover DNS too.",[35,1589,1591],{"id":1590},"practise-dependency-confusion-in-a-lab","Practise dependency confusion in a lab",[11,1593,1594,1595,1597],{},"Module 5 of our course ",[18,1596,1083],{"href":1082}," covers dependencies hands-on, in the browser, against a real package index and CI runner:",[1039,1599,1600,1605,1612],{},[1042,1601,1602,1604],{},[18,1603,318],{"href":317},": a company pulls internal packages from a private index that falls back to a public one, and you get your package installed in its build.",[1042,1606,1607,1611],{},[18,1608,1610],{"href":1609},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Ftyposquatting-and-install-scripts-that-run-on-install","Typosquatting and install scripts that run on install",": code execution on the runner from a name one keystroke away from a popular package.",[1042,1613,1614,1618],{},[18,1615,1617],{"href":1616},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Flockfiles-hash-pinning-and-pinning-third-party-actions","Lockfiles, hash pinning and pinning third-party actions to a commit",": you lock and hash every dependency, then replay both attacks and watch the build refuse them.",[11,1620,1621],{},"The attack lab shows how little it takes. The defence lab shows the build saying no.",[1090,1623,1624],{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":339,"searchDepth":365,"depth":365,"links":1626},[1627,1628,1633,1637,1638,1644],{"id":1136,"depth":365,"text":1137},{"id":1213,"depth":365,"text":1214,"children":1629},[1630,1631,1632],{"id":1221,"depth":372,"text":1222},{"id":1247,"depth":372,"text":1248},{"id":1261,"depth":372,"text":1262},{"id":1277,"depth":365,"text":1278,"children":1634},[1635,1636],{"id":1281,"depth":372,"text":1282},{"id":1308,"depth":372,"text":1309},{"id":1348,"depth":365,"text":1349},{"id":1402,"depth":365,"text":1403,"children":1639},[1640,1641,1642,1643],{"id":1406,"depth":372,"text":1407},{"id":1494,"depth":372,"text":1495},{"id":1524,"depth":372,"text":1525},{"id":1573,"depth":372,"text":1574},{"id":1590,"depth":365,"text":1591},"supply-chain","How a dependency confusion attack swaps a private package for a public one, why package managers allow it, and how to set up a private index safely.","dependency confusion",{},"\u002Fblog\u002Fdependency-confusion",{"title":1121,"description":1646},"blog\u002Fdependency-confusion","2v7zwrCPhGz9bDNso6Ug-LMboMw13BKgCxHqqLF1WLc",{"id":1654,"title":1655,"body":1656,"cluster":1108,"date":1109,"description":2184,"draft":1111,"extension":1112,"keyword":2185,"meta":2186,"navigation":368,"path":543,"seo":2187,"stem":2188,"__hash__":2189},"blog\u002Fblog\u002Fpoisoned-pipeline-execution.md","Poisoned pipeline execution: direct, indirect and public",{"type":8,"value":1657,"toc":2174},[1658,1669,1672,1676,1679,1682,1686,1689,1692,1778,1785,1791,1799,1803,1806,1813,1831,1836,1844,1848,1851,1873,1880,1884,1890,1893,1978,1989,2008,2029,2033,2054,2057,2101,2110,2118,2122,2125,2131,2135,2141,2150,2157,2166,2172],[11,1659,1660,1661,1665,1666,33],{},"Poisoned pipeline execution (PPE) is the attack where you never touch the build server. You change something the pipeline runs, and the pipeline runs it for you, with its own secrets and permissions. It is CICD-SEC-4 in the ",[18,1662,23],{"href":1663,"rel":1664},"https:\u002F\u002Fowasp.org\u002Fwww-project-top-10-ci-cd-security-risks\u002FCICD-SEC-04-Poisoned-Pipeline-Execution",[22],", and one of the ten risks covered in our guide to ",[18,1667,1668],{"href":1115},"CI\u002FCD pipeline security",[11,1670,1671],{},"OWASP splits it into three forms: direct, indirect and public. Each needs a different fix, so it is worth being precise about which one you have.",[35,1673,1675],{"id":1674},"what-poisoned-pipeline-execution-means","What poisoned pipeline execution means",[11,1677,1678],{},"OWASP describes PPE as the ability of an attacker with access to source control, but without access to the build environment, to manipulate the build process by injecting commands into the pipeline. Those commands then run with the pipeline's identity.",[11,1680,1681],{},"The attacker's foothold is small: push access to one branch, or the right to open a pull request. What they gain is whatever the job holds. That is often a cloud key, a registry token, a deploy key or a source control token with write access.",[35,1683,1685],{"id":1684},"direct-ppe-editing-the-workflow-file","Direct PPE: editing the workflow file",[11,1687,1688],{},"In direct PPE the attacker edits the CI configuration itself. OWASP's example is a GitHub Actions workflow that runs on every push: the attacker creates a branch, edits the workflow to read the repository's cloud credentials and send them out, and pushes. The push triggers the edited workflow.",[11,1690,1691],{},"The vulnerable shape is a workflow that runs on any branch and hands secrets to every job:",[334,1693,1695],{"className":336,"code":1694,"language":338,"meta":339,"style":339},"on: push                    # every branch, including the attacker's\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    env:\n      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - run: make build\n",[190,1696,1697,1709,1713,1719,1726,1734,1741,1751,1757,1767],{"__ignoreMap":339},[343,1698,1699,1701,1703,1706],{"class":345,"line":346},[343,1700,350],{"class":349},[343,1702,354],{"class":353},[343,1704,1705],{"class":357},"push",[343,1707,1708],{"class":361},"                    # every branch, including the attacker's\n",[343,1710,1711],{"class":345,"line":365},[343,1712,369],{"emptyLinePlaceholder":368},[343,1714,1715,1717],{"class":345,"line":372},[343,1716,376],{"class":375},[343,1718,379],{"class":353},[343,1720,1721,1724],{"class":345,"line":382},[343,1722,1723],{"class":375},"  build",[343,1725,379],{"class":353},[343,1727,1728,1730,1732],{"class":345,"line":390},[343,1729,393],{"class":375},[343,1731,354],{"class":353},[343,1733,398],{"class":357},[343,1735,1736,1739],{"class":345,"line":401},[343,1737,1738],{"class":375},"    env",[343,1740,379],{"class":353},[343,1742,1743,1746,1748],{"class":345,"line":409},[343,1744,1745],{"class":375},"      AWS_SECRET_ACCESS_KEY",[343,1747,354],{"class":353},[343,1749,1750],{"class":357},"${{ secrets.AWS_SECRET_ACCESS_KEY }}\n",[343,1752,1753,1755],{"class":345,"line":423},[343,1754,404],{"class":375},[343,1756,379],{"class":353},[343,1758,1759,1761,1763,1765],{"class":345,"line":431},[343,1760,412],{"class":353},[343,1762,415],{"class":375},[343,1764,354],{"class":353},[343,1766,420],{"class":357},[343,1768,1769,1771,1773,1775],{"class":345,"line":445},[343,1770,412],{"class":353},[343,1772,450],{"class":375},[343,1774,354],{"class":353},[343,1776,1777],{"class":357},"make build\n",[11,1779,1780,1781,1784],{},"Branch protection on ",[190,1782,1783],{},"main"," does not help here. The workflow that runs is the one on the attacker's branch, and nobody reviewed it.",[11,1786,1787,1790],{},[179,1788,1789],{},"Fix:"," keep secrets out of any job that runs on unprotected branches. Put them in a job gated to protected branches or to a protected environment, and give every branch that can trigger a sensitive pipeline a matching protection rule.",[11,1792,1793,220,1795,33],{},[179,1794,219],{},[18,1796,1798],{"href":1797},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fdirect-change-the-workflow-file-in-a-pull","Direct: change the workflow file in a pull request",[35,1800,1802],{"id":1801},"indirect-ppe-poisoning-the-files-the-pipeline-calls","Indirect PPE: poisoning the files the pipeline calls",[11,1804,1805],{},"Sometimes the workflow file cannot be changed: it is loaded from a protected branch, kept in a separate repository, or defined in the CI server. OWASP calls this indirect PPE. The attacker leaves the configuration alone and changes a file it runs. OWASP lists Makefiles, scripts referenced by the pipeline, test code, and the configuration files of linters and scanners.",[11,1807,1808,1809,1812],{},"OWASP's example is a Jenkins pipeline whose Jenkinsfile comes from the protected main branch. It loads cloud credentials and runs ",[190,1810,1811],{},"make build",". The attacker opens a pull request that adds one command to the Makefile, and the trusted Jenkinsfile runs it with the credentials loaded.",[11,1814,1815,1816,1819,1820,1823,1824,511,1826,1828,1829,33],{},"This is the version teams miss most often, because the review rule on ",[190,1817,1818],{},".github\u002Fworkflows\u002F"," or the Jenkinsfile looks like it covers the pipeline. It covers the entry point, not what the entry point executes. Package manager hooks count too: GitHub Security Lab notes that an ",[190,1821,1822],{},"npm install"," will run ",[190,1825,1197],{},[190,1827,1200],{}," scripts from the pull request's ",[190,1830,1152],{},[11,1832,1833,1835],{},[179,1834,1789],{}," treat every file a privileged job executes as part of the pipeline. If a job holds secrets, it must not run code from an unreviewed branch at all.",[11,1837,1838,220,1840,33],{},[179,1839,219],{},[18,1841,1843],{"href":1842},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Findirect-leave-the-workflow-alone-and-poison-the","Indirect: leave the workflow alone and poison the Makefile it calls",[35,1845,1847],{"id":1846},"public-ppe-3pe-anyone-with-a-fork","Public PPE (3PE): anyone with a fork",[11,1849,1850],{},"Public PPE, which OWASP abbreviates as 3PE, is direct or indirect PPE carried out by an anonymous user against a public repository. Open source projects accept pull requests from anyone, and many build them automatically. OWASP adds a less obvious risk: if the same CI instance also builds private projects, a public pull request can reach their secrets too.",[11,1852,1853,1854,1856,1857,1862,1863,1866,1867,1872],{},"GitHub's defaults for the ",[190,1855,531],{}," trigger are built for this case. ",[18,1858,1861],{"href":1859,"rel":1860},"https:\u002F\u002Fdocs.github.com\u002Fen\u002Factions\u002Freference\u002Fworkflows-and-actions\u002Fevents-that-trigger-workflows",[22],"Per the documentation",", \"with the exception of ",[190,1864,1865],{},"GITHUB_TOKEN",", secrets are not passed to the runner when a workflow is triggered from a forked repository,\" and the token \"has read-only permissions in pull requests from forked repositories.\" Maintainers can also ",[18,1868,1871],{"href":1869,"rel":1870},"https:\u002F\u002Fdocs.github.com\u002Fen\u002Factions\u002Fhow-tos\u002Fmanage-workflow-runs\u002Fapprove-runs-from-forks",[22],"require approval"," before workflows from fork pull requests run.",[11,1874,1875,1876,1879],{},"Those defaults stop holding when a workflow uses a privileged trigger, or runs on a self-hosted runner. GitHub's guidance is that self-hosted runners ",[18,1877,823],{"href":781,"rel":1878},[22],", because any user can open a pull request and compromise the environment.",[35,1881,1883],{"id":1882},"why-pull_request_target-is-the-github-actions-trigger-to-audit-first","Why pull_request_target is the GitHub Actions trigger to audit first",[11,1885,1886,1887,1889],{},"Most real PPE in GitHub Actions goes through ",[190,1888,358],{},". GitHub's documentation says it \"runs in the context of the default branch of the base repository\" and warns that running untrusted code on it can lead to \"cache poisoning and granting unintended access to write privileges or secrets.\"",[11,1891,1892],{},"The trigger is safe as long as the workflow never runs code from the pull request, for example when it only labels or comments. It becomes PPE the moment it checks out the pull request's head and builds it:",[334,1894,1896],{"className":336,"code":1895,"language":338,"meta":339,"style":339},"on: pull_request_target\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n        with:\n          ref: ${{ github.event.pull_request.head.sha }}   # untrusted code\n      - run: npm install && npm test                        # runs it with secrets in reach\n",[190,1897,1898,1907,1911,1917,1923,1931,1937,1947,1953,1964],{"__ignoreMap":339},[343,1899,1900,1902,1904],{"class":345,"line":346},[343,1901,350],{"class":349},[343,1903,354],{"class":353},[343,1905,1906],{"class":357},"pull_request_target\n",[343,1908,1909],{"class":345,"line":365},[343,1910,369],{"emptyLinePlaceholder":368},[343,1912,1913,1915],{"class":345,"line":372},[343,1914,376],{"class":375},[343,1916,379],{"class":353},[343,1918,1919,1921],{"class":345,"line":382},[343,1920,385],{"class":375},[343,1922,379],{"class":353},[343,1924,1925,1927,1929],{"class":345,"line":390},[343,1926,393],{"class":375},[343,1928,354],{"class":353},[343,1930,398],{"class":357},[343,1932,1933,1935],{"class":345,"line":401},[343,1934,404],{"class":375},[343,1936,379],{"class":353},[343,1938,1939,1941,1943,1945],{"class":345,"line":409},[343,1940,412],{"class":353},[343,1942,415],{"class":375},[343,1944,354],{"class":353},[343,1946,420],{"class":357},[343,1948,1949,1951],{"class":345,"line":423},[343,1950,426],{"class":375},[343,1952,379],{"class":353},[343,1954,1955,1957,1959,1961],{"class":345,"line":431},[343,1956,434],{"class":375},[343,1958,354],{"class":353},[343,1960,439],{"class":357},[343,1962,1963],{"class":361},"   # untrusted code\n",[343,1965,1966,1968,1970,1972,1975],{"class":345,"line":445},[343,1967,412],{"class":353},[343,1969,450],{"class":375},[343,1971,354],{"class":353},[343,1973,1974],{"class":357},"npm install && npm test",[343,1976,1977],{"class":361},"                        # runs it with secrets in reach\n",[11,1979,1980,1981,1984,1985,1988],{},"GitHub Security Lab named this a ",[18,1982,485],{"href":483,"rel":1983},[22]," in 2021. It also notes that ",[190,1986,1987],{},"actions\u002Fcheckout"," persists the token to disk by default, so code that runs later in the job can read it.",[11,1990,1991,1992,1995,1996,2000,2001,2003,2004,2007],{},"The Ultralytics compromise in December 2024 is a recent example. ",[18,1993,493],{"href":491,"rel":1994},[22]," says the attack started with \"a compromise of the projects' GitHub Actions workflows\" and targeted the GitHub Actions cache used during the build. Four malicious versions reached PyPI. ",[18,1997,1999],{"href":497,"rel":1998},[22],"William Woodruff's analysis"," points to a ",[190,2002,358],{}," workflow and a composite action that ran ",[190,2005,2006],{},"git pull origin ${{ github.head_ref || github.ref }}",", putting the branch name straight into a shell.",[11,2009,2010,2011,2019,2020,2025,2026,2028],{},"GitHub has been narrowing this trigger. From 8 December 2025, ",[18,2012,2015,2016,2018],{"href":2013,"rel":2014},"https:\u002F\u002Fgithub.blog\u002Fchangelog\u002F2025-11-07-actions-pull_request_target-and-environment-branch-protections-changes\u002F",[22],"the workflow file and checkout commit for ",[190,2017,358],{}," always come from the default branch",". From 2 December 2026, ",[18,2021,2023,539],{"href":535,"rel":2022},[22],[190,2024,358],{}," unless an Actions event policy allows it. Private and internal repositories are not affected. Neither change covers ",[190,2027,514],{},", which GitHub says \"is able to access secrets and write tokens\", or script injection, or indirect PPE through a branch that runs with secrets.",[35,2030,2032],{"id":2031},"script-injection-ppe-without-changing-a-file","Script injection: PPE without changing a file",[11,2034,2035,2036,2041,2042,1330,2045,1330,2048,511,2051,33],{},"A workflow does not need to run the attacker's code to run the attacker's commands. If it puts an attacker-controlled value into a shell step, the value becomes code. GitHub Security Lab lists the ",[18,2037,2040],{"href":2038,"rel":2039},"https:\u002F\u002Fsecuritylab.github.com\u002Fresources\u002Fgithub-actions-untrusted-input\u002F",[22],"untrusted fields",", including ",[190,2043,2044],{},"github.event.issue.title",[190,2046,2047],{},"github.event.pull_request.body",[190,2049,2050],{},"github.event.comment.body",[190,2052,2053],{},"github.head_ref",[11,2055,2056],{},"The fix GitHub recommends is to pass the value through an environment variable, so the shell treats it as data:",[334,2058,2060],{"className":336,"code":2059,"language":338,"meta":339,"style":339},"- name: print title\n  env:\n    TITLE: ${{ github.event.issue.title }}\n  run: echo \"$TITLE\"\n",[190,2061,2062,2074,2081,2091],{"__ignoreMap":339},[343,2063,2064,2066,2069,2071],{"class":345,"line":346},[343,2065,911],{"class":353},[343,2067,2068],{"class":375},"name",[343,2070,354],{"class":353},[343,2072,2073],{"class":357},"print title\n",[343,2075,2076,2079],{"class":345,"line":365},[343,2077,2078],{"class":375},"  env",[343,2080,379],{"class":353},[343,2082,2083,2086,2088],{"class":345,"line":372},[343,2084,2085],{"class":375},"    TITLE",[343,2087,354],{"class":353},[343,2089,2090],{"class":357},"${{ github.event.issue.title }}\n",[343,2092,2093,2096,2098],{"class":345,"line":382},[343,2094,2095],{"class":375},"  run",[343,2097,354],{"class":353},[343,2099,2100],{"class":357},"echo \"$TITLE\"\n",[11,2102,2103,2104,2107,2108,33],{},"The vulnerable version is the same step with ",[190,2105,2106],{},"${{ github.event.issue.title }}"," written directly inside ",[190,2109,522],{},[11,2111,2112,220,2114,33],{},[179,2113,219],{},[18,2115,2117],{"href":2116},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fscript-injection-through-a-branch-name-and-an","Script injection through a branch name and an issue title",[35,2119,2121],{"id":2120},"how-to-find-poisoned-pipeline-execution-in-your-workflows","How to find poisoned pipeline execution in your workflows",[11,2123,2124],{},"Go through each repository's workflows and answer these questions:",[334,2126,2129],{"className":2127,"code":2128,"language":1513},[1511],"[ ] Which workflows use pull_request_target or workflow_run?\n[ ] Do any of them check out the pull request head, or download its artifacts?\n[ ] Which jobs can read secrets, and on which branches do they run?\n[ ] Does every branch that triggers a job with secrets have a protection rule?\n[ ] Which files does each privileged job execute (Makefile, scripts, tests, package hooks)?\n[ ] Is any ${{ github.event.* }} or github.head_ref expression inside a run: block?\n[ ] Does the default GITHUB_TOKEN permission set say contents: read?\n[ ] Do public repositories run on self-hosted runners?\n",[190,2130,2128],{"__ignoreMap":339},[35,2132,2134],{"id":2133},"how-to-fix-it-split-trusted-and-untrusted-work","How to fix it: split trusted and untrusted work",[11,2136,2137,2138,2140],{},"The structural fix is to separate the two kinds of job. Code from pull requests runs in an untrusted job: the ",[190,2139,531],{}," trigger, no secrets, a read-only token, an ephemeral runner. Anything that needs credentials runs in a trusted job that only starts after merge, or behind an environment with required reviewers.",[11,2142,2143,2144,2146,2147,2149],{},"If you need to report results back to a pull request, GitHub Security Lab's pattern is an unprivileged ",[190,2145,531],{}," workflow that uploads its results as an artifact, and a separate ",[190,2148,514],{}," workflow that reads them and comments. Treat that artifact as untrusted input in the second workflow.",[11,2151,2152,2153,2156],{},"Then lower the token: set ",[190,2154,2155],{},"permissions: contents: read"," at the top of every workflow and raise it only in the job that needs more. OWASP adds the last layer: give each pipeline only the credentials it needs, and remove repository permissions from users who do not need them.",[11,2158,2159,220,2161,2165],{},[179,2160,219],{},[18,2162,2164],{"href":2163},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Ffix-it-split-trusted-and-untrusted-workflows-least","Fix it: split trusted and untrusted workflows, least-privilege job tokens",". You rebuild the workflows, then replay the direct, indirect and script injection attacks and watch each one fail.",[11,2167,2168,2169,2171],{},"To see the whole attack end to end, try the free lab (open from 12 January 2027) ",[18,2170,552],{"href":551},". It runs a real Git server and CI runner in your browser.",[1090,2173,1092],{},{"title":339,"searchDepth":365,"depth":365,"links":2175},[2176,2177,2178,2179,2180,2181,2182,2183],{"id":1674,"depth":365,"text":1675},{"id":1684,"depth":365,"text":1685},{"id":1801,"depth":365,"text":1802},{"id":1846,"depth":365,"text":1847},{"id":1882,"depth":365,"text":1883},{"id":2031,"depth":365,"text":2032},{"id":2120,"depth":365,"text":2121},{"id":2133,"depth":365,"text":2134},"Poisoned pipeline execution explained: direct, indirect and public PPE, why pull_request_target is risky in GitHub Actions, and how to fix it.","poisoned pipeline execution",{},{"title":1655,"description":2184},"blog\u002Fpoisoned-pipeline-execution","ZkcaTBzlqw7or4qUNWzFu9eFHfKTu8M_pY04Our1dr0",{"id":2191,"title":1133,"body":2192,"cluster":1645,"date":1109,"description":3078,"draft":1111,"extension":1112,"keyword":3079,"meta":3080,"navigation":368,"path":1132,"seo":3081,"stem":3082,"__hash__":3083},"blog\u002Fblog\u002Fsoftware-supply-chain-attacks.md",{"type":8,"value":2193,"toc":3053},[2194,2197,2200,2204,2207,2233,2236,2245,2258,2262,2269,2273,2276,2294,2298,2306,2309,2313,2316,2336,2340,2343,2350,2354,2357,2361,2365,2380,2383,2412,2415,2419,2435,2456,2459,2463,2484,2500,2503,2507,2521,2533,2536,2544,2548,2551,2613,2616,2619,2638,2654,2663,2669,2685,2688,2692,2700,2732,2735,2739,2754,2757,2761,2770,2804,2807,2854,2857,2861,2868,2888,2896,2899,2906,2909,2913,2919,3041,3044,3050],[11,2195,2196],{},"A software supply chain attack does not break into your application. It breaks into something your application trusts: a package, a maintainer account, a build server, a CI action, an image in a registry. Your pipeline then delivers the attacker's code to production for them, signed and versioned like any other release.",[11,2198,2199],{},"Software supply chain security is the work of checking each of those trust points so that what runs in production is provably what you meant to ship. This guide covers how the attacks work, four incidents that shaped current practice, and the build controls that stop them.",[35,2201,2203],{"id":2202},"what-the-software-supply-chain-is","What the software supply chain is",[11,2205,2206],{},"Every release passes through four hops:",[1142,2208,2209,2215,2221,2227],{},[1042,2210,2211,2214],{},[179,2212,2213],{},"Source."," Developers commit code to a repository. Reviews, branch rules and commit signing decide what gets in.",[1042,2216,2217,2220],{},[179,2218,2219],{},"Build."," A CI runner checks out the source, pulls dependencies from package registries, runs third-party actions or plugins, and compiles the result.",[1042,2222,2223,2226],{},[179,2224,2225],{},"Package."," The output is stored as an artifact: a container image, a wheel, a tarball, a binary in a registry.",[1042,2228,2229,2232],{},[179,2230,2231],{},"Deploy."," Something pulls that artifact and runs it in production.",[11,2234,2235],{},"Dependencies enter at the build hop, and they bring their own supply chains with them. Each dependency has its own source, build and publish steps, run by people you have never met.",[11,2237,2238,2239,2244],{},"The ",[18,2240,2243],{"href":2241,"rel":2242},"https:\u002F\u002Fslsa.dev\u002Fspec\u002Flatest\u002Fthreats-overview",[22],"SLSA framework"," maps this into threats lettered A to I, from the producer and the source repository through the build process, artifact publication and the distribution channel, to package selection and usage. Dependency threats are the same list applied recursively to every package you pull. It is a useful checklist when you ask \"where could someone change what we ship?\"",[11,2246,2247,2248,2252,2253,2257],{},"The fastest way to see these trust boundaries is to follow one commit end to end. Our free lab (open from 12 January 2027) ",[18,2249,2251],{"href":2250},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Ftrace-one-commit-from-push-to-production-and","Trace one commit from push to production"," has you do exactly that on a Git server, CI runner, registry, package index and production host, marking who can change what at each hop. It opens free on 12 January 2027; ",[18,2254,2256],{"href":2255},"\u002Fcourses\u002Fdevsecops#join","join the launch list"," to get it first.",[35,2259,2261],{"id":2260},"how-software-supply-chain-attacks-work","How software supply chain attacks work",[11,2263,2264,2265,2268],{},"OWASP groups the dependency side of this under ",[18,2266,1209],{"href":1207,"rel":2267},[22],": flaws in how workstations and build environments fetch code dependencies. The build and artifact side has its own entries. Together they give five classes worth knowing.",[1219,2270,2272],{"id":2271},"dependency-confusion","Dependency confusion",[11,2274,2275],{},"Your build pulls internal packages from a private index but can also reach a public one. An attacker publishes a public package with the same name as one of your internal packages and a higher version number. If the package manager merges both sources and picks the highest version, your build installs the attacker's package.",[11,2277,2278,2279,2282,2283,2287,2288,2290,2291,33],{},"Alex Birsan made this widely known in ",[18,2280,1289],{"href":273,"rel":2281},[22],", when he used it against more than 35 organisations, including Apple, Microsoft and PayPal, under their bug bounty programmes. pip's own documentation now ",[18,2284,2286],{"href":1235,"rel":2285},[22],"warns"," that using ",[190,2289,1231],{}," to find private packages is unsafe for this reason. We cover the mechanics in detail in ",[18,2292,2293],{"href":1649},"Dependency confusion: how a public package hijacks a private build",[1219,2295,2297],{"id":2296},"typosquatting-and-install-scripts","Typosquatting and install scripts",[11,2299,2300,2301,511,2303,2305],{},"Typosquatting relies on a typo. A package called something one keystroke away from a popular name waits for a developer, or an AI assistant, to get it wrong. The damage comes from install scripts: npm runs ",[190,2302,1197],{},[190,2304,1200],{}," hooks the moment a package is installed, so the attacker gets code execution on the laptop or the CI runner before anyone imports anything.",[11,2307,2308],{},"Install scripts are also what turn a single compromised package into a worm, as the npm incidents below show.",[1219,2310,2312],{"id":2311},"compromised-maintainers","Compromised maintainers",[11,2314,2315],{},"Here the package name is right, and so is the publisher account. The attacker has taken over the maintainer, through phishing, a stolen token or years of patient social engineering, and publishes a malicious version through the normal channel. OWASP calls this dependency hijacking.",[11,2317,2318,2319,1330,2322,2325,2326,2329,2330,2335],{},"In September 2025, the maintainer of ",[190,2320,2321],{},"chalk",[190,2323,2324],{},"debug"," and other widely used npm packages was phished through an email from a lookalike ",[190,2327,2328],{},"npmjs.help"," domain, and malicious versions carrying a browser crypto stealer were published to npm (",[18,2331,2334],{"href":2332,"rel":2333},"https:\u002F\u002Fwww.theregister.com\u002F2025\u002F09\u002F08\u002Fdev_falls_for_phishing_email",[22],"The Register","). Nothing about the package name looked wrong.",[1219,2337,2339],{"id":2338},"compromised-build-systems-and-third-party-actions","Compromised build systems and third-party actions",[11,2341,2342],{},"The build hop runs code from many owners: the CI platform, the runner image, every third-party action or plugin a workflow calls, and every tool those actions download. Compromise any of them and your build runs the attacker's code with your secrets in memory.",[11,2344,2345,2346,2349],{},"Tags make this worse. A workflow that says ",[190,2347,2348],{},"uses: some\u002Faction@v4"," trusts whoever controls that tag today, and tags can be moved to point at a different commit.",[1219,2351,2353],{"id":2352},"artifact-tampering-between-build-and-deploy","Artifact tampering between build and deploy",[11,2355,2356],{},"Once an artifact leaves the build, it sits in caches, artifact stores and registries. If a low-trust job can write to a cache that a release job reads, or if anyone with registry write access can push a new image under an existing tag, production can end up running something the pipeline never built. OWASP lists this as CICD-SEC-9, Improper Artifact Integrity Validation.",[35,2358,2360],{"id":2359},"real-supply-chain-attacks-and-what-each-one-broke","Real supply chain attacks and what each one broke",[1219,2362,2364],{"id":2363},"the-xz-utils-backdoor-cve-2024-3094","The xz-utils backdoor (CVE-2024-3094)",[11,2366,2367,2368,2373,2374,2379],{},"On 29 March 2024, Andres Freund ",[18,2369,2372],{"href":2370,"rel":2371},"https:\u002F\u002Fwww.openwall.com\u002Flists\u002Foss-security\u002F2024\u002F03\u002F29\u002F4",[22],"reported to oss-security"," that xz\u002Fliblzma versions 5.6.0 and 5.6.1 contained a backdoor. He found it because SSH logins on a Debian sid machine were using unusual CPU and producing valgrind errors. CISA ",[18,2375,2378],{"href":2376,"rel":2377},"https:\u002F\u002Fwww.cisa.gov\u002Fnews-events\u002Falerts\u002F2024\u002F03\u002F29\u002Freported-supply-chain-compromise-affecting-xz-utils-data-compression-library-cve-2024-3094",[22],"issued an alert"," the same day.",[11,2381,2382],{},"Two details matter for builders:",[1039,2384,2385,2397],{},[1042,2386,2387,2390,2391,2396],{},[179,2388,2389],{},"The attacker was a maintainer."," Russ Cox's ",[18,2392,2395],{"href":2393,"rel":2394},"https:\u002F\u002Fresearch.swtch.com\u002Fxz-timeline",[22],"timeline"," traces the account \"Jia Tan\" from a harmless first patch in October 2021 to maintainer status in late 2022, helped along by other accounts pressuring the original maintainer. The malicious releases came through the project's normal process.",[1042,2398,2399,2402,2403,2406,2407,2411],{},[179,2400,2401],{},"The backdoor was not all in git."," Part of it sat in obfuscated test files in the repository, and the part that activated it, a modified ",[190,2404,2405],{},"build-to-host.m4",", existed only in the release tarballs. Freund's post notes that line \"is ",[2408,2409,2410],"em",{},"not"," in the upstream source of build-to-host.\"",[11,2413,2414],{},"Hash pinning would not have helped here: the tarball was the official release, so its hash was the official hash. What helps is building from the tagged source rather than a hand-made tarball, and having provenance that records which source a release was built from, so the difference between \"what is in git\" and \"what was shipped\" is visible.",[1219,2416,2418],{"id":2417},"the-tj-actionschanged-files-compromise-cve-2025-30066","The tj-actions\u002Fchanged-files compromise (CVE-2025-30066)",[11,2420,2421,2422,2424,2425,2428,2429,2434],{},"In March 2025, the ",[190,2423,859],{}," GitHub Action, used in over 23,000 repositories, was compromised. According to the ",[18,2426,871],{"href":869,"rel":2427},[22],", the attacker retroactively pointed existing version tags at a malicious commit that dumped secrets from the runner's memory into the build log. In public repositories those logs are readable by anyone. ",[18,2430,2433],{"href":2431,"rel":2432},"https:\u002F\u002Fwww.stepsecurity.io\u002Fblog\u002Fharden-runner-detection-tj-actions-changed-files-action-is-compromised",[22],"StepSecurity"," detected it on 14 March when a workflow called an unexpected network endpoint.",[11,2436,2437,2442,2443,2446,2447,2452,2453,2455],{},[18,2438,2441],{"href":2439,"rel":2440},"https:\u002F\u002Fwww.cisa.gov\u002Fnews-events\u002Falerts\u002F2025\u002F03\u002F18\u002Fsupply-chain-compromise-third-party-tj-actionschanged-files-cve-2025-30066-and-reviewdogaction",[22],"CISA's alert"," links it to a second compromise, ",[190,2444,2445],{},"reviewdog\u002Faction-setup"," (CVE-2025-30154). Palo Alto's ",[18,2448,2451],{"href":2449,"rel":2450},"https:\u002F\u002Funit42.paloaltonetworks.com\u002Fgithub-actions-supply-chain-attack\u002F",[22],"Unit 42 analysis"," traces the chain further back: a token leaked from one project's ",[190,2454,358],{}," workflow, used to move a tag in reviewdog, which then leaked the token of the bot account that maintained tj-actions. Unit 42 also found the attack started as a targeted attempt on a Coinbase repository, which failed.",[11,2457,2458],{},"This is the clearest case for pinning actions to a full commit SHA. Workflows that referenced a known-good SHA kept running the known-good code when the tags moved.",[1219,2460,2462],{"id":2461},"solarwinds-orion-and-the-sunspot-build-implant","SolarWinds Orion and the SUNSPOT build implant",[11,2464,2465,2466,2471,2472,2477,2478,2483],{},"In December 2020, FireEye (now Mandiant) ",[18,2467,2470],{"href":2468,"rel":2469},"https:\u002F\u002Fcloud.google.com\u002Fblog\u002Ftopics\u002Fthreat-intelligence\u002Fevasive-attacker-leverages-solarwinds-supply-chain-compromises-with-sunburst-backdoor",[22],"disclosed"," that a digitally signed SolarWinds Orion component carried a backdoor, SUNBURST. CISA issued ",[18,2473,2476],{"href":2474,"rel":2475},"https:\u002F\u002Fwww.cisa.gov\u002Fnews-events\u002Fdirectives\u002Fed-21-01-mitigate-solarwinds-orion-code-compromise",[22],"Emergency Directive 21-01"," on 13 December 2020, ordering federal agencies to disconnect affected Orion versions. In its ",[18,2479,2482],{"href":2480,"rel":2481},"https:\u002F\u002Fwww.sec.gov\u002FArchives\u002Fedgar\u002Fdata\u002F1739942\u002F000162828020017451\u002Fswi-20201214.htm",[22],"8-K filing",", SolarWinds said fewer than 18,000 customers may have installed an affected version.",[11,2485,2486,2487,2491,2492,2495,2496,2499],{},"The source repository was not where the backdoor lived. CrowdStrike's ",[18,2488,2490],{"href":965,"rel":2489},[22],"analysis of SUNSPOT"," shows malware on the build server that watched for ",[190,2493,2494],{},"MsBuild.exe",", swapped one source file for a backdoored version during compilation, and restored the original afterwards. It wrapped the injected code in ",[190,2497,2498],{},"#pragma warning"," directives to keep it out of build logs.",[11,2501,2502],{},"The release was signed, and the signature was valid. Signing proves who produced an artifact, not that the build was clean. Defending against this class needs a build platform the build steps themselves cannot persistently change, which is what SLSA Build Level 3 asks for, and ideally an independent rebuild to compare against.",[1219,2504,2506],{"id":2505},"self-spreading-npm-worms-shai-hulud","Self-spreading npm worms: Shai-Hulud",[11,2508,2509,2510,2514,2515,2520],{},"In September 2025, a worm named Shai-Hulud spread through npm. ",[18,2511,2441],{"href":2512,"rel":2513},"https:\u002F\u002Fwww.cisa.gov\u002Fnews-events\u002Falerts\u002F2025\u002F09\u002F23\u002Fwidespread-supply-chain-compromise-impacting-npm-ecosystem",[22]," describes it authenticating to the registry as each compromised developer, injecting code into their other packages and publishing new versions. It compromised over 500 packages and stole GitHub tokens and cloud API keys. GitHub responded with a ",[18,2516,2519],{"href":2517,"rel":2518},"https:\u002F\u002Fgithub.blog\u002Fsecurity\u002Fsupply-chain-security\u002Four-plan-for-a-more-secure-npm-supply-chain\u002F",[22],"plan to tighten npm publishing",": trusted publishing, short-lived granular tokens and stronger 2FA.",[11,2522,2523,2524,2529,2530,2532],{},"A second wave, Shai-Hulud 2.0, appeared in November 2025. ",[18,2525,2528],{"href":2526,"rel":2527},"https:\u002F\u002Fsecuritylabs.datadoghq.com\u002Farticles\u002Fshai-hulud-2.0-npm-worm\u002F",[22],"Datadog Security Labs"," counted at least 796 backdoored packages. It ran from a ",[190,2531,1197],{}," script, stole cloud and CI credentials, and registered the victim machine as a self-hosted GitHub Actions runner the attacker could use later.",[11,2534,2535],{},"A worm like this needs three things: a long-lived publish token on the machine, an install script that runs automatically, and builds that pick up new versions without review. Remove any one and it stops spreading through you.",[11,2537,2538,2539,2543],{},"Our written lesson ",[18,2540,2542],{"href":2541},"\u002Fcourses\u002Fdevsecops#syllabus","Case studies: xz-utils, the tj-actions compromise and self-spreading package worms"," walks each incident hop by hop against the pipeline model above.",[35,2545,2547],{"id":2546},"controls-that-stop-software-supply-chain-attacks","Controls that stop software supply chain attacks",[11,2549,2550],{},"No single control covers every class. The table shows where each one bites.",[40,2552,2553,2563],{},[43,2554,2555],{},[46,2556,2557,2560],{},[49,2558,2559],{},"Control",[49,2561,2562],{},"Stops or limits",[59,2564,2565,2573,2581,2589,2597,2605],{},[46,2566,2567,2570],{},[64,2568,2569],{},"Lockfiles and hash pinning",[64,2571,2572],{},"Dependency confusion, typosquats and malicious new versions entering silently",[46,2574,2575,2578],{},[64,2576,2577],{},"Actions pinned to a commit SHA",[64,2579,2580],{},"Moved tags on third-party actions",[46,2582,2583,2586],{},[64,2584,2585],{},"SBOM",[64,2587,2588],{},"Not knowing what you shipped when the next advisory lands",[46,2590,2591,2594],{},[64,2592,2593],{},"Signing and verify before deploy",[64,2595,2596],{},"Artifacts swapped or pushed outside the pipeline",[46,2598,2599,2602],{},[64,2600,2601],{},"SLSA provenance",[64,2603,2604],{},"Artifacts built from the wrong source, workflow or builder",[46,2606,2607,2610],{},[64,2608,2609],{},"Ephemeral, isolated runners",[64,2611,2612],{},"Persistence on the build machine, poisoned caches",[1219,2614,2569],{"id":2615},"lockfiles-and-hash-pinning",[11,2617,2618],{},"A lockfile records the exact version of every direct and transitive dependency. Hash pinning goes further: the build refuses any file whose hash does not match. Together they mean a new release on a public registry, malicious or not, cannot reach your build until someone updates the lockfile in a reviewed change.",[11,2620,2621,2622,2624,2625,2631,2632,2634,2635,2637],{},"For npm, install from the lockfile and fail if it does not match ",[190,2623,1152],{},". ",[18,2626,2629],{"href":2627,"rel":2628},"https:\u002F\u002Fdocs.npmjs.com\u002Fcli\u002Fv10\u002Fcommands\u002Fnpm-ci",[22],[190,2630,1562],{}," \"will never write to ",[190,2633,1152],{}," or any of the package-locks\". Adding ",[190,2636,1580],{}," stops install hooks from running, though some packages with native builds need their scripts, so test before enforcing it everywhere.",[334,2639,2641],{"className":1416,"code":2640,"language":1418,"meta":339,"style":339},"npm ci --ignore-scripts\n",[190,2642,2643],{"__ignoreMap":339},[343,2644,2645,2648,2651],{"class":345,"line":346},[343,2646,2647],{"class":1425},"npm",[343,2649,2650],{"class":357}," ci",[343,2652,2653],{"class":349}," --ignore-scripts\n",[11,2655,2656,2657,1534,2660,2662],{},"For pip, ",[18,2658,1533],{"href":1531,"rel":2659},[22],[190,2661,1537],{}," and every dependency to carry a hash:",[334,2664,2667],{"className":2665,"code":2666,"language":1513,"meta":339},[1511],"# requirements.txt\nrequests==2.32.3 \\\n    --hash=sha256:\u003Chash of the published file>\n",[190,2668,2666],{"__ignoreMap":339},[334,2670,2671],{"className":1416,"code":1541,"language":1418,"meta":339,"style":339},[190,2672,2673],{"__ignoreMap":339},[343,2674,2675,2677,2679,2681,2683],{"class":345,"line":346},[343,2676,1426],{"class":1425},[343,2678,1429],{"class":357},[343,2680,1552],{"class":349},[343,2682,1438],{"class":349},[343,2684,1441],{"class":357},[11,2686,2687],{},"Lockfiles do not help if the version you locked was already malicious, as with xz-utils. They do turn \"the build quietly picked up something new\" into \"a pull request changed a hash\", which is a review you can do.",[1219,2689,2691],{"id":2690},"pin-third-party-actions-to-a-full-commit-sha","Pin third-party actions to a full commit SHA",[11,2693,2694,2695,2699],{},"GitHub's ",[18,2696,2698],{"href":781,"rel":2697},[22],"secure use reference"," says to pin actions to a full-length commit SHA, and to check the SHA comes from the action's own repository rather than a fork. A tag can be moved; a commit SHA cannot.",[334,2701,2703],{"className":336,"code":2702,"language":338,"meta":339,"style":339},"steps:\n  # Pin to the full 40-character commit SHA, keep the tag as a comment\n  - uses: actions\u002Fcheckout@\u003Cfull commit SHA>  # v4\n",[190,2704,2705,2712,2717],{"__ignoreMap":339},[343,2706,2707,2710],{"class":345,"line":346},[343,2708,2709],{"class":375},"steps",[343,2711,379],{"class":353},[343,2713,2714],{"class":345,"line":365},[343,2715,2716],{"class":361},"  # Pin to the full 40-character commit SHA, keep the tag as a comment\n",[343,2718,2719,2722,2724,2726,2729],{"class":345,"line":372},[343,2720,2721],{"class":353},"  - ",[343,2723,415],{"class":375},[343,2725,354],{"class":353},[343,2727,2728],{"class":357},"actions\u002Fcheckout@\u003Cfull commit SHA>",[343,2730,2731],{"class":361},"  # v4\n",[11,2733,2734],{},"The same page now describes workflow dependency lockfiles, which record the exact commit for every action a workflow depends on, including transitive ones. Either way, the rule is the same: the code your build runs should be named by content, not by a label someone else controls. Dependabot and Renovate can keep pinned SHAs up to date so pinning does not freeze you on old versions.",[1219,2736,2738],{"id":2737},"sbom-a-bill-of-materials-for-every-release","SBOM: a bill of materials for every release",[11,2740,2741,2742,2747,2748,2753],{},"A software bill of materials lists every component in an artifact. CISA ",[18,2743,2746],{"href":2744,"rel":2745},"https:\u002F\u002Fwww.cisa.gov\u002Fsbom",[22],"describes it"," as \"a nested inventory, a list of ingredients that make up software components.\" The NTIA published ",[18,2749,2752],{"href":2750,"rel":2751},"https:\u002F\u002Fwww.ntia.gov\u002Freport\u002F2021\u002Fminimum-elements-software-bill-materials-sbom",[22],"minimum elements"," in July 2021 under Executive Order 14028, and CISA has since updated them.",[11,2755,2756],{},"An SBOM does not stop an attack. It answers the first question of every incident: \"do we ship the affected version, and where?\" With an SBOM stored for every release, that becomes a query instead of a week of digging through images. Generate it in the pipeline (Syft writes CycloneDX and SPDX), store it next to the artifact, and attach it as a signed attestation so it cannot be swapped.",[1219,2758,2760],{"id":2759},"sign-artifacts-and-verify-before-deploy","Sign artifacts and verify before deploy",[11,2762,2763,2764,2769],{},"Signing only helps if something checks the signature, and that check has to happen at deploy time, not as a step people can skip. With ",[18,2765,2768],{"href":2766,"rel":2767},"https:\u002F\u002Fdocs.sigstore.dev\u002Fcosign\u002Fverifying\u002Fverify\u002F",[22],"cosign",", a deploy step verifies the image digest against your public key:",[334,2771,2773],{"className":1416,"code":2772,"language":1418,"meta":339,"style":339},"cosign verify --key cosign.pub registry.example.com\u002Facme\u002Fapp@sha256:\u003Cdigest>\n",[190,2774,2775],{"__ignoreMap":339},[343,2776,2777,2779,2782,2785,2788,2791,2795,2798,2801],{"class":345,"line":346},[343,2778,2768],{"class":1425},[343,2780,2781],{"class":357}," verify",[343,2783,2784],{"class":349}," --key",[343,2786,2787],{"class":357}," cosign.pub",[343,2789,2790],{"class":357}," registry.example.com\u002Facme\u002Fapp@sha256:",[343,2792,2794],{"class":2793},"snl16","\u003C",[343,2796,2797],{"class":357},"diges",[343,2799,2800],{"class":353},"t",[343,2802,2803],{"class":2793},">\n",[11,2805,2806],{},"With keyless signing, the CI job's OIDC identity replaces the long-lived key, and you verify the identity of the workflow that signed it:",[334,2808,2810],{"className":1416,"code":2809,"language":1418,"meta":339,"style":339},"cosign verify \\\n  --certificate-identity-regexp '^https:\u002F\u002Fgithub\\.com\u002Facme\u002Fapp\u002F\\.github\u002Fworkflows\u002Frelease\\.yml@refs\u002Fheads\u002Fmain$' \\\n  --certificate-oidc-issuer https:\u002F\u002Ftoken.actions.githubusercontent.com \\\n  registry.example.com\u002Facme\u002Fapp@sha256:\u003Cdigest>\n",[190,2811,2812,2821,2831,2841],{"__ignoreMap":339},[343,2813,2814,2816,2818],{"class":345,"line":346},[343,2815,2768],{"class":1425},[343,2817,2781],{"class":357},[343,2819,2820],{"class":349}," \\\n",[343,2822,2823,2826,2829],{"class":345,"line":365},[343,2824,2825],{"class":349},"  --certificate-identity-regexp",[343,2827,2828],{"class":357}," '^https:\u002F\u002Fgithub\\.com\u002Facme\u002Fapp\u002F\\.github\u002Fworkflows\u002Frelease\\.yml@refs\u002Fheads\u002Fmain$'",[343,2830,2820],{"class":349},[343,2832,2833,2836,2839],{"class":345,"line":372},[343,2834,2835],{"class":349},"  --certificate-oidc-issuer",[343,2837,2838],{"class":357}," https:\u002F\u002Ftoken.actions.githubusercontent.com",[343,2840,2820],{"class":349},[343,2842,2843,2846,2848,2850,2852],{"class":345,"line":382},[343,2844,2845],{"class":357},"  registry.example.com\u002Facme\u002Fapp@sha256:",[343,2847,2794],{"class":2793},[343,2849,2797],{"class":357},[343,2851,2800],{"class":353},[343,2853,2803],{"class":2793},[11,2855,2856],{},"Verify by digest, not by tag. On Kubernetes, move the check into an admission policy so the cluster itself refuses unsigned images. Remember SolarWinds, though: a signature on a tampered build is still a valid signature. Signing protects the hop after the build, not the build itself.",[1219,2858,2860],{"id":2859},"slsa-build-levels-and-provenance","SLSA build levels and provenance",[11,2862,2863,2867],{},[18,2864,986],{"href":2865,"rel":2866},"https:\u002F\u002Fslsa.dev\u002Fspec\u002Flatest\u002Fbuild-track-basics",[22]," (Supply-chain Levels for Software Artifacts, currently v1.2) defines build levels that describe how much you can trust an artifact's origin:",[1039,2869,2870,2876,2882],{},[1042,2871,2872,2875],{},[179,2873,2874],{},"Build L1, provenance exists."," The package has provenance showing how it was built. Useful against mistakes, but easy to forge.",[1042,2877,2878,2881],{},[179,2879,2880],{},"Build L2, hosted build platform."," Provenance is generated and signed by a hosted build platform. This \"prevents tampering after the build through digital signatures.\"",[1042,2883,2884,2887],{},[179,2885,2886],{},"Build L3, hardened builds."," The build platform isolates builds from each other and keeps signing material away from user-defined build steps. Forging provenance now requires exploiting a vulnerability in the platform.",[11,2889,2890,2895],{},[18,2891,2894],{"href":2892,"rel":2893},"https:\u002F\u002Fslsa.dev\u002Fspec\u002Flatest\u002Fbuild-provenance",[22],"Provenance"," is an in-toto attestation that records the builder, the build type, the external parameters such as repository, ref and workflow, and the resolved dependencies. At deploy time you verify it: was this artifact built by our builder, from our repository, on the main branch, by the release workflow? An artifact built on a laptop, or from a fork, fails that check even if someone managed to sign it.",[1219,2897,2609],{"id":2898},"ephemeral-isolated-runners",[11,2900,2901,2902,2905],{},"A runner that is reused between jobs is a place to leave things behind: a modified tool on the ",[190,2903,2904],{},"PATH",", a poisoned cache, a process that waits for the next job's secrets. GitHub's guidance is that self-hosted runners \"should almost never be used for public repositories\" and that they \"can be persistently compromised by untrusted code in a workflow\". It recommends just-in-time runners that perform at most one job before they are removed.",[11,2907,2908],{},"Give every job a fresh, isolated environment that is destroyed when the job ends, keep caches per trust level so a pull request job cannot write what a release job reads, and restrict runner egress to the hosts a build actually needs. The tj-actions compromise was caught because a build called a host it never normally calls.",[35,2910,2912],{"id":2911},"practise-each-attack-and-control","Practise each attack and control",[11,2914,2915,2916,2918],{},"Reading about a moved tag is one thing; watching your own pinned workflow ignore it is another. Each of these is a hands-on lab in our course ",[18,2917,1083],{"href":1082},", run in the browser against a real Git server, CI runner, registry and package index:",[40,2920,2921,2931],{},[43,2922,2923],{},[46,2924,2925,2928],{},[49,2926,2927],{},"Topic",[49,2929,2930],{},"Lab",[59,2932,2933,2941,2949,2958,2969,2980,2991,3001,3009,3019,3030],{},[46,2934,2935,2937],{},[64,2936,2272],{},[64,2938,2939],{},[18,2940,318],{"href":317},[46,2942,2943,2945],{},[64,2944,2297],{},[64,2946,2947],{},[18,2948,1610],{"href":1609},[46,2950,2951,2954],{},[64,2952,2953],{},"Lockfiles, hash pinning, pinned actions",[64,2955,2956],{},[18,2957,1617],{"href":1616},[46,2959,2960,2963],{},[64,2961,2962],{},"SBOM and scanning",[64,2964,2965],{},[18,2966,2968],{"href":2967},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fbill-of-materials-vulnerability-scanning-and-deciding-what","Bill of materials, vulnerability scanning and deciding what actually blocks a release",[46,2970,2971,2974],{},[64,2972,2973],{},"Cache and artifact tampering",[64,2975,2976],{},[18,2977,2979],{"href":2978},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fpoison-the-build-cache-and-a-shared-artifact","Poison the build cache and a shared artifact",[46,2981,2982,2985],{},[64,2983,2984],{},"Runner persistence",[64,2986,2987],{},[18,2988,2990],{"href":2989},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fpersist-on-a-self-hosted-runner-and-wait","Persist on a self-hosted runner and wait for the next job",[46,2992,2993,2996],{},[64,2994,2995],{},"Ephemeral runners",[64,2997,2998],{},[18,2999,2609],{"href":3000},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fephemeral-isolated-runners",[46,3002,3003,3005],{},[64,3004,2593],{},[64,3006,3007],{},[18,3008,995],{"href":994},[46,3010,3011,3013],{},[64,3012,2601],{},[64,3014,3015],{},[18,3016,3018],{"href":3017},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fprovenance-attestations-prove-which-pipeline-built-this-artifact","Provenance attestations: prove which pipeline built this artifact",[46,3020,3021,3024],{},[64,3022,3023],{},"Keyless signing",[64,3025,3026],{},[18,3027,3029],{"href":3028},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fkeyless-signing-with-a-local-sigstore-stack","Keyless signing with a local Sigstore stack",[46,3031,3032,3035],{},[64,3033,3034],{},"Admission control",[64,3036,3037],{},[18,3038,3040],{"href":3039},"\u002Fcourses\u002Fdevsecops\u002Flabs\u002Fadmit-only-signed-images-on-a-single-node","Admit only signed images on a single-node Kubernetes cluster",[11,3042,3043],{},"Every defence lab ends the same way: you replay the attack and watch it fail.",[11,3045,3046,3047,3049],{},"If you want a list to work through on your own pipeline first, the ",[18,3048,1072],{"href":1071}," maps these controls to the OWASP CI\u002FCD risks.",[1090,3051,3052],{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}",{"title":339,"searchDepth":365,"depth":365,"links":3054},[3055,3056,3063,3069,3077],{"id":2202,"depth":365,"text":2203},{"id":2260,"depth":365,"text":2261,"children":3057},[3058,3059,3060,3061,3062],{"id":2271,"depth":372,"text":2272},{"id":2296,"depth":372,"text":2297},{"id":2311,"depth":372,"text":2312},{"id":2338,"depth":372,"text":2339},{"id":2352,"depth":372,"text":2353},{"id":2359,"depth":365,"text":2360,"children":3064},[3065,3066,3067,3068],{"id":2363,"depth":372,"text":2364},{"id":2417,"depth":372,"text":2418},{"id":2461,"depth":372,"text":2462},{"id":2505,"depth":372,"text":2506},{"id":2546,"depth":365,"text":2547,"children":3070},[3071,3072,3073,3074,3075,3076],{"id":2615,"depth":372,"text":2569},{"id":2690,"depth":372,"text":2691},{"id":2737,"depth":372,"text":2738},{"id":2759,"depth":372,"text":2760},{"id":2859,"depth":372,"text":2860},{"id":2898,"depth":372,"text":2609},{"id":2911,"depth":365,"text":2912},"How software supply chain attacks work, from dependency confusion to tampered builds, what xz-utils and tj-actions taught, and the controls that stop them.","software supply chain security",{},{"title":1133,"description":3078},"blog\u002Fsoftware-supply-chain-attacks","kjN0t9gjV4bixCnoRMOFDaKf25q40zemAIWJzBCNTcI",1795688862931,"486f93ba-69c2-419b-a828-addbe3303942"]