score-spec / score-spec/spec

[BUG] execProbe.command accepts empty array []

Open Beginner friendly
#197 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Makefile
Stars
8.1k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Description

The execProbe definition requires command and types it as an array of strings, but has no minItems constraint:

"command": {
  "type": "array",
  "items": { "type": "string" }
}

In score-v1b1.json

An empty command: [] passes schema validation but is guaranteed to fail at runtime in every container runtime. This is a classic "valid schema, broken deploy" scenario.

Expected behavior

command should require at least one element: "minItems": 1.

Steps to reproduce

Put this in a score YAML and validate:

apiVersion: score.dev/v1b1
metadata:
  name: empty-command-bug
containers:
  main:
    image: my-app
    livenessProbe:
      exec:
        command: []

Validate:
bashjv --assert-format --assert-content ./score-v1b1.json score-empty-command.yaml
Schema validation passes with no error.

Screenshots

NA

Context

I was writing a score.yaml incrementally and used command: [] as a placeholder while figuring out the right probe command. I expected the schema validator to catch it as a clear structural error and flag it so I'd remember to fill it in. It passed silently. This is the kind of thing that would only surface at runtime when kubelet tries to execute an empty command, which is much later than schema validation should allow.

Additional information

I confirmed this passes both the project's jv validator and make test-examples when placed in the samples directory. The Kubernetes API server itself rejects an empty command array on exec probes with "Invalid value: []string(nil)". The same missing minItems issue also exists on container.command (L289) and container.args (L295), though those are optional fields so the impact is lower there.

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

Update the execProbe command definition in score-v1b1.json, where the issue shows the array currently lacks a minItems constraint. Start by inspecting that schema entry, then run bashjv --assert-format --assert-content ./score-v1b1.json score-empty-command.yaml and make test-examples; done means command: [] is rejected while valid probe commands still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, kubernetes, yaml
Domain
devops
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.