Skip to content

bug(misconf): ENV with extra spaces in image history causes parse error #9496

Description

@nikpivkin

Steps to reproduce:

  1. Create a Dockerfile
from alpine

env TEST \
  foo \
  bar
  1. Build and scan the image:
docker build -t diss-9494 .
trivy i --scanners="" --image-config-scanners=misconfig diss-9494
  1. Output:
2025-09-19T11:24:41+06:00       INFO    [image] Container image config scanners scanners=[misconfig]
2025-09-19T11:24:41+06:00       INFO    [misconfig] Misconfiguration scanning is enabled
2025-09-19T11:24:42+06:00       ERROR   [dockerfile scanner] Failed to parse file       file_path="Dockerfile" err="dockerfile parse error: Syntax error - can't find = in \"bar\". Must be of the form: name=value"
2025-09-19T11:24:42+06:00       INFO    Detected config files   num=0
2025-09-19T11:24:42+06:00       WARN    [report] No enabled scanners found. Summary table will not be displayed.

Discussed in #9494

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.scan/misconfigurationIssues relating to misconfiguration scanning

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions