Skip to content

sec (2/9): reject inline env values in user-defined scanners#26

Open
jesse-merhi wants to merge 1 commit into
sec/01-lowercase-scanner-idsfrom
sec/02-reject-inline-env
Open

sec (2/9): reject inline env values in user-defined scanners#26
jesse-merhi wants to merge 1 commit into
sec/01-lowercase-scanner-idsfrom
sec/02-reject-inline-env

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Jul 23, 2026

Copy link
Copy Markdown
Member

What changes

A user-defined scanner's env: list must contain bare variable names
(API_TOKEN), never inline NAME=value pairs. An entry with an = is rejected
at config-resolution time, and — critically — the rejected value is never
echoed
in the error.

Why it matters

env: exists so a scanner can be handed a secret that ClawScan reads from the
process environment and records only by presence (present/missing). If an
author writes API_TOKEN=sk-live-... inline, the secret would live in the
config file and could surface in logs/errors. Requiring bare names keeps secret
values out of config entirely, matching the repo rule "record env presence,
never values."

Before / after (runnable)

env.yml:

version: 1
profiles:
  demo:
    scanners:
      - id: foo
        command: "scan {{target}}"
        env:
          - "API_TOKEN=sk-live-secret"
Behavior
Before inline NAME=value accepted; secret value carried in config
After rejected, and the error omits the value:
$ clawscan ./skill --config env.yml --profile demo --sandbox off --json
User-defined scanner foo in profile demo has an invalid env entry "API_TOKEN";
declare bare variable names and set values in the environment, not inline

The reject message names API_TOKEN but does not contain sk-live-secret.
A bare env: [API_TOKEN] is still accepted.

Verify

go test ./internal/profiles/ -run 'UserDefinedScannerEnv' -count=1

A user-defined scanner declares required env as bare variable names; the
value is supplied by the environment. An inline value (API_TOKEN=secret)
would leak into requirement diagnostics, the artifact env map, and the
Docker sandbox passthrough. Reject any env entry that is not a bare, valid
variable name. The validation error echoes only the name before "=", never
the value.
Copilot AI review requested due to automatic review settings July 23, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@clawsweeper

clawsweeper Bot commented Jul 24, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: sec (2/9): reject inline env values in user-defined scanners This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants