Skip to content

fix(spanner): remove PROTO_DESCRIPTORS_FILE_PATH client-side statement - #14970

Open
olavloite wants to merge 1 commit into
mainfrom
spanner-disallow-set-proto-file-descriptor
Open

olavloite wants to merge 1 commit into
mainfrom
spanner-disallow-set-proto-file-descriptor

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

Disallow setting proto descriptors via a local file path to prevent arbitrary file reads on the host filesystem.

The SET PROTO_DESCRIPTORS_FILE_PATH and SHOW VARIABLE PROTO_DESCRIPTORS_FILE_PATH client-side statements allowed reading arbitrary files from the local filesystem of the host executing the application. This posed a security risk of local file inclusion, unintended information disclosure, and potential out-of-memory errors from large files.

Attempting to execute SET PROTO_DESCRIPTORS_FILE_PATH or SHOW VARIABLE PROTO_DESCRIPTORS_FILE_PATH will now fail with an INVALID_ARGUMENT error explaining the alternative options.

Workaround for existing users:
Applications that need to register proto descriptors can load the descriptor file in their application and use one of the following alternatives:

  1. Encode the descriptor bytes as a base64 string and execute the SET PROTO_DESCRIPTORS = '<base64_encoded_proto_descriptors>' statement instead.
  2. If using the Java Connection API directly, pass the descriptor bytes to connection.setProtoDescriptors(byte[]).

Disallow setting proto descriptors via a local file path to prevent
arbitrary file reads on the host filesystem.

The `SET PROTO_DESCRIPTORS_FILE_PATH` and `SHOW VARIABLE
PROTO_DESCRIPTORS_FILE_PATH` client-side statements allowed reading
arbitrary files from the local filesystem of the host executing the
application. This posed a security risk of local file inclusion,
unintended information disclosure, and potential out-of-memory errors
from large files.

Attempting to execute `SET PROTO_DESCRIPTORS_FILE_PATH` or `SHOW
VARIABLE PROTO_DESCRIPTORS_FILE_PATH` will now fail with an
`INVALID_ARGUMENT` error explaining the alternative options.

Workaround for existing users:
Applications that need to register proto descriptors can load the
descriptor file in their application and use one of the following
alternatives:
1. Encode the descriptor bytes as a base64 string and execute the
   `SET PROTO_DESCRIPTORS = '<base64_encoded_proto_descriptors>'`
   statement instead.
2. If using the Java Connection API directly, pass the descriptor
   bytes to `connection.setProtoDescriptors(byte[])`.
@olavloite
olavloite requested review from a team as code owners November 11, 2026 16:14

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes support for setting and showing proto descriptors via a file path (PROTO_DESCRIPTORS_FILE_PATH), updating the connection implementation to throw an INVALID_ARGUMENT exception and advising users to use base64-encoded strings instead. The review feedback points out formatting issues in ClientSideStatementsTest.sql where @expect EXCEPTION annotations are separated from their target statements by several blank lines, which could cause test parser issues or reduce readability.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant