Skip to content

LGTM.com - false positive go-path-injection despite using path.Clean #7540

@thediveo

Description

@thediveo

Description of the false positive

https://codeql.github.com/codeql-query-help/go/go-path-injection/ triggers despite using Go stdlib path.Clean to sanitize user input before constructing a sandboxed filesystem path using path.Join(h.staticPath, uriPath).

path.Clean ensures that the user-supplied path cannot escape its root, see https://pkg.go.dev/path#Clean. path.Join using a well-defined sandbox root path ensures that access is kept within the sandbox for serving files.

URL to the alert on the project page on LGTM.com

https://lgtm.com/projects/g/TheDiveO/lxkns/snapshot/29308eb48388242ce0069aab9760f2dcceb84b29/files/cmd/lxkns/server.go?sort=name&dir=ASC&mode=heatmap#xaab8d054ed837544:1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions