Reject unsupported qualifiers in Remote Asset API#807
Reject unsupported qualifiers in Remote Asset API#807malt3 wants to merge 4 commits intobuchgr:masterfrom
Conversation
Ignoring unusable checksums is insecure: The server has to reject any qualifiers that it cannot understand. Otherwise, clients cannot rely on the validation performed by the server. See: https://github.com/bazelbuild/remote-apis/blob/7f922028fcfac63bdd8431e68de152d9e7a9e2a0/build/bazel/remote/asset/v1/remote_asset.proto#L109-L115
The specification requires that any `Fetch` requests containing unsupported qualifiers are rejected with an `INVALID_ARGUMENT` rpc error: - https://github.com/bazelbuild/remote-apis/blob/7f922028fcfac63bdd8431e68de152d9e7a9e2a0/build/bazel/remote/asset/v1/remote_asset.proto#L109-L112 - https://github.com/bazelbuild/remote-apis/blob/7f922028fcfac63bdd8431e68de152d9e7a9e2a0/build/bazel/remote/asset/v1/remote_asset.proto#L127-L128 Additionally, the status returned should include a `BadRequest` error detail with `FieldViolation`s indicating the names of unsupported qualifiers: - https://github.com/bazelbuild/remote-apis/blob/7f922028fcfac63bdd8431e68de152d9e7a9e2a0/build/bazel/remote/asset/v1/remote_asset.proto#L139-L143
7ca839f to
1fe6a80
Compare
|
Hi, thanks for the contribution. I think the spec is too strict here- for example what if the client provides two cryptographically secure hash qualifiers, and the server only supports one of them. In that scenario I think the server should be allowed to decide if the supported qualifiers are sufficient. I created a spec change PR here: bazelbuild/remote-apis#329 |
|
As mentioned in my comment on your PR, I don't think the spec allows for more than one expected checksum right now. Additionally, bazel-remote only understands EDIT: @peterebden noted that |
|
@mostynb I can update this PR to support parsing |
The specification requires that any
Fetchrequests containing unsupported qualifiers are rejected with anINVALID_ARGUMENTrpc error12.Additionally, the status returned should include a
BadRequesterror detail withFieldViolations indicating the names of unsupported qualifiers3Footnotes
https://github.com/bazelbuild/remote-apis/blob/7f922028fcfac63bdd8431e68de152d9e7a9e2a0/build/bazel/remote/asset/v1/remote_asset.proto#L109-L112 ↩
https://github.com/bazelbuild/remote-apis/blob/7f922028fcfac63bdd8431e68de152d9e7a9e2a0/build/bazel/remote/asset/v1/remote_asset.proto#L127-L128 ↩
https://github.com/bazelbuild/remote-apis/blob/7f922028fcfac63bdd8431e68de152d9e7a9e2a0/build/bazel/remote/asset/v1/remote_asset.proto#L139-L143 ↩