# Fix Cross-Platform Windows Secret Mount Path Validation and Hash Stability
Author: aayuxsh326Created Sep 8, 2026Updated Sep 11, 2026
Fix Cross-Platform Windows Secret Mount Path Validation and Hash Stability
Background & Problem
In src/flyte/_secret.py:
- Windows Mount Path Check: The validation logic
if str(self.mount) != "/etc/flyte/secrets"fails on Windows becausepathlib.Path("/etc/flyte/secrets")formats as\etc\flyte\secretsunderstr(). This causes any valid Secret with a mount path to raiseValueError: Only /etc/flyte/secrets is supported as secret mount path today.on Windows systems, breakingtest_secret_mount_valid(). - Stable Hash Consistency:
Secret.stable_hash()usesstr(self.mount), which causes the same secret definition to yield different SHA-256 hashes on Windows vs. Linux/macOS. - Broken
__main__Example: Line 94 usesmount=pathlib.Path("/path/to/secret")which immediately crashes if the script is run directly.
User Review Required
[!NOTE] No breaking changes to existing APIs or interfaces.
Secret.mountcontinues to acceptpathlib.Path | None, and we also permitstr | pathlib.Path | Nonenormalized topathlib.Pathor standard POSIX representation.
Proposed Changes
Core Library
[MODIFY] src/flyte/_secret.py
- In
Secret.__post_init__, convertself.mountif it's a string topathlib.Path, and checkself.mount.as_posix() != "/etc/flyte/secrets". - In
Secret.stable_hash, useself.mount.as_posix()instead ofstr(self.mount)so the hash is deterministic across all operating systems. - In
if __name__ == "__main__":, update the example to use/etc/flyte/secrets.
Test Suite
[MODIFY] tests/user_api/test_secret.py
- Verify
Secret(key="my-secret", mount=pathlib.Path("/etc/flyte/secrets"))passes across platforms. - Verify
Secret(key="my-secret", mount="/etc/flyte/secrets")(string mount) works cleanly. - Verify
stable_hash()produces the exact same hash regardless of whetherPathorPurePosixPathis provided on any OS.
Verification Plan
Automated Tests
- Run validation scripts using Python directly against
src/flyte/_secret.pyto confirm the fix works on Windows. - Verify that hash determinism tests pass.
Source: flyteorg/flyte