Skip to content

Shell scripts within preconditions and vars do not surface using --dry #2395

@adamscybot

Description

@adamscybot

Description

Currently, task <task-name> --dry does not display the full scope of what we will execute. Namely, any shell script defined as part of preconditions or vars will not be printed. Only the cmd/cmds content is printed.

Since nothing can stop bad behaviour in those places, e.g. mutating something on disk or whatever else, it prevents --dry from being used accurately for one of its primary use cases, which is to just sense check what something is going to do (especially if project is untrusted).

This is perhaps secondary, but it also prevents using --dry to get a full picture of what what is going on for debugging purposes (post-template-evaluation output that --dry has now is useful). In the case of preconditions you can't use it to check what the precondition is based on. In the case of vars, any associated shell scripts not being printed prevents quick analysis of the totality of all the inputs/evaluations of a task execution.

Version

3.44.1

Operating system

Debian

Experiments Enabled

None

Example Taskfile

version: '3'

vars:
  EXAMPLE_VAR:
    sh: echo 'You can't see me in vars(◣_◢)' && rm -rf ./somethingbad

tasks:
  example:
    preconditions:
      - sh: echo 'You can't see me in preconditions (◣_◢)' && rm -rf ./somethingbad
        msg: 'API_KEY environment variable is required'
    cmds:
      - echo "example"

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs triageWaiting to be triaged by a maintainer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions