Skip to content

Commit

Permalink
fix: restrict proto package visibility to private (bazelbuild#1117)
Browse files Browse the repository at this point in the history
This is to prevent accidentally leaking targets that shouldn't be
accessible. The `:python_toolchain` target is public because it's an
implicit dependency of `py_proto_library`.
  • Loading branch information
rickeylev authored Mar 9, 2023
1 parent 25e4175 commit 9ef11b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/private/proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")

package(default_visibility = ["//visibility:public"])
package(default_visibility = ["//visibility:private"])

licenses(["notice"])

Expand All @@ -40,4 +40,7 @@ proto_lang_toolchain(
command_line = "--python_out=%s",
progress_message = "Generating Python proto_library %{label}",
runtime = "@com_google_protobuf//:protobuf_python",
# NOTE: This isn't *actually* public. It's an implicit dependency of py_proto_library,
# so must be public so user usages of the rule can reference it.
visibility = ["//visibility:public"],
)

0 comments on commit 9ef11b9

Please sign in to comment.