Skip to content

Potential fragility in path-pattern matching #747

Description

@udf2457

go-tuf/metadata/metadata.go

Lines 585 to 587 in 4b704cd

if ok, _ := filepath.Match(patternParts[i], targetParts[i]); !ok {
return false
}

patternMatched, err := filepath.Match(pathPattern, targetPath)
if err != nil {
// error looking for a match
return nil, nil, err

In theory there is some fragility in the above because filepath.Match is tied to the OS.

In general it should have negligible impact, but you might hit an edge case on Windows with \. So you might want to consider options for how you want to handle that ? Might need to check the TUF spec.

In addition err is discarded in the metadata.go version which means you have no way to distinguish between "no match" and "invalid pattern". Surely an invalid pattern should error ?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions