Add a server-wide default for project IP policy mode

Operators should be able to choose LOG_ONLY for enabled project IP
policies without configuring a mode on every project. Add
plugin.access-ipsubnet.globalMode in gerrit.config as the default used
by ProjectIpPolicyProvider when the project mode is missing or blank.
Explicit modes, including inherited ones, override this default.

Keep ENFORCE as the default for missing or blank globalMode values;
warn and fall back to ENFORCE for unrecognized values. This setting
neither enables project policy nor changes enforcement of CIDR lists
in etc/access-ipsubnet.config, including its per-project sections.

Evaluate invalid project modes and policy load failures using the
server-wide default, allowing them under LOG_ONLY. Invalid project
CIDRs use the resolved mode instead, so an explicit ENFORCE override
still denies access.

Document mode precedence and enforcement boundaries. Add unit and HTTP
integration tests for default selection, local and inherited overrides,
invalid modes and CIDRs, and global-file enforcement under LOG_ONLY.

Change-Id: I5ff8f3667036d56460e2ec251bed8ef94635cf06
7 files changed
tree: 4af5be494675ce008426abc16f5c4c92e0e53c34
  1. src/
  2. .gitignore
  3. AGENTS.md
  4. BUILD
  5. README.md
README.md

IP Subnet Access

This module restricts Gerrit project permission checks by source IP/CIDR.

Build

Place the repository at plugins/access-ipsubnet/ in a Gerrit source tree and run from the Gerrit root:

bazelisk build //plugins/access-ipsubnet

Use bazel if bazelisk is unavailable. The artifact is bazel-bin/plugins/access-ipsubnet/access-ipsubnet.jar.

Documentation