StackStorm / StackStorm/st2

"default" attribute value for action and runner parameters is not validated against parameter schema during content register time

Open
#4,824 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

Let's say we have an action metadata definition file which looks like this:

parameters:
  cmds:
    description: Array of commands.
    #immutable: true
    type: array
    default: "foo"
...

During the register content phase, default value of that parameter won't be validated against the actual parameter type and schema and register step will succeed without any errors.

This value will only get validated during run time and that's when an error will be thrown if user tries to run that action.

For better end user experience and to go along with important "fail early and fast" mantra, we should also validate default attribute value for simple values (aka non-Jinja expressions which can only be validated during run time) and fail during content register time if this attribute fails the validation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the content registration validation path for action and runner parameter schemas, then trace how default values are handled. Make simple, non-Jinja defaults undergo schema validation during registration while leaving runtime-only expressions deferred; verify that the array example is rejected at registration time and valid defaults still register successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.