mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-19 09:06:14 +00:00
Replace the filepath.Abs + string-prefix path-traversal check followed by os.Stat / os.ReadFile calls with an os.Root anchored at stockholmDir. CodeQL (go/path-injection, alerts 143–145) did not recognise the string-based validation as a sanitiser boundary; os.Root is the same OS-level barrier used in the sec3 datastore and recorder refactors. Changes: - Open os.OpenRoot(stockholmDir) in ServeStatic; all file ops go through root.Stat / root.Open instead of os.Stat / os.ReadFile. - Replace resolveStaticFile (returned absolute + relative paths) with resolveStaticRel (URL path → relative path only; no filesystem access, no traversal logic — the Root handles containment). - Directory → index.html fallback moved into ServeStatic via root.Stat. - Drop path/filepath import from static.go (no longer needed). - Update tests: resolveStaticFile unit tests become resolveStaticRel unit tests; directory and traversal cases become ServeStatic integration tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>