mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 14:36:33 +01:00
fix: don't infer archive nesting from paths in error text
`ProcessPathErrors` cut the `path="..."` it pulled out of an error at the first `!/` and built nested coordinates from it, so a host file with `!/` in its name was reported as a file inside an archive. - paths from error text are taken as plain real paths again, as on main - the php extension reader already has the location in hand, so it records the unknown against that instead of re-parsing the error (this is the one caller that could see a nested path). It also no longer defers `Close` on a nil reader when the read fails Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
@@ -35,6 +35,13 @@ func Test_ProcessPathErrors(t *testing.T) {
|
||||
Reason: fmt.Errorf(`path="/var/lib/thing" suffix`),
|
||||
},
|
||||
},
|
||||
{
|
||||
errorText: `path="/data/Hello!/world.txt"`,
|
||||
expected: &CoordinateError{
|
||||
Coordinates: file.NewCoordinates("/data/Hello!/world.txt", ""),
|
||||
Reason: fmt.Errorf(`path="/data/Hello!/world.txt"`),
|
||||
},
|
||||
},
|
||||
{
|
||||
errorText: "all your base are belong to us",
|
||||
expected: nil,
|
||||
|
||||
Reference in New Issue
Block a user