Skip to content

Policy upload sends rpc_allow_google_protobuf_empty_responses from the requests value (copy-paste) #2

Description

@fchimpan

Summary

The policy upload path populates rpc_allow_google_protobuf_empty_responses from the requests getter, so the uploaded policy silently differs from the local buf.policy.yaml whenever the two values differ. Allowing google.protobuf.Empty responses (but not requests) is a common lint exception for Delete-style RPCs, so the mismatched case is realistic.

Reproduction

# buf.policy.yaml
version: v2
lint:
  use: [STANDARD]
  rpc_allow_google_protobuf_empty_responses: true   # requests left unset (false)

Uploading this policy sends RpcAllowGoogleProtobufEmptyResponses: false (the value of requests). Conversely, setting only ..._requests: true silently enables responses server-side. Lint results then differ between local runs and the BSR-stored policy.

Root cause

private/bufpkg/bufpolicy/bufpolicyapi/uploader.go:181-182:

RpcAllowGoogleProtobufEmptyRequests:  lintConfig.RPCAllowGoogleProtobufEmptyRequests(),
RpcAllowGoogleProtobufEmptyResponses: lintConfig.RPCAllowGoogleProtobufEmptyRequests(),  // <- should be ...Responses()

PolicyConfigToV1Beta1Proto (convert.go:111) populates the same proto field correctly, so upload and conversion disagree with each other.

Expected

The uploaded config equals the parsed local config.

(Verified by source inspection; the upload itself requires a BSR and was not run end-to-end.)


Found via a full mutest (mutation-testing) run over this repo; verified manually.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions