Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7a0f784
feat(control): mise lockfile check (packageManagersMustBeCompliant, I…
Exypte Dec 1, 2026
5456501
test(mise): cover url_api, string provenance and unreadable lockfiles
Exypte Dec 1, 2026
667d01c
feat(mise): fail closed on unreadable files, add exemptPaths
Exypte Dec 1, 2026
a1e1644
fix(mise): check the close error and drop a map size hint
Exypte Dec 1, 2026
6ea407e
fix(mise): judge lockfiles only for configs that lock, cover the revi…
Exypte Dec 1, 2026
022f650
test(mise): pin the packageManagersMustBeCompliant stats block
Exypte Dec 1, 2026
5b95fe3
feat(mise): rework the lockfile check for #678 (mise-en-place, new co…
Exypte Dec 2, 2026
e137229
fix(mise): keep an empty trustedProvenance through a YAML round trip
Exypte Dec 2, 2026
086e895
test(mise): cover multi-kind provenance, the lockfile tie-break and t…
Exypte Dec 2, 2026
2e41703
docs(mise): idiomatic version files are not read
Exypte Dec 3, 2026
6f5e412
feat(mise): versions check (mise-en-place, ISSUE-1011)
Exypte Dec 2, 2026
9351e41
feat(mise): a version that can't be read statically is ISSUE-1012
Exypte Dec 2, 2026
8f05f1f
test(mise): read lockfile platforms written as nested tables
Exypte Dec 2, 2026
36be7cc
docs(mise): the versions check does not read .tool-versions
Exypte Dec 3, 2026
3db96c2
feat(mise): sources check (mise-en-place, ISSUE-1021 to ISSUE-1023)
Exypte Dec 2, 2026
d28f473
feat(mise): trusted* sources keys, locked download URL check (ISSUE-1…
Exypte Dec 2, 2026
47f3de0
test(mise): pin how local configs and the sources check read the chec…
Exypte Dec 2, 2026
fb0c26d
fix(mise): judge only the URLs inside pipx_args and uvx_args
Exypte Dec 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .plumber.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1290,3 +1290,92 @@ github:
- ACTIONS_STEP_DEBUG
- ACTIONS_RUNNER_DEBUG

# ============================================================================
# mise (mise-en-place)
# ============================================================================
# Top level, like gitlab and github: mise does not depend on the provider,
# the same block applies to a GitHub or a GitLab repository. It drives the
# mise-en-place control. Remove the block, or set
# `enabled: false`, and nothing is scanned or reported. A check whose
# block (lockfile, versions, sources) is absent does not run.
#
# The files are read from the local checkout. A run without one (a remote
# --project run) reports the control as not evaluated.
#
# Best practice: commit mise.lock with a checksum for every download, and
# install with `mise install --locked` in CI.
mise:
# Set to false to disable every mise check
enabled: true
# Set to true to report a repository that commits no mise config
# (ISSUE-1010). A .tool-versions file alone does not count.
required: false
# Every mise config that declares tools has its lockfile committed
# (mise.toml -> mise.lock, mise.<env>.toml -> mise.<env>.lock), every tool
# request has a matching lock entry, and every locked download carries a
# checksum. A request Plumber cannot read statically (a template) or a
# format 0 lockfile is reported as not locked. A mise file that cannot
# be read or parsed stops the run with an error listing every such
# file.
lockfile:
enabled: true
requireChecksums: true
# Backends whose locked downloads must record a provenance
# (SLSA, cosign, minisign, GitHub attestations), globs allowed.
# requireProvenance: ["aqua:*"]
# Provenance kinds a locked download may record; any other kind is
# reported. Defaults to every kind mise records.
# trustedProvenance: [slsa, github-attestations, cosign, minisign]
# Platforms every tool that locks downloads must lock.
# requiredPlatforms: [linux-x64, linux-arm64]
# Oldest accepted lockfile_version.
# minimumLockfileVersion: 1
# No tool request in a mise config uses a forbidden version (globs).
# The request as written is what people review: with `latest`, the
# lockfile pins a version, but `mise lock --bump` or `mise upgrade` moves
# it with no change in mise.toml (ISSUE-1011). A request Plumber cannot
# read statically (a template) is ISSUE-1012. A bare major such as "24" is
# not caught by this list. "ref:*" is left out: a ref pinned to a commit
# SHA cannot move. Add it to forbid every git ref.
versions:
enabled: true
forbiddenVersions:
- latest
- lts
- "lts/*"
- "lts-*"
- stable
- nightly
- beta
- "branch:*"
- "path:*"
- system
- "sub-*"
- "prefix:*"
# Where tools are fetched from. Off by default: write the block to turn
# it on. Globs allowed in every list.
# trustedTools: the tools that may be installed, by full mise name
# (`aqua:jqlang/jq`; a shorthand such as `terraform` takes the
# backend its mise.lock entry records, and with no entry it is
# reported). ISSUE-1013.
# trustedRegistries: the download URLs mise.lock may record, the ones
# `mise install --locked` downloads. Leave it out and they are not
# checked; [] trusts none. ISSUE-1014.
# trustedReplacement: where [settings] url_replacements may send
# downloads. Absent or [] trusts none. ISSUE-1015.
# trustedOptions: the URLs a tool option may set (api_url, url,
# platforms.<p>.url, pip indexes). Absent or [] trusts none.
# ISSUE-1016.
# sources:
# enabled: true
# trustedTools: ["core:*", "aqua:*", "github:my-org/*"]
# trustedRegistries: ["https://github.com/*", "https://nodejs.org/*"]
# trustedReplacement: []
# trustedOptions: []
# Tool keys exempted from every mise check, globs allowed.
exemptPackages: []
# Repository paths whose mise files are not checked, for example
# fixtures ("examples/**", "testdata/**"). A file there that cannot be
# read does not stop the run. `*` stays within a directory, `**`
# crosses directories.
exemptPaths: []
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ Skip if your rule only reads fields the IR already exposes (jobs, scripts, trigg
- `7xx` reserved for GitHub-specific supply-chain
- `8xx` reserved for GitHub-specific triggers
- `9xx` reserved for repo / dependabot artefacts
- `10xx` and up: package managers, one hundred-block per package manager (`10xx` is mise, under the `mise-en-place` control). Inside a block, codes take the next number in sequence whatever check raises them, and each one sets a `subject` (for mise: `lockfile`, `presence`, `versions`, `sources`, `tasks`) so the codes of one check can be filtered together. A new package manager takes the next free block, in the "Package Managers and Lockfiles" category. Its config is a top-level key of `.plumber.yaml` named after the package manager (`mise:`), not a block under `gitlab.controls` or `github.controls`: a package manager does not depend on the provider.
Pick the next free number; existing assignments live in the constants block at the top of `codes.go`.
- [ ] **Registry entry** — `errorCodeRegistry` map entry:
```go
Expand Down
35 changes: 35 additions & 0 deletions cmd/config_slim.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ func slimToOverlay(src string) ([]byte, error) {
overlay[p] = map[interface{}]interface{}{"controls": diff}
}
}
// mise is top level, not under a provider: an overlay source keeps
// its block as written, merged onto the base like any overlay key.
if m, ok := rawMap["mise"]; ok {
overlay["mise"] = m
}
return yaml.Marshal(overlay)
}

Expand Down Expand Up @@ -145,9 +150,39 @@ func slimToOverlay(src string) ([]byte, error) {
overlay[p] = map[interface{}]interface{}{"controls": diff}
}
}
// mise is top level. A legacy source is a full config, so its mise
// block is kept as written, and a source without one turned mise off:
// the overlay says so, or it would inherit the base's enabled block.
if m, ok := userMap["mise"].(map[interface{}]interface{}); ok {
overlay["mise"] = pinAbsentMiseChecks(m, baseCfg.Mise)
} else if baseCfg.Mise.IsEnabled() {
overlay["mise"] = map[interface{}]interface{}{"enabled": false}
}
return yaml.Marshal(overlay)
}

// pinAbsentMiseChecks returns a copy of a legacy source's mise block with
// every check block the source leaves out written as `{enabled: false}`.
// In a full config an absent check block does not run, but the overlay is
// deep-merged onto the base on resolve, so an absent key would inherit the
// base's enabled block and turn the check on.
func pinAbsentMiseChecks(m map[interface{}]interface{}, base *configuration.MiseConfig) map[interface{}]interface{} {
out := make(map[interface{}]interface{})
for k, v := range m {
out[k] = v
}
if _, ok := out["lockfile"]; !ok && base.LockfileCheckEnabled() {
out["lockfile"] = map[interface{}]interface{}{"enabled": false}
}
if _, ok := out["versions"]; !ok && base.VersionsCheckEnabled() {
out["versions"] = map[interface{}]interface{}{"enabled": false}
}
if _, ok := out["sources"]; !ok && base.SourcesCheckEnabled() {
out["sources"] = map[interface{}]interface{}{"enabled": false}
}
return out
}

// normalizeConfigToMap marshals a loaded *configuration.PlumberConfig back
// to YAML and unmarshals it into a generic map, so it can be diffed with
// diffControls/controlsSubmap the same way a raw source map is. Routing
Expand Down
135 changes: 135 additions & 0 deletions cmd/config_slim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"os"
"path/filepath"
"reflect"
"strings"
"testing"

Expand Down Expand Up @@ -671,6 +672,94 @@ github:
}
}

// TestSlimToOverlay_MiseSurvivesResolve pins the top-level mise block
// through slim -> resolve: a legacy source without mise turned it off, and
// a mise block the source writes is kept.
func TestSlimToOverlay_MiseSurvivesResolve(t *testing.T) {
cases := []struct {
name string
src string
wantEnabled bool
wantLockfile bool
wantVersions bool
// wantForbidden, when set, is the resolved forbiddenVersions list.
wantForbidden []string
wantExempt []string
}{
{
name: "a legacy source without mise stays off",
src: "version: \"2.0\"\ngithub:\n controls: {}\n",
wantEnabled: false,
},
{
name: "a legacy source keeps its mise block",
src: "version: \"2.0\"\ngithub:\n controls: {}\nmise:\n lockfile: {}\n exemptPackages: [node]\n",
wantEnabled: true,
wantLockfile: true,
wantExempt: []string{"node"},
},
{
name: "a legacy source keeps its versions block and pins the absent lockfile off",
src: "version: \"2.0\"\ngithub:\n controls: {}\nmise:\n versions:\n forbiddenVersions: [latest]\n",
wantEnabled: true,
wantVersions: true,
wantForbidden: []string{"latest"},
wantExempt: []string{},
},
{
name: "a legacy source without a lockfile block keeps the check off",
src: "version: \"2.0\"\ngithub:\n controls: {}\nmise:\n enabled: true\n",
wantEnabled: true,
wantLockfile: false,
wantExempt: []string{},
},
{
name: "an overlay source keeps enabled: false",
src: "extends: plumber:default\nversion: \"2.0\"\nmise:\n enabled: false\n",
wantEnabled: false,
},
{
name: "an overlay source without mise inherits the base",
src: "extends: plumber:default\nversion: \"2.0\"\n",
wantEnabled: true,
wantLockfile: true,
wantVersions: true,
wantExempt: []string{},
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
path := filepath.Join(t.TempDir(), "src.yaml")
if err := os.WriteFile(path, []byte(tc.src), 0o600); err != nil {
t.Fatal(err)
}
out, err := slimToOverlay(path)
if err != nil {
t.Fatalf("slim: %v", err)
}
resolved, _, _, err := configuration.LoadPlumberConfigFromBytes(out, "slim-output-for-test")
if err != nil {
t.Fatalf("resolve slim overlay: %v\n%s", err, out)
}
if got := resolved.Mise.IsEnabled(); got != tc.wantEnabled {
t.Fatalf("mise enabled = %v, want %v\n%s", got, tc.wantEnabled, out)
}
if got := resolved.Mise.LockfileCheckEnabled(); tc.wantEnabled && got != tc.wantLockfile {
t.Errorf("lockfile check enabled = %v, want %v\n%s", got, tc.wantLockfile, out)
}
if got := resolved.Mise.VersionsCheckEnabled(); tc.wantEnabled && got != tc.wantVersions {
t.Errorf("versions check enabled = %v, want %v\n%s", got, tc.wantVersions, out)
}
if tc.wantForbidden != nil && !equalStringSlices(resolved.Mise.Versions.ForbiddenVersions, tc.wantForbidden) {
t.Errorf("forbiddenVersions = %v, want %v\n%s", resolved.Mise.Versions.ForbiddenVersions, tc.wantForbidden, out)
}
if tc.wantEnabled && !equalStringSlices(resolved.Mise.ExemptPackages, tc.wantExempt) {
t.Errorf("exemptPackages = %v, want %v", resolved.Mise.ExemptPackages, tc.wantExempt)
}
})
}
}

func equalStringSlices(a, b []string) bool {
if len(a) != len(b) {
return false
Expand All @@ -691,3 +780,49 @@ func containsString(list []string, s string) bool {
}
return false
}

func TestPinAbsentMiseChecks(t *testing.T) {
on := &configuration.MiseConfig{
Lockfile: &configuration.MiseLockfileCheckConfig{},
Versions: &configuration.MiseVersionsCheckConfig{},
Sources: &configuration.MiseSourcesCheckConfig{},
}
off := map[interface{}]interface{}{"enabled": false}
cases := []struct {
name string
src map[interface{}]interface{}
base *configuration.MiseConfig
want map[interface{}]interface{}
}{
{
name: "every check the source leaves out is pinned off when the base enables it",
src: map[interface{}]interface{}{"exemptPackages": []interface{}{"node"}},
base: on,
want: map[interface{}]interface{}{"exemptPackages": []interface{}{"node"}, "lockfile": off, "versions": off, "sources": off},
},
{
name: "a check the source writes is kept as written",
src: map[interface{}]interface{}{"sources": map[interface{}]interface{}{"trustedTools": []interface{}{"aqua:*"}}},
base: on,
want: map[interface{}]interface{}{
"sources": map[interface{}]interface{}{"trustedTools": []interface{}{"aqua:*"}},
"lockfile": off,
"versions": off,
},
},
{
name: "nothing is pinned when the base enables no check",
src: map[interface{}]interface{}{},
base: &configuration.MiseConfig{},
want: map[interface{}]interface{}{},
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := pinAbsentMiseChecks(tc.src, tc.base)
if !reflect.DeepEqual(got, tc.want) {
t.Errorf("got %#v\nwant %#v", got, tc.want)
}
})
}
}
9 changes: 8 additions & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
compScripts = "Detect unverified script execution (curl|bash, base64|bash, |sh, …)"
compJobVars = "Detect sensitive variables overridden in pipeline YAML"
compDinD = "Detect Docker-in-Docker (dind) usage"
compPackageManagers = "Require committed package manager lockfiles with checksums and pinned versions (mise)"

// GitHub-applicable composition checks (new). The cross-provider ones
// (security jobs, DinD) reuse compSecurity / compDinD above.
Expand Down Expand Up @@ -903,7 +904,7 @@ func compositionOptionsForProviders(providers []string) []string {
if hasGitLab {
out = append(out, compHardcoded, compUpToDate, compForbidden, compRefCollision, compAuthorizedComponents, compAuthorizedFunctions)
}
out = append(out, compSecurity, compDinD)
out = append(out, compSecurity, compDinD, compPackageManagers)
if hasGitLab {
out = append(out, compScripts, compJobVars)
}
Expand Down Expand Up @@ -1550,6 +1551,12 @@ func (st *initWizardState) toPlumberConfig() *configuration.PlumberConfig {
}
}

// Provider-independent: mise is a top-level block. It is the
// shipped default's, so the wizard and the default cannot drift.
if compSelected(st, compPackageManagers) {
cfg.Mise = embeddedDefault().Mise
}

// GitHub-only composition checks.
if gh != nil {
if compSelected(st, compActionPin) {
Expand Down
37 changes: 36 additions & 1 deletion cmd/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func starterWizardConfig() *configuration.PlumberConfig {
TrustedURLsText: strings.Join(defaultTrustedURLs(), "\n"),
AuthorizedActionsUsePlumberList: true,
CompositionChoices: []string{
compHardcoded, compUpToDate, compForbidden, compRefCollision, compAuthorizedComponents, compAuthorizedFunctions, compSecurity, compScripts, compJobVars, compDinD,
compHardcoded, compUpToDate, compForbidden, compRefCollision, compAuthorizedComponents, compAuthorizedFunctions, compSecurity, compScripts, compJobVars, compDinD, compPackageManagers,
compActionPin, compAuthorizedActions, compDangerousTriggers, compPRTargetHead, compCheckoutPersist, compDeclarePermissions, compWorkflowValid, compReusableSecrets, compOverprovSecrets, compTemplateInjection,
compEnvInjection, compWriteAllPerms, compRefConfusion, compArchivedActions, compKnownCVEs, compImpostorCommit, compMutableRemoteExec, compCachePoisoning, compDebugTraceGitHub,
},
Expand Down Expand Up @@ -641,6 +641,41 @@ func TestStarterPlumberConfigGitHubMatchesCuratedDefaults(t *testing.T) {
}
}

// TestInitWizardMiseBlock locks the compPackageManagers -> top-level mise
// mapping in toPlumberConfig. The GitLab/GitHub parity tests only read
// provider controls, so without this a dropped mise block would turn
// mise-en-place off for every config init user while the
// suite stayed green.
func TestInitWizardMiseBlock(t *testing.T) {
t.Run("the starter config writes an enabled mise block with the lockfile and versions checks", func(t *testing.T) {
cfg := starterWizardConfig()
if !cfg.Mise.IsEnabled() || !cfg.Mise.LockfileCheckEnabled() || !cfg.Mise.VersionsCheckEnabled() {
t.Fatalf("mise = %+v, want enabled with the lockfile and versions checks on", cfg.Mise)
}
out, err := yaml.Marshal(cfg)
if err != nil {
t.Fatal(err)
}
var written configuration.PlumberConfig
if err := yaml.Unmarshal(out, &written); err != nil {
t.Fatalf("reload written config: %v", err)
}
if !written.Mise.IsEnabled() || !written.Mise.LockfileCheckEnabled() || !written.Mise.VersionsCheckEnabled() {
t.Fatalf("written config lost the mise block:\n%s", out)
}
})
t.Run("not selecting package managers leaves mise out", func(t *testing.T) {
st := &initWizardState{
Providers: []string{"github"},
Categories: []string{catComposition},
CompositionChoices: []string{compArchivedActions},
}
if cfg := st.toPlumberConfig(); cfg.Mise != nil {
t.Fatalf("mise = %+v, want nil", cfg.Mise)
}
})
}

// TestInitWizardEnablesImpostorCommit locks the compImpostorCommit ->
// ActionRefsMustExistUpstream mapping in toPlumberConfig: selecting the
// composition option must enable the control, and a run that does not
Expand Down
Loading
Loading