EVERYONE@ is reserved in both directions (L4 auth / ACL)¶
The subject-token space is opaque bytes with exactly one spelling the evaluators know:
kEveryoneSubject — "EVERYONE@". An ACE carrying it applies to every resolved subject, which
is how a vertex is opened to all comers for one right without enumerating anybody
(ADR-0020).
The half that is easy to miss is the other direction, and it is the reason this gets its own example.
What to notice¶
The wire has ONE spelling for a subject token. The ACE’s subject and the resolver’s output are the same opaque bytes — the
acl/acl-acesconformance vector sendspeer-aand the wildcard as the same opaque VALUE. So a principal that could BE those bytes would be indistinguishable from the wildcard ACE.The core refuses the resolver’s OUTPUT, rather than trusting every integrator to blacklist the string. A caller that resolves to
EVERYONE@is denied at every gate (#908). The deployments at risk are exactly the ones whose resolver passes a caller-supplied identity through — usernames, certificate CNs, peer names — which is the most ordinary resolver there is.It is refused on a BARE vertex too, and that is the discriminating case. The refusal happens before the open-by-default rule, so it is not “the wildcard subject matches no ACE”; it is “this is not a principal at all”. The example checks the bare vertex with an ordinary caller as the ablation, so the deny is not just a vertex that happened to be closed.
is_reserved_subject()is public for a reason. A resolver can refuse the token at its own door as well; the core checks it in the two places a subject reaches an ACE comparison.The wildcard grant is still one bit.
EVERYONE@withREADis notEVERYONE@with access — seeaccess_maskis a bitfield.OWNER@is not a special subject and never was. ADR-0020 named it once, no evaluator ever special-cased it, so anOWNER@ACE matched nobody while still closing the vertex it was written to delegate. The erratum (#1033) withdraws the name rather than reserving it: with no document telling an operator to write that ACE, there is nothing for an impersonatedOWNER@principal to match either. The example asserts it is an ordinary token.Nothing here is conditional — the target builds and runs under every CI leg.
Source¶
1/*
2 * SPDX-License-Identifier: Apache-2.0
3 * SPDX-FileCopyrightText: Copyright 2026 avatarsd LLC
4 */
5
6/**
7 * @file
8 * @brief ONE CONCEPT — `EVERYONE@` is the one wildcard subject, and it is RESERVED both ways.
9 *
10 * The subject-token space is opaque bytes, with exactly one spelling the evaluators know:
11 * `tr::graph::kEveryoneSubject` — `"EVERYONE@"`. An ACE carrying it applies to every resolved
12 * subject, which is how a vertex is opened to all comers for one right without enumerating
13 * anybody (ADR-0020).
14 *
15 * The half that is easy to miss is the OTHER direction. The wire has ONE spelling for a subject
16 * token: the ACE's subject and the resolver's output are the same opaque bytes. So a principal
17 * that could BE those bytes would be indistinguishable from the wildcard — and the deployments
18 * at risk are exactly the ones whose resolver passes a caller-supplied identity through
19 * (usernames, certificate CNs, peer names). The core therefore refuses to let a RESOLVED subject
20 * spell it (#908): that caller is denied at every gate, on a guarded vertex and on a bare one
21 * alike, rather than every integrator being left to know to blacklist the string.
22 *
23 * Note what the bare-vertex case means: the refusal happens BEFORE the open-by-default rule, so
24 * it is not "the wildcard subject matches no ACE" — it is "this is not a principal at all".
25 *
26 * `OWNER@` is deliberately absent. ADR-0020 named it once, no evaluator ever special-cased it,
27 * and so an `OWNER@` ACE matched nobody while still CLOSING the vertex it was written to
28 * delegate — the erratum (#1033) withdraws the name rather than reserving it.
29 *
30 * Runs under ctest as `example_acl_everyone_reserved`; returns non-zero on any failed check.
31 */
32
33#include <cstdio>
34#include <cstring>
35#include <span>
36#include <string_view>
37#include <vector>
38
39#include "libtracer/graph.hpp"
40#include "libtracer/mem_heap.hpp"
41#include "libtracer/security_acl.hpp"
42
43namespace {
44
45using tr::graph::ace_t;
46using tr::graph::acl_right_t;
47using tr::graph::graph_t;
48using tr::graph::kEveryoneSubject;
49using tr::graph::path_t;
50using tr::graph::role_t;
51using tr::graph::status_t;
52using tr::graph::vertex_handle_t;
53
54/** @brief Report expectation @p what and record a failure on @p ok. */
55void check(bool& ok, bool cond, const char* what) {
56 std::printf(" [%s] %s\n", cond ? "ok" : "FAIL", what);
57 ok = ok && cond;
58}
59
60/** @brief @p s as opaque subject-token bytes. */
61std::vector<std::byte> as_bytes(std::string_view s) {
62 std::vector<std::byte> out(s.size());
63 std::memcpy(out.data(), s.data(), s.size());
64 return out;
65}
66
67/** @brief Append @p subject to the gate's buffer @p out; a refused append fails closed. */
68std::expected<void, tr::wire::err_t> put_subject(tr::mem::bytes_t& out, std::string_view subject) {
69 if (!out.append(reinterpret_cast<const std::byte*>(subject.data()), subject.size()))
70 return std::unexpected(tr::wire::err_t::ACCESS_DENIED);
71 return {};
72}
73
74/**
75 * @brief The pass-through resolver — the shape #908 exists for.
76 *
77 * It hands back whatever the caller context said, which is what an integrator writes when the
78 * transport already authenticated a name. It is also exactly what would let a peer that managed
79 * to be called `EVERYONE@` resolve to the wildcard, so the core refuses the OUTPUT rather than
80 * trusting every such resolver to blacklist the token itself.
81 */
82std::expected<void, tr::wire::err_t> caller_is_subject(void*, std::string_view caller,
83 tr::mem::bytes_t& out, std::uint64_t&) {
84 return put_subject(out, caller);
85}
86
87/** @brief A one-byte VALUE. */
88tr::view::view_t some_value() {
89 const std::byte one[1] = {std::byte{0x01}};
90 return *tr::view::over_bytes(one);
91}
92
93/** @brief True iff @p r was refused by an ACL gate. */
94template <class T>
95bool denied(const tr::graph::result_t<T>& r) {
96 return !r.has_value() && r.error() == status_t::PERMISSION_DENIED;
97}
98
99} // namespace
100
101int main() {
102 bool ok = true;
103 graph_t g;
104 g.set_hook(&tr::graph::graph_hooks_t::subject_lookup, {caller_is_subject, nullptr});
105 const vertex_handle_t guarded = g.register_vertex(path_t("/guarded"), role_t::STORED_VALUE);
106 const vertex_handle_t bare = g.register_vertex(path_t("/bare"), role_t::STORED_VALUE);
107 (void)g.write(guarded, some_value()); // trusted local seeds, so a refused READ is the
108 (void)g.write(bare, some_value()); // only way either read below can fail
109
110 // The wildcard ACE: READ for everybody, and nothing else for anybody.
111 const ace_t wildcard[] = {{.subject = tr::graph::subject_of(kEveryoneSubject),
112 .access_mask = static_cast<std::uint32_t>(acl_right_t::READ)}};
113 (void)g.write(path_t("/guarded:acl"), *tr::view::over_bytes(tr::graph::encode_acl(wildcard)));
114
115 // Direction 1 — as an ACE subject, it matches every principal, named or not.
116 check(ok, g.read(guarded, "alice").has_value(), "the wildcard ACE grants READ to alice");
117 check(ok, g.read(guarded, "a-peer-nobody-enumerated").has_value(), "…and to a stranger");
118 check(ok, denied(g.write(guarded, some_value(), "alice")),
119 "…and it is still ONE bit: the wildcard granted READ, not access");
120
121 // Direction 2 — as a RESOLVED subject, it is not a principal at all.
122 check(ok, denied(g.read(guarded, kEveryoneSubject)),
123 "a caller resolving to EVERYONE@ is denied on the guarded vertex…");
124 check(ok, denied(g.read(bare, kEveryoneSubject)),
125 "…and on the BARE one too, which open-by-default would otherwise have allowed");
126 check(ok, g.read(bare, "alice").has_value(),
127 "the ablation: the bare vertex really is open to an ordinary caller");
128
129 // The same predicate, published so a resolver can refuse the token at its own door as well.
130 check(ok, tr::graph::is_reserved_subject(as_bytes(kEveryoneSubject)),
131 "is_reserved_subject() is the check, and it is public for that reason");
132 check(ok, !tr::graph::is_reserved_subject(as_bytes("OWNER@")),
133 "OWNER@ is NOT reserved and NOT special — it is an ordinary opaque token (#1033)");
134
135 std::printf("one reserved subject, %zu bytes: \"%.*s\"\n", kEveryoneSubject.size(),
136 static_cast<int>(kEveryoneSubject.size()), kEveryoneSubject.data());
137 return ok ? 0 : 1;
138}
See also: security-acl module · protocol TLVs · the subject resolver · open by default.