feat: add variadic-args lint rule#63
Open
olavostauros wants to merge 2 commits into
Open
Conversation
Scans .mise/tasks/* for #USAGE directives with var=#true, then flags
dangerous consumption of the resulting usage_* vars:
- eval 'ARRAY=${usage_X}' → ERROR: injection vector
- read -ra ARRAY <<< "$usage_X" → WARN: loses quoting
The correct pattern uses xargs printf for bash or shlex.split() for
Python tasks, per mise-conventions.md.
…g no-tasks fixture
This was referenced Jun 26, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
lint:variadic-argsrule that detects dangerous consumption of variadic#USAGEdirective values in.mise/tasks/*files (implements issue #21).Detection
Two-phase file-scan with per-file context:
#USAGE arg ... var=#trueand#USAGE flag ... var=#truedirectives to identify variadic env var names (usage_args,usage_foo_bar)eval "ARRAY=(\${usage_X:-})"→ ERROR: shell injection vectorread -ra ARRAY <<< "$usage_X"→ WARN: loses quoting on multi-word valuesNon-variadic vars are never flagged (zero false positives verified).
Correct pattern (per mise-conventions.md)
The rule suggests the
xargs printfpattern for bash andshlex.split()for Python tasks.Files added
.mise/tasks/lint/variadic-argstest/lint/variadic-args/variadic-args.batstest/lint/variadic-args/fixtures/Validation
codebase lint:variadic-args .— all 15 codebase task files cleangit diff --check— no errorsCloses #21