Skip to Content
Xeonr Developer Docs
Pipelines

Security

What a pipeline, a step from another repository and a job token can do, stated plainly.

Available in repositories branchd reads pipeline files for. It is switching repositories on one at a time: until yours is, it keeps running its .forge-ci.yaml or .xeonr-ci.yaml. See What is available.

A step you use has the whole job

A composite step, yours or another repository's, runs in your job's shell. It can read every secret granted to the job, use the job token, read and change the workspace and the checkout, and read the outputs of the steps before it. Using a step is running its code as your own, exactly as using a GitHub action is. A reusable pipeline of another repository is that team's jobs running as your repository, with the secrets you pass it.

branchd ci plan prints, under each job, every step and pipeline of another repository it runs, with the tag and commit, for example:

runs step xeonr/forge/steps/setup-buf@v1 (xeonr/forge/steps at v1.0.0 1111…) in this job's shell, with this job's secrets, job token, workspace and earlier steps' outputs

Pinning

  • @v1 follows the publisher's newest v1.x.y tag. Each run records the commit it used, and a later run picks up a new tag.
  • @v1.4.2 is one tag. A tag is a name the publisher controls; to fix the exact code, use the 40-character commit, which must be a version tag's commit or on the publisher's default branch. Never a branch.
  • Grant a job only the secrets it needs. A step cannot read a secret its job does not list.

Pull requests

  • A pull request on branchd is always from a branch of the same repository. There are no forks, so no pull request runs code from a repository you do not control. Its author can still change the pipeline file on their branch, and the run uses that branch's file.
  • Protected secrets reach only runs of a person's push to a protected branch or tag, and a run a person starts by hand of a protected branch's current head (only someone the branch rule lets merge may start one, and it runs that head's own pipeline file), never a pull request's run. Give anything that can deploy or publish protected access.
  • A company's secrets reach the repositories of the company's teams only, decided by branchd from the team each repository belongs to, never by a pipeline file.
  • Who may use another repository's step is decided for the calling repository, never for the person who pushed, so a pull request from someone with wider access cannot pull in a package the repository itself could not use.

Expressions are values

${{ }} is never pasted into a script: it becomes an environment variable that the script reads. A branch name, an input, a pull request title or a matrix value cannot become shell code. A value that would hold ${{ is refused.

The job token

Every job gets BRANCHD_TOKEN, a token for its run that lives for minutes. Without permissions: it reads its own repository only: never another, even of the same team. permissions: adds writes in this repository, and branchd checks every use against what the job declared:

  • contents, releases and packages writes need a protected ref, and a push or manual run by a person, an agent or the team's own bot. A scheduled or triggered run only reads them.
  • On a pull request's run, and on any unprotected branch, writes are capped by the repository's ceiling (by default pull-requests: write and checks: write, on that pull request and commit only), because the pull request can change its own pipeline file.
  • It can never change settings, secrets or branch rules, approve or merge a pull request, release a manual job, or write to another repository.
  • Every API call it makes is recorded, allowed or refused.

The details and curl examples: The job token.

Private repositories

A private repository's steps, pipelines and presets are usable by that repository alone. Another repository, of the same team or not, is refused as if it did not exist. Share them by giving the publishing repository company or organisation visibility, and keep in mind that whoever may use them runs that code with their own secrets.

Where code runs

A job runs in its own container on a runner. Runner labels (runs-on) choose the runner; the label deploy is reserved for branchd's own deploy steps, and a job of repository code that asks for it is refused.

On this page