Skip to content

fix(security): validate sidecar paths to prevent path injection attacks#12

Open
jkyberneees wants to merge 1 commit intomainfrom
fix/path-injection-sidecar-loading
Open

fix(security): validate sidecar paths to prevent path injection attacks#12
jkyberneees wants to merge 1 commit intomainfrom
fix/path-injection-sidecar-loading

Conversation

@jkyberneees
Copy link
Contributor

Fixes CodeQL path-injection warning in loadSidecar function. The sidecar file paths (.gz, .br, .zst extensions) are now validated to ensure they remain within the root directory, preventing symlink escape attacks.

  • Convert loadSidecar to a method on FileHandler for access to absRoot
  • Resolve symlinks in both the sidecar path and root directory
  • Validate sidecar path is within root before reading
  • Log rejected paths for security auditing

@jkyberneees jkyberneees force-pushed the fix/path-injection-sidecar-loading branch from 842f0e1 to d63c759 Compare March 24, 2026 20:11
Fixes CodeQL path-injection warning in loadSidecar function. The sidecar
file paths (.gz, .br, .zst extensions) are now validated to ensure they
remain within the root directory, preventing symlink escape attacks.

- Convert loadSidecar to a method on FileHandler for access to absRoot
- Resolve symlinks in both the sidecar path and root directory
- Validate sidecar path is within root before reading
- Log rejected paths for security auditing
@jkyberneees jkyberneees force-pushed the fix/path-injection-sidecar-loading branch from d63c759 to 8c50603 Compare March 24, 2026 20:16
}

// Path is validated and safe — read the file.
data, err := os.ReadFile(realPath)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant