Skip to content
This repository was archived by the owner on May 24, 2026. It is now read-only.
This repository was archived by the owner on May 24, 2026. It is now read-only.

security: envsubst on image/container fields allows environment variable injection #14

Open

Description

@SimplicityGuy

Summary

image and container config fields are piped through envsubst without validating the expanded result. If a container environment variable contains shell metacharacters, they will be inserted into the generated script unescaped.

Location

entrypoint.sh lines 72, 84

IMAGE=$(echo "${1}" | jq -r .image | envsubst)
CONTAINER=$(echo "${1}" | jq -r .container | envsubst)

Attack Vector

If MALICIOUS_VAR is set in the container environment and a config references it:

{ "image": "${MALICIOUS_VAR}", "schedule": "* * * * *", "command": "test" }

And MALICIOUS_VAR="alpine; rm -rf /tmp", the generated script would expand to include the injected content. While the companion fix (quoting IMAGE in the generated command) reduces immediate exploitability, the underlying unvalidated substitution remains a latent risk for future refactors.

Recommended Fix

Validate the expanded value against an allowlist pattern after substitution:

IMAGE=$(echo "${1}" | jq -r .image | envsubst)
if [[ ! "${IMAGE}" =~ ^[a-zA-Z0-9:/_\.\-]+$ ]]; then
    echo "Error: invalid image name '${IMAGE}'"
    return 1
fi

Severity

High

Activity

  1. added
    security
    on Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions