clair icon indicating copy to clipboard operation
clair copied to clipboard

httptransport: GET vuln report returns 404 when indexing in-progress

Open frostmar opened this issue 1 year ago • 7 comments

For issue https://github.com/quay/clair/issues/1962

GET /matcher/api/v1/vulnerability_report/<digest> returns HTTP404 when the index report is not complete, instead of a partial vulnerability report based on whatever is present in the index

This doesn't distinguish between in-progress states (a later request will likely be successful) and the final error state IndexError (a later request will likely still be unsuccessful). I'm not sure what would be preferred - HTTP404? HTTP500 with some error body?

frostmar avatar Jan 29 '24 16:01 frostmar

Can one of the admins verify this patch?

app-sre-bot avatar Jan 29 '24 16:01 app-sre-bot

@crozzy sorry for the bump - just checking if this PR has been overlooked?

frostmar avatar Feb 14 '24 14:02 frostmar

@crozzy sorry for the bump - just checking if this PR has been overlooked?

Sorry @frostmar it had indeed fallen through the cracks

crozzy avatar Feb 16 '24 20:02 crozzy

Thinking through re-indexing, will there be a situation where the report is 200OK then is being re-indexed so will be 404Not Found the 200OK again?

I think that will happen, from the user's point of view the vuln report seems to be unavailable for a brief period.

That's pretty much true, however. While (re-)indexing is in progress, there is no valid index report to base a vuln report on, so better to say it's unavailable than give an incorrect one?

As a future extension, there could be a new response instead of HTTP404, to communicate "come back shortly", used when we know we ought to have a completed vuln report available shortly (as indexing is in progress, but hasn't completed) .... but this seems like an edge case that few will benefit from.

frostmar avatar Feb 20 '24 12:02 frostmar

Thanks for the updates, I think it seems like an improvement, @hdonnay is there a situation with clients where you could see this being a problem?

@frostmar looks like you checked in a .vscode file

crozzy avatar Feb 20 '24 19:02 crozzy

... checked in a .vscode file

Sorry, sorted now

frostmar avatar Feb 21 '24 09:02 frostmar

@crozzy / @hdonnay I'm hoping this can make the next release of Clair, if it looks OK to you now?

frostmar avatar Feb 23 '24 15:02 frostmar

@crozzy / @hdonnay bump - can I do anything to progress this please?

frostmar avatar Mar 12 '24 13:03 frostmar