Skip to content
Gitea and Forgejo

Gitea and Forgejo

github.com • November 28, 2026

DIR is a repository checkout. trust-path reads the workflow files in DIR/.github/workflows and writes one record per path from untrusted input to a sink.

--forge gitea or --forge forgejo applies that forge's rules instead of GitHub's. Both forges run workflows written in GitHub's syntax; what differs, and how trust-path follows it:

Only the first directory that exists is read, as the forge does: in a Gitea repository with both .gitea/workflows and .github/workflows , the files in .github/workflows never run and are not read. The automatic token is followed under each of its names, secrets.GITHUB_TOKEN , secrets.GITEA_TOKEN and secrets.FORGEJO_TOKEN . The context names gitea , forgejo and forge are read as github whatever the forge, since none of them means anything else.

Sources: Gitea's comparison with GitHub Actions and FAQ ; Forgejo's Actions reference ; and, for the directories and events, the ListWorkflows code of each forge. Not modelled: a Gitea server's WORKFLOW_DIRS setting (the default list is used), Gitea's different permissions: scopes (the GitHub scopes are read), and Gitea ignoring environment: .

With --ref REF , trust-path reads the workflow directory from git at REF (a branch, tag or commit) in the repository at DIR , which defaults to the current directory. Nothing is checked out and the working tree is not read, so it can check a pull request's branch or an old release without switching to it:

With --baseline FILE , trust-path leaves out the records listed in FILE , a JSON array as written by --json . A record is left out only when all six fields match. The exit status and every output form count only the records that are left. A FILE that cannot be read or is not an array of records is an error (exit status 2). See Records on popular repositories for why and when to keep one.

Each record is one line of six tab-separated fields:

Tabs and line breaks inside a field are replaced by spaces. Records are sorted and each appears once, so the same files always give the same output.

--json writes the same records, in the same order, as a JSON array of objects with the keys source , workflow , job , step , sink and detail .

--audit-json writes one JSON object in the audit result format ( audit-result/1 ), for a CI job or an agent that runs several audit tools and reads their results the same way. Each finding is a --json record with what a reader needs to act on it: a rule id, a severity, one sentence that says what the path is, and the evidence to check it. For the pr_title test fixture ( trust-path --audit-json tests/fixtures/pr_title ):

rule and severity , fixed by the kind of sink, never by what the step does: Sink rule severity secrets.NAME trust-path.secret high secrets:inherit trust-path.secrets-inherit high permissions.id-token:write trust-path.oidc-token high permissions.SCOPE:write (other scopes) trust-path.write-permission high agent:OWNER/REPO trust-path.agent high environment:NAME trust-path.environment medium permissions:default trust-path.default-permissions medium An environment can require a reviewer before a job runs, and the default token permissions depend on the repository's settings, so those two are medium .

rule and severity , fixed by the kind of sink, never by what the step does:

An environment can require a reviewer before a job runs, and the default token permissions depend on the repository's settings, so those two are medium .

message : where untrusted input comes from (a chain of runs reads pull_request in .github/workflows/ci.yml, then workflow_run ), where it enters, what it reaches, and the workflow, job and step; then the agent detail in parentheses when there is one.

message : where untrusted input comes from (a chain of runs reads pull_request in .github/workflows/ci.yml, then workflow_run ), where it enters, what it reaches, and the workflow, job and step; then the agent detail in parentheses when there is one.

evidence : path , the workflow file; with --ref , ref as given and commit , the full id of the commit it names. trust-path does not keep line numbers, so there is no line .

evidence : path , the workflow file; with --ref , ref as given and commit , the full id of the commit it names. trust-path does not keep line numbers, so there is no line .

record : the --json record, unchanged.

record : the --json record, unchanged.

The object is written on every run, also on an error, so a reader always gets one object. With a refused file, the paths found in the other files are kept and the exit status is 2. On any other error, including a usage error such as --json with --audit-json , findings is empty, errors holds the message and the exit status is 2.

A workflow file is refused when it cannot be read (with --ref , also when it is a symbolic link), uses YAML trust-path does not read, is not a workflow (no jobs: mapping, a job that is not a mapping, steps that are not a list). A job that calls a local reusable workflow that is not in the directory is treated the same way, except that only that call is skipped: the other jobs in its file are still read. trust-path still reads every other file and writes the paths it finds in them, then writes one line per refused file or missing call to standard error:

A call to a refused reusable workflow is not followed, and a workflow_run trigger naming a refused workflow is reported as unknown@NAME . So with status 2 the output can miss paths through the refused files, but every path it shows is real.

The repository's test fixtures are small repositories. From a clone:

ci.yml runs on pull requests, so a fork chooses the branch name. stage.yml runs on workflow_run after ci.yml , and publish.yml runs on workflow_run after stage.yml . The publish job puts github.event.workflow_run.head_branch into a shell command in the step Tag , in a job that holds an OIDC token ( id-token: write ) and uses the pypi environment.

The full story

This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.

Extracted Entities

Tools (1)