config_setting visibility not enforced
See original GitHub issueDescription of the problem / bug:
It should not be allowed to access a private config_setting from select in other package. But bazel fails to enforce the visibility.
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
pkgA/BUILD:
load(
"@bazel_skylib//rules:common_settings.bzl",
"bool_flag",
)
bool_flag(
name = "myFlag",
build_setting_default = False,
# This visibility is working, however the config_setting is in same package.
visibility = ["//visibility:private"]
)
config_setting(
name = "mySetting",
flag_values = {"myFlag": "True"},
# This can be accessed from pkgB, despite private visibility
visibility = ["//visibility:private"]
)
pkgB/BUILD:
genrule(
name = "foo",
srcs = [],
outs = ["foo.out"],
# Can access mySetting from another package, despite private visibility.
cmd = select({
"//pkgA:mySetting": "echo running with mySetting > $@",
"//conditions:default": "echo running default > $@"}),
)
I expect both of the following commands to fail, due to pkgB accessing private config_setting in pkgA, but no error is detected:
bbi_bazel build //pkgB:foo --//pkgA:myFlag=True
bbi_bazel build //pkgB:foo --//pkgA:myFlag=False
What operating system are you running Bazel on?
Linux
What’s the output of bazel info release
?
3.7.0
Have you found anything relevant by searching the web?
I searched, but have not found anything.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Visibility | Bazel
Config setting visibility. Historically, Bazel has not enforced visibility for config_setting targets that are referenced in the keys of a ...
Read more >visibility-like capability for bzl files (rules, aspects, and macros ...
We are actively interested in (i.e., designing this quarter) a feature for load() -level enforcement of .bzl visibility. This would not ...
Read more >User email visibility setting should not affect REST responses
In JIRA Server we notice that if a user sets the General Config setting "User email visibility" to Hidden, that is described as...
Read more >General Config Settings | Craft CMS Documentation | 3.x
To set a new config setting, open config/general.php and define it in one of the ... should not be indexed, and links on...
Read more >CONFIG SETTING FOR DATUM FILTERS? - PTC Community
Hey all, I am trying to see if there is a config setting that will leave the ... how to get layer rules...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Filed bugs for
--incompatible_*
flags: https://github.com/bazelbuild/bazel/issues/12932. PR using them incoming.FYI: I rolled back my PR because it breaks some projects that already set
visibility
onconfig_setting
with bad values.I’m rolling it forward again behind a flag. Stay tuned…