Skip to content

security: path validators are POSIX-only, so on Windows ValidatePathForReading denies nothing #1000

Closed

Description

@scttfrdmn

Found by the new Windows CI job (#971): pkg/security's tests fail on windows-latest, and the package is skipped there (scripts/windows-test-skips.txt) until this is resolved.

  • ValidatePathForReading blocks a list of /etc/, /proc/, /root/, ... prefixes against filepath.Abs. On Windows /etc/passwd becomes D:\\etc\\passwd and /home/u/../../etc/passwd is cleaned to \\etc\\passwd, so nothing matches and every path is allowed. Callers: cmd/launch_config.go (--user-data file and user-data path lists, local machine) and pkg/agent/queue_runner.go (result-upload patterns on the spore, which includes a Windows spore).
  • ValidateMountPath rejects /mnt/data as "must be absolute" on Windows because filepath.IsAbs is host-relative, though mount paths describe a Linux instance.
  • SanitizePath returns backslashed paths on Windows.

Needs a decision per function: which paths are host paths (validate with Windows semantics, e.g. block C:\\Windows) and which are instance paths (validate with path, not filepath). ValidateMountPath and SanitizePath have no production callers today.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions