Skip to content

Add cross-platform behavior tests for path-safety on Windows-style inputs #175

@dgenio

Description

@dgenio

Summary

Add tests that exercise the path-safety logic against Windows-style inputs (drive letters,
backslashes, UNC) regardless of the host OS, so the documented absolute/UNC bans hold on every
platform the binaries target. Complements open issue #109 (OS matrix CI) at the unit level.

Why this matters

evaluatePathSafety has explicit Windows handling (isUNCPath, isWindowsAbsPath, backslash
normalization), but the logic is exercised by unit tests that may run only on Linux CI. Pinning
the Windows-input behavior in OS-independent unit tests ensures the cross-platform bans never
regress, independent of the OS-matrix CI proposed in #109.

Current evidence

External context

Not required for this issue.

Proposed implementation

  1. Add table-driven tests feeding Windows-style strings (C:\\Users\\x, \\\\srv\\share,
    c:/x, mixed slashes) and asserting deny, OS-independently (the logic is lexical).
  2. Cross-link [CI] Run the test suite on a Linux/macOS/Windows matrix #109 so the matrix CI and unit tests reinforce each other.

AI-agent execution notes

Inspect: internal/engine/engine.go (path-safety helpers), internal/engine/engine_test.go,
open issue #109. These checks are lexical and OS-independent, so the tests need not run on
Windows to be meaningful. Cover the boundary cases in isWindowsAbsPath (C: exactly, C:/).

Acceptance criteria

Test plan

go test ./internal/engine (runs on any OS).

Documentation plan

None beyond test comments; optionally note cross-platform path handling in the policy docs.

Migration and compatibility notes

Not expected to require migration.

Risks and tradeoffs

Low risk; additive tests for existing behavior.

Suggested labels

testing, reliability, area:engine

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions