headscale/.github/workflows
Kristoffer Dalby b29ae25356 policy/v2: evaluate the tests block on user-initiated writes
v2 silently dropped policy.tests, so a policy that contradicted its
own assertions still applied. Resolve src/dst via the existing Alias
machinery, walk the compiled global filter rules (acls and grants
both contribute), and run on every user-write boundary: SetPolicy,
the file watcher, and `headscale policy check`. A failing test
rejects the write before it mutates live state.

Boot-time reload skips evaluation; an already-stored policy that
references a deleted user shouldn't lock the server out.

`headscale policy check` is a thin frontend for the new CheckPolicy
gRPC method. The server-side handler builds a fresh PolicyManager
from the request bytes and the state's live users/nodes, runs
SetPolicy on the sandbox so the tests block executes, and returns
the result through gRPC status. No persistence, no policy_mode
coupling. --bypass-grpc-and-access-database-directly opens the DB
directly when the server is not running.

cmd/headscale/cli/root.go no longer special-cases `policy check` in
init() (the early return from PR #2580 broke --config registration
and viper priming for --bypass).

integration/cli_policy_test.go covers policy_mode={file,database} x
fixture={acl-only, acl+passing-tests, acl+failing-tests} x
bypass={false,true} = 12 rows.

Updates #1803

Co-authored-by: Janis Jansons <janhouse@gmail.com>
2026-05-12 11:54:54 +01:00
..
build.yml ci, pre-commit: validate vendor hash via vendorhash check 2026-05-11 08:46:12 +01:00
check-generated.yml .github/workflows: prebuilt integration test artifacts (#2954) 2025-12-12 23:01:52 +01:00
check-tests.yaml .github/workflows: prebuilt integration test artifacts (#2954) 2025-12-12 23:01:52 +01:00
container-main.yml ci: add rolling development tag to container builds 2026-04-15 14:53:53 +01:00
docs-deploy.yml .github/workflows: prebuilt integration test artifacts (#2954) 2025-12-12 23:01:52 +01:00
docs-test.yml .github/workflows: prebuilt integration test artifacts (#2954) 2025-12-12 23:01:52 +01:00
gh-action-integration-generator.go integration: skip subpackage tests in workflow generator 2026-04-30 12:52:05 +01:00
gh-actions-updater.yaml .github/workflows: prebuilt integration test artifacts (#2954) 2025-12-12 23:01:52 +01:00
integration-test-template.yml ci: switch integration tests to ARM runners 2026-03-31 22:06:25 +02:00
lint.yml ci: fetch full history in golangci-lint job 2026-05-11 10:34:58 +01:00
needs-more-info-comment.yml github: add needs-more-info automation workflow 2026-02-09 09:51:28 +01:00
needs-more-info-timer.yml github: drop nu flatten in needs-more-info timer 2026-04-28 16:36:32 +01:00
nix-module-test.yml .github/workflows: prebuilt integration test artifacts (#2954) 2025-12-12 23:01:52 +01:00
release.yml ci: pin Docker to v28 to avoid v29 breaking changes 2026-02-19 08:21:23 +01:00
stale.yml github: add needs-more-info automation workflow 2026-02-09 09:51:28 +01:00
support-request.yml github: add support-request automation workflow 2026-02-09 09:51:28 +01:00
test-integration.yaml policy/v2: evaluate the tests block on user-initiated writes 2026-05-12 11:54:54 +01:00
test.yml .github/workflows: prebuilt integration test artifacts (#2954) 2025-12-12 23:01:52 +01:00
update-flake.yml cmd/hi: fixes and qol (#2649) 2025-06-23 13:43:14 +02:00