Skip to content

Claude/bazel issue 14828 4ms8yp - #30865

Draft
fmeum wants to merge 3 commits into
bazelbuild:masterfrom
fmeum:claude/bazel-issue-14828-4ms8yp
Draft

Claude/bazel issue 14828 4ms8yp#30865
fmeum wants to merge 3 commits into
bazelbuild:masterfrom
fmeum:claude/bazel-issue-14828-4ms8yp

Conversation

@fmeum

@fmeum fmeum commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Description

Motivation

Build API Changes

No

Checklist

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: None

fmeum and others added 3 commits August 25, 2026 22:04
The sandbox profile generated for block-network spawns denied
`network-bind`: it allowed accepting and establishing loopback
connections, but binding a socket - what any local test server does
first - was still rejected by `(deny network*)`. As a result, tests
using e.g. OkHttp MockWebServer or Dropwizard failed on macOS while
passing inside the Linux sandbox's network namespace.

Allow `network-bind` for any local address: servers commonly bind to
the wildcard address (0.0.0.0 or ::), which the "localhost" filter
does not match, and a bound socket still cannot exchange traffic with
other hosts because inbound and outbound traffic remains restricted to
loopback. Also allow local Unix domain sockets, which are
filesystem-scoped IPC, in both directions. This matches the behavior of
the Linux sandbox, where arbitrary binds succeed but only the loopback
interface exists.

Adds a regression test that inspects the generated sandbox profile.

Fixes bazelbuild#14828

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QK3qjuij3rTFfNHpeXdvEG
…erage

Drops the unit test that merely asserted on the generated sandbox
profile text and instead extends bazel_sandboxing_networking_test.sh,
which runs on both Linux and macOS, with in-sandbox server coverage for
the various kinds of localhost binding:

* binding to 127.0.0.1, ::1, and the "localhost" hostname (in
  addition to the existing wildcard-address coverage via :loopback),
* binding and connecting to a Unix domain socket inside the sandbox.

testing_server.py gains a --bind_address flag so the test server can
bind a specific address instead of the wildcard address. The :loopback
target now also carries the tags under test so that the tag-based
block-network scenario exercises in-sandbox servers as well.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QK3qjuij3rTFfNHpeXdvEG
The negative direction - blocked spawns must not be able to reach
anything beyond loopback, which is the same boundary that keeps out the
Internet - was previously only covered when REMOTE_NETWORK_ADDRESS was
explicitly set, which CI does not do.

Add a hermetic check that does not require Internet connectivity: the
existing wildcard-bound test server is also reachable via a non-loopback
address of the local machine, so a genrule connecting to that address
must succeed when networking is allowed and must fail in all
block-network scenarios, on Linux and macOS alike. The check is skipped
on machines without a non-loopback address.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QK3qjuij3rTFfNHpeXdvEG
@google-cla

google-cla Bot commented Aug 25, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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