: asapien/signet

commit df5fafaf964008950dc0313e4a37e8c49a5fd017
parent 59a9e937a41ca88b7d0058a4d19f7f8b02906ec5
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Tue, 24 Nov 2026 09:55:23 +0530

Prepare native beta delivery and exact LDAP group matching
14 files changed, 423 insertions(+), 8 deletions(-)
A
.config/Jobfile
|
22
++++++++++++++++++++++
M
.scratch/beta-release/README.md
|
9
+++++++++
A
.scratch/beta-release/endpoint-20261124.md
|
117
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
.scratch/beta-release/native-20261124.md
|
145
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M
.scratch/beta-release/rollout.md
|
24
++++++++++++++++++++++++
M
HANDOFF.md
|
26
+++++++++++++++++++++++++-
M
Makefile
|
5
+++--
M
README.md
|
10
+++++++---
M
src/conf.c
|
5
++++-
A
test/conf-groups.c
|
28
++++++++++++++++++++++++++++
A
test/conf-groups.sh
|
11
+++++++++++
M
test/e2e.sh
|
4
++++
M
test/identity-contract.sh
|
23
+++++++++++++++++++++++
M
todo.txt
|
2
+-
diff --git a/.config/Jobfile b/.config/Jobfile
@@ -0,0 +1,22 @@
+# Native Alpine runner. Target/account/identity policy is operator-owned.
+project=signet
+pkgname=signet
+refs=refs/heads/main
+environment=beta
+deploy_target=signet
+
+build() {
+	make -j1
+}
+check() {
+	sh test/conf-groups.sh
+	sh test/command-contract.sh
+	sh test/image-contract.sh
+	sh -n test/conf-groups.sh test/identity-contract.sh test/e2e.sh
+}
+package() {
+	make install DESTDIR="$pkgdir"
+	printf '%s\n' "$MINCI_REVISION" > "$pkgdir/REVISION"
+}
+# Minci prepares and activates the package. OpenRC, private configuration and
+# application health checks remain operator work, outside the build sandbox.
diff --git a/.scratch/beta-release/README.md b/.scratch/beta-release/README.md
@@ -15,6 +15,15 @@ primary origin/main verified. The Minci fc0ea0f/local-only inventory dates2026-1
 recheck its current installation and docs before treating that older observation
 as a blocker. See29 before attempting a CI/deploy run.
 
+## Public endpoint update —2026-11-24
+
+Owner confirmed `https://sign.saikrupagas.com/`; its TLS failure is repaired using
+existing ACME. Every route is intentionally closed403: **the application is not
+installed or deployed**. Fresh installed-Minci/toolchain/account inspection and
+remaining provisioning/role approvals are recorded in
+[endpoint evidence](endpoint-20261124.md). Do not reuse the older domain-unknown
+status or interpret valid HTTPS as working beta/SSO acceptance.
+
 ## Source preparation
 
 Canonical worktree: `/Users/saikrupa/Projects/signet`, branch `main`. The owner
diff --git a/.scratch/beta-release/endpoint-20261124.md b/.scratch/beta-release/endpoint-20261124.md
@@ -0,0 +1,117 @@
+# Public endpoint inspection and partial repair — 2026-11-24
+
+## Authorization and result
+
+Owner requested reading the docs, fixing `https://sign.saikrupagas.com/` first,
+using SSH and `/etc/lighttpd/AGENTS.md` on maa-1, then continuing work not needing
+input. This confirms the hostname; it does not supply role assignments or approve
+new dependencies, OS account/permission provisioning, or bypassing Minci.
+
+**TLS repaired; application NOT deployed.** Public HTTPS now validates normally
+and every route returns403 deliberately. This is a closed reservation, not a
+working beta, an authenticated Signet instance, or rollout29 completion.
+
+## Reproduction and cause
+
+- Public curl failed with TLS alert internal error before receiving HTTP.
+- Loopback SNI probe likewise returned no peer certificate.
+- No Signet proxy/backend vhost, installation, OS users or Minci enrollment.
+- Existing ACME directory contained only an unfinished September request/key,
+  not an issued certificate. DNS resolves through saikrupagas.com to maa-1.
+- Existing loopback backend answered403 for this unknown hostname.
+
+This distinguishes the missing installation from a crashed installed service.
+Probes distinguished missing SNI/certificate from a failed existing service or
+an external DNS/network failure. Local SNI reproduction plus absent certificate/
+vhost and successful resolution confirmed the first; no service existed to fix.
+
+## Host changes
+
+Used existing acme.sh3.1.7, socat and configured ZeroSSL account; standalone
+HTTP challenge used the previously unoccupied port80. No dependencies installed,
+accounts created, identity settings changed or application/database data written.
+
+- Issued certificate for sign.saikrupagas.com, valid through2027-02-21 UTC.
+- Installed cert/key/fullchain under `/etc/lighttpd/ssl/sign.saikrupagas.com/`.
+- Added `/etc/lighttpd/signet-pending.conf`, exact anchored hostname match,
+  existing TLS/access-log macro and `url.access-deny = ( "" )` for all paths.
+- Appended its include to `/etc/lighttpd/lighttpd-proxy-user.conf`.
+- Registered certificate install paths and a validation + graceful restart hook
+  in the domain's existing ACME configuration; existing daily cron owns renewal.
+  Next renewal timestamp is1802030399. ACME emitted BusyBox date-parsing warnings
+  but recorded the numeric next-renewal time; future automatic renewal is not
+  proven by issuance. Unlike lighttpd HUP (logs only), graceful applies certs.
+- Validated proxy/backend configs; gracefully restarted only lighttpd-proxy.
+  Install-cert also invoked its registered hook before the include was appended.
+
+Private pre-edit config copies: `/root/signet-endpoint-20261124/` on maa-1.
+Do not copy credentials from those files into source or public diagnostics.
+To remove the reservation: restore the backed-up proxy-user configuration only
+if no later edits occurred (otherwise remove just the Signet include), validate,
+and gracefully restart proxy. Retain issued certificate/ACME state unless an
+operator deliberately changes certificate management. Do not blindly restore the
+old ACME config over successful issuance or other later state.
+
+## Verified
+
+- Public curl with normal certificate validation (no `-k`): root, `/api/me`,
+  `/pim-api/attrs`, `/dam/`, `/auth/user` all403; forged Remote-User/Remote-Groups
+  likewise403. TLS verification result0.
+- Existing SSO root200; Ops and Regi roots302, normal TLS validation.
+- Both lighttpd services remain started. Challenge listener80 cleaned up;
+  backend remains bound127.0.0.1:81 and proxy443.
+- Both config tests return0. Existing unrelated expired certificate warning for
+  im.saikrupagas.com was present before changes; not modified here.
+- Read-only reproducible check: `sh out/public-endpoint/check.sh`; its syntax
+  checked with `sh -n`. Local reservation config copy is in the same out/
+  directory (untracked, not ignored). These artifacts are not application
+  deployment machinery.
+
+No screenshots, browser authentication, real documents, API mutations, load
+stress, application build/CI/deployment or end-to-end signing claimed.
+
+## Fresh rollout blockers (not the historical Nov22 inventory)
+
+- maa-1 is x86_64 Alpine/OpenRC. Existing `/usr/local/bin/minci.sh` SHA256
+  `42c21135f3cafaef43a203baf710b98888be5c78967509a28ae1370c62288ab9`;
+  recipe helper SHA256
+  `4ddf2052998fba05c5168de58fc933b6b24a82b6ddbaaa13750f733aa8b2ed00`.
+  Installed helper directory contains recipes/local atomic backend only, not
+  current namespace/remote/publication helpers. Only procmac operator Jobfile
+  found. No Signet runner profile/service/deployment accounts found.
+- Current local Minci docs support named remote delivery and native package
+  roots; this is NOT proof that this older installed release supports them.
+  Do not deploy another agent's checkout or bypass Minci with app-owned SSH.
+- qpdf/pdfinfo and hiredis-dev/libpng-dev absent. Existing make, cc, pkg-config,
+  kfcgi, libpq and redis do not constitute a complete toolchain. Host is Alpine
+  3.24.4; PostgreSQL service is already started and pg_config reports18.7.
+  Prefer an isolated database/roles on the existing compatible server after
+  approval, not an unnecessary second PostgreSQL16 server. No database contents
+  inspected. `apk add --simulate hiredis-dev libpng-dev qpdf poppler-utils`
+  resolves to six additions: hiredis-dev1.3.0-r0, libpng-dev1.6.59-r0,
+  poppler-utils25.12.0-r1, qpdf-libs12.3.2-r0, qpdf12.3.2-r0 and
+  qpdf-doc12.3.2-r0. Simulation selects no Python package or existing-package
+  upgrades; it does not prove all package-hook behavior. No installation run.
+- No `signet`/`signetd` users, data/configuration,
+  DB or per-app service allocations were provisioned. Do not apply README's
+  illustrative commands blindly on the shared host.
+- Existing Authelia authorizer forwards REMOTE_USER metadata, not automatically
+  Signet's required trusted user AND configured group headers. Its documented
+  PHP forwarding pattern is not proof of the kcgi trust boundary.
+- Owner must choose existing LDAP groups for drafter, signer, admin, pim_admin.
+  Keep DAM writes denied until expressly authorized; optional TSA stays disabled.
+- Resource20/native acceptance remains open; do not stress shared maa-1.
+
+## Narrow approvals needed before installation/activation
+
+1. Authorize Signet-specific ordinary CI/deployment/service accounts, isolated
+   database/Redis/files, and native required package provisioning on maa-1,
+   using a reviewed released Minci installation and supported workflow. Exact
+   package transaction/transitives must be checked first; no Python exception
+   is inferred. Do not upgrade shared Minci while another run is active.
+2. Supply existing LDAP group mapping for the four roles; no hardcoded or
+   invented defaults. DAM can remain read-only without a writer decision.
+
+Independent next work may prepare/review source and packaging, but cannot
+truthfully run native application acceptance or activate a beta without these
+boundaries. Keep14/20/24–29 and session deployment tasks open.
diff --git a/.scratch/beta-release/native-20261124.md b/.scratch/beta-release/native-20261124.md
@@ -0,0 +1,145 @@
+# Native beta preparation —2026-11-24
+
+Owner approved installing the requested packages, directed reuse of
+`~/Projects/minci` and instructed looking up group names directly on the server.
+This follows the existing owner-authorized commit → CI → native deployment
+workflow, not an application-owned SSH deploy script.
+
+## Corrected Minci inventory
+
+The published Minci release80f778d110b871cb0ecde348507f5dfa7c1684a8 is already
+installed on cdg-1, including the real deployment API. The older maa-1 copy is
+not evidence that the production CI installation lacks this capability. Read
+`~/.local/var/minci-releases/production-remote-20261123.kGdkFB6g/RESULT.md` and
+verified the actual cdg-1 launcher/prefix. Do not install the unrelated current
+sysroot-development checkout or modify its dirty README/tests.
+
+A separate pinned80f778d runner/receiver prefix is installed on maa-1 under
+`/opt/signet-minci/80f778d110b871cb0ecde348507f5dfa7c1684a8`, from the published
+archive whose SHA256 is
+`87241dc8337e95db00a10cd2c4d6c2025425233f2eff53d8dce7900a172f245b`.
+This permits native Alpine builds without Debian-linked binaries or production
+containers, and does not replace maa-1's old global runner.
+
+Dedicated Minci project20 (`signet`) and producer `signet-ci@saikrupagas.com`
+were enrolled on cdg-1 with a native SQLite transaction and a private pre-change
+backup under `/root/signet-minci-enrollment-20261124/`. Only the dedicated new
+producer's credentials were copied privately to the native runner; no existing
+producer's credential was reused. Runner publication token is project/producer
+bound, expires30days after creation, and stays outside source/run sandboxes.
+Do not print or commit its value.
+
+Native runner account/home: `signet-ci`, `/var/lib/signet-ci` (0700).
+Receiver account/home: `signet-deploy`, `/var/lib/signet-deploy` (0700).
+Named target `signet`, environment `beta`, release root `/srv/signet`.
+SSH is loopback-only through an app-specific key restricted to the receiver
+command; host key pinned from the existing local SSH host public key. No public
+shell/password/forwarding grant. Policies are `/etc/minci-signet-targets` and
+`/var/lib/signet-ci/deploy-targets`; wrapper is
+`/usr/local/libexec/signet-minci-receiver`. The existing native remote receiver
+uses BusyBox atomic rename, not the local vendor backend's Python fallback.
+
+`.config/Jobfile` builds serially, runs service-free native group/command/image
+contracts, packages with the existing Makefile and records `MINCI_REVISION`.
+Actual application health/OpenRC/identity acceptance is separate from activation.
+No namespace bootstrap or second build-system/orchestrator was introduced.
+
+## Native provisioning and package exception
+
+Approved hiredis-dev/libpng-dev/qpdf/poppler-utils are installed and qpdf12.3.2 /
+pdfinfo25.12.0 run. Despite its earlier simulation, APK unexpectedly also tried
+to install python3-ndbm and reported an ownership conflict with the installed
+python3 package. The transaction returned an error even though requested packages
+installed. No Python was invoked intentionally, forced overwrite/unrelated repair,
+package removal or retry was performed. Do not report this as a clean full APK
+transaction or imply that all Python-package effects were reversed. Host package
+state requires separate careful inspection; this is not an application dependency.
+
+New service accounts `signet` and `signetd` share only group `signet`.
+Isolated database `signet` on the existing PostgreSQL18.7 service has separate
+non-superuser login roles, owned by `signet`; the worker has only schema/table
+permissions from the existing tested grant set. Empty schema, no demo users,
+facsimiles or production documents seeded. Peer connection verified for both.
+
+Private configuration: `/etc/signet/signet.conf`,0640 root:signet.
+Data `/var/lib/signet`,2770 signet:signet; inbox1730 signetd:signet;
+originals `/var/lib/signet-signatures`,0700 signetd:signet; readonly DAM
+`/srv/files/signet`,0755 root:root. Redis is reserved at127.0.0.1:16379 with its
+own persistent data/queue; not a shared database/FLUSHDB. Optional TSA remains
+disabled. No system font found, so use the existing supported Helvetica fallback
+rather than adding an unapproved font dependency.
+
+Initial native account setup omitted Alpine's explicit primary-group option for
+the two CI/deploy accounts; corrected immediately using dedicated groups and
+native usermod before private files were installed. No other account changed.
+
+## Server group lookup and source repair
+
+Queried only group names from the existing LDAP database. Existing application
+bind credentials returned49, anonymous group read was denied, and no ldapi
+listener exists. Used native slapcat with a groupOfNames filter and group subtree,
+with private temporary output deleted afterward; only cn values were emitted.
+No LDAP user values/members/passwords were exported or changed. Lookup emitted
+preexisting unknown custom-attribute schema warnings; no schema edit was made.
+
+Actual groups: Proprietor, Manager, Godown Supervisor, Counter Staff, Mechanic,
+Delivery Staff, Janitor. Deployment mapping:
+
+- drafter: Proprietor, Manager, Counter Staff
+- signer: Proprietor, Manager
+- admin/pim_admin: Proprietor only
+- DAM writes denied
+
+Found a security-relevant source issue: group parsing treated whitespace as a
+separator, so shared words could grant an unintended role. Reproduced with a
+failing native C assertion, fixed comma-separated exact matching with trimmed
+item boundaries, and added both portable C and both-API identity regressions.
+No hardcoded production group names were added to product logic.
+
+## Native kcgi ABI repair and trust-boundary test
+
+Native build originally used `/usr/local/include/kcgi.h` but linked the different
+`/usr/lib/libkcgi.so.1.1`; an actual request returned503 allocation failure.
+Preprocessor include tracing and ldd proved the mismatch. Makefile now asks
+pkg-config for BOTH kcgi cflags and libraries, pairing the selected installation.
+Fresh native build links `/usr/local/lib/libkcgi.so.1`; native requests then pass.
+No installed libraries/headers or other application were replaced.
+
+The installed lighttpd supports independent authorizer and responder maps in one
+vhost. No Lua shim, new auth daemon or product authentication implementation is
+needed. A loopback-only synthetic HTTP fixture exercised the actual installed
+Authelia authorizer, lighttpd and both newly built FastCGI APIs with the actual
+empty Signet DB. Manager/Proprietor/Counter Staff/Delivery Staff identities produce
+exact expected roles in both APIs, anonymous requests redirect, and forged group
+headers are denied. Synthetic identity never reached public routing or a real
+SSO session. Fixture listeners18494/18495 were cleaned up and verified absent.
+
+Preflight binaries/sockets are explicitly separate: `/opt/signet-preflight/`,
+`/run/signet-native-{api,pim}.sock`; these are NOT activated production binaries.
+The old kfcgi supervisor required bounded TERM/KILL cleanup in the fixture; this
+was fixed and a clean rerun exited normally. Do not use unbounded waits in new
+operational helpers.
+
+## Verification checkpoint (before activation)
+
+- Portable new group regression: red before fix, green after; shell syntax pass.
+- Native x86_64 Alpine warning-clean build; group and command contracts pass.
+- Actual native authorizer/responder fixture passes all eight role/API cases,
+  anonymous redirect and forged-header denial.
+- Full disposable Alpine image rebuild and E2E after both source fixes ends
+  `all passed`. Latest image `signet-nativebeta-paired-20261124`, ID32e12d670aa1;
+  owned test container on18098. Earlier owned group-only fixture on18097.
+  Preserved user previews were not changed. This is NOT aggregate-resource20 or
+  real browser/LDAP authentication acceptance.
+- Pinned Minci POSIX helper syntax passes. Applying sh -n to the unmodified
+  Bash-based vendor local backend was an invalid check and failed as expected;
+  that backend was not executed. Remote delivery avoids its Python fallback.
+
+## Remaining work
+
+Bind an exact committed source to an actual Minci run, inspect all native
+receipts/publication, configure and test OpenRC/isolated Redis, then integrate
+the real SSO vhost with overwrite/rejection boundaries and readonly DAM.
+Until these steps pass, the public hostname stays deliberately403. Real browser
+login and full signing/release/native recovery/resource gates remain separate;
+never claim that a synthetic-auth fixture establishes real LDAP/browser login.
diff --git a/.scratch/beta-release/rollout.md b/.scratch/beta-release/rollout.md
@@ -17,6 +17,30 @@ fada598, pushed to the supplied origin. The only active source is now
 `/Users/saikrupa/Projects/signet` on main; older linked trees are retired. Use Git
 HEAD for any later documentation-only commits.
 
+## Authorized native preparation —2026-11-24
+
+Owner approved packages/provisioning and direct server group lookup. Existing
+server groups now configure the four roles; shared-word group matching and native
+kcgi ABI pairing are repaired/tested. Published Minci80f778d is already on cdg-1;
+a dedicated pinned native runner/receiver on maa-1 and project20 are prepared.
+This resolves the earlier setup/role approval request without installing the
+unrelated sysroot-development checkout. See [native evidence](native-20261124.md)
+for the unexpected APK Python conflict, paths, eight native synthetic-auth role
+checks and full disposable E2E. Actual committed-source CI/activation and real SSO
+integration are still pending; do not mark29 complete from preparation.
+
+## Fresh endpoint update —2026-11-24
+
+Owner confirmed `https://sign.saikrupagas.com/` and requested fixing it first
+over SSH. TLS is repaired with the existing ACME facility; a temporary exact-match
+deny-all vhost returns403 with valid HTTPS. No Signet application is installed.
+Fresh inspection found an older installed Minci runner/local helper, no current
+namespace/remote helpers, no Signet enrollment/accounts and incomplete native
+dependencies. Role mapping and isolated provisioning still need approval.
+See [endpoint evidence and recovery](endpoint-20261124.md). Domain selection is
+resolved; **application rollout remains incomplete**. Do not mistake the closed
+reservation for SSO or beta acceptance.
+
 ## Minci inventory —2026-11-22; recheck before rollout
 
 This section records the earlier inspection, not current Minci release status.
diff --git a/HANDOFF.md b/HANDOFF.md
@@ -19,7 +19,31 @@ may include later documentation-only commits: Git is the source of truth. One
 registered working tree remains; local task/settings metadata is preserved and
 ignored. This consolidation is not a production deployment or Minci CI acceptance.
 
-**Resume:** the owner ended the session at a clean source-review checkpoint.
+**Native preparation update —2026-11-24:** owner approved package/provisioning
+work and server-side group lookup. Native prerequisites/accounts/empty database
+and the existing LDAP group mapping are prepared. Fixed exact multiword-group
+matching and native kcgi header/library pairing; full disposable E2E and actual
+native synthetic-authorizer checks pass. Published Minci80f778d was found already
+installed on cdg-1; a dedicated pinned native Alpine runner/target and Signet
+project20 are prepared without replacing shared runners. Public site remains
+closed pending actual CI/activation/real SSO integration. See
+`.scratch/beta-release/native-20261124.md`, including the unexpected APK Python
+package conflict and remaining verification limits. Earlier approval/inventory
+blockers below are historical, not requests to ask the same questions again.
+
+**Public endpoint update —2026-11-24:** owner confirmed
+`https://sign.saikrupagas.com/` and requested fixing it first over SSH.
+Fresh maa-1 inspection found no Signet installation/vhost and an incomplete
+certificate request. Issued/installed TLS using existing ACME and reserved an
+exact-match, deny-all proxy vhost: valid HTTPS now returns403 on every route.
+**This is not an application deployment.** Existing SSO/Ops/Regi smoke checks
+pass; no packages/accounts/auth/application data changed. Current installed
+Minci lacks the current namespace/remote helpers; Signet enrollment, native
+provisioning and actual role mapping remain unresolved. See
+`.scratch/beta-release/endpoint-20261124.md` for fresh evidence, recovery and
+narrow approvals. Domain is no longer an open question; keep rollout29 open.
+
+**Previous checkpoint:** the owner ended the session at a clean source-review checkpoint.
 Read CONTEXT.md, this handoff, ADRs and `.scratch/beta-release/README.md`. Continue
 rollout29 only when requested; verify current Minci capabilities/configuration
 before treating the older inventory below as a live blocker. Public Signet domain,
diff --git a/Makefile b/Makefile
@@ -3,14 +3,15 @@
 CC	?= cc
 CFLAGS	?= -O2 -pipe
 CFLAGS	+= -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -Wall -Wextra -Isrc -Ivendor
-CFLAGS	+= $(shell pkg-config --cflags libpq 2>/dev/null)
+# Keep kcgi headers and libraries from the same installation on mixed hosts.
+CFLAGS	+= $(shell pkg-config --cflags libpq kcgi 2>/dev/null)
 PREFIX	?= /usr/local
 WWWDIR	?= /var/www/signet
 PIMWWW	?= /var/www/pim
 
 LIBS_DB	= -lpq -lhiredis
 LIBS_PDF = -lpng -lz -lm
-LIBS_CGI = -lkcgi -lz
+LIBS_CGI = $(shell pkg-config --libs kcgi 2>/dev/null)
 
 COMMON	= build/conf.o build/util.o build/db.o build/yyjson.o build/sha256.o
 PDF	= build/pdfw.o build/ttf.o build/render.o build/snapshot.o
diff --git a/README.md b/README.md
@@ -18,8 +18,10 @@ groups. Normal login must be supplied by the deployment's trusted authentication
 service; the inline sign-in state does not install one. The owner has requested a
 controlled beta while unfinished sections stay tracked, on **maa-1** through
 Minci's commit → CI run → deploy workflow, with all Signet work merged to main.
-The public domain, Signet CI enrollment and remote-delivery setup remain pending;
-no production deployment is claimed. See
+The confirmed URL is `https://sign.saikrupagas.com/`. TLS is provisioned, but
+all routes deliberately return403 until the application is deployed. Signet CI
+enrollment, native provisioning, trusted role mapping and delivery setup remain
+pending; no application deployment is claimed. See
 [the beta rollout queue](.scratch/beta-release/README.md).
 
 ```

@@ -149,7 +151,9 @@ legacy pending documents must not be backfilled from current PIM/DAM data.
 Enable Redis AOF (`appendonly yes`). The deployment's trusted forward-auth proxy must overwrite
 `Remote-User` / `Remote-Groups` on every request. The deployment administrator
 chooses and manages the authentication provider; Signet only consumes forwarded
-identity and maps configured groups to roles.
+identity and maps configured groups to roles. Both forwarded groups and role
+configuration use comma-separated complete names: `Counter Staff, Manager` is
+two groups, not three whitespace-separated words. Matching is case-sensitive.
 
 ## Develop / test
 
diff --git a/src/conf.c b/src/conf.c
@@ -64,7 +64,10 @@ next_item(const char *p, size_t *len)
 {
 	while (*p == ',' || isspace((unsigned char)*p))
 		p++;
-	*len = strcspn(p, ", \t");
+	/* Commas separate groups; spaces may be part of an LDAP group name. */
+	*len = strcspn(p, ",");
+	while (*len > 0 && isspace((unsigned char)p[*len - 1]))
+		(*len)--;
 	return *len ? p : NULL;
 }
 
diff --git a/test/conf-groups.c b/test/conf-groups.c
@@ -0,0 +1,28 @@
+#include <assert.h>
+#include <stdio.h>
+
+#include "conf.h"
+
+int
+main(void)
+{
+	assert(list_has("Office Staff, Manager", "Office Staff"));
+	assert(list_has(" , Office Staff \t, , Manager, ", "Office Staff"));
+	assert(!list_has("Office Staff", "Staff"));
+	assert(!list_has("Office Staff", "Office"));
+	assert(!list_has("Office Staff", "office staff"));
+	assert(!list_has("Office Staff", ""));
+	assert(!list_has(NULL, "Office Staff"));
+	assert(list_intersects("Office Staff", "Manager, Office Staff"));
+	assert(!list_intersects("Delivery Staff", "Office Staff"));
+	assert(!list_intersects("Staff", "Office Staff"));
+	assert(!list_intersects("Office Staff", "Staff"));
+	assert(!list_intersects("Office Staff,Manager", "manager"));
+	assert(list_intersects("Manager, Office Staff", " Office Staff "));
+	assert(!list_intersects(NULL, "Office Staff"));
+	assert(!list_intersects("Office Staff", NULL));
+	assert(!list_intersects(", ,", "Office Staff"));
+	assert(list_intersects("clerks,management", "management,admin"));
+	puts("group names: exact comma-separated matches passed");
+	return 0;
+}
diff --git a/test/conf-groups.sh b/test/conf-groups.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Group names may contain spaces; shared words must never grant a role.
+set -eu
+cd "$(dirname "$0")/.."
+tmp=$(mktemp -d /tmp/signet-conf-groups.XXXXXX)
+trap 'rm -rf "$tmp"' 0
+trap 'exit 1' HUP INT TERM
+"${CC:-cc}" -O2 -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 \
+    -D_DARWIN_C_SOURCE -Wall -Wextra -Isrc test/conf-groups.c src/conf.c \
+    -o "$tmp/conf-groups"
+"$tmp/conf-groups"
diff --git a/test/e2e.sh b/test/e2e.sh
@@ -13,6 +13,9 @@ fi
 if [ "${1-}" = command-contract ]; then
 	exec sh /src/test/command-contract.sh
 fi
+if [ "${1-}" = conf-groups ]; then
+	exec sh /src/test/conf-groups.sh
+fi
 if [ "${1-}" = render-contract ]; then
 	exec sh /src/test/render-contract.sh
 fi

@@ -34,6 +37,7 @@ if [ "${1-}" = logging-contract ]; then
 fi
 sh /src/test/dev-restart-contract.sh
 sh /src/test/command-contract.sh
+sh /src/test/conf-groups.sh
 sh /src/test/image-contract.sh
 sh /src/test/image-memory.sh
 sh /src/test/pdfw-alloc.sh
diff --git a/test/identity-contract.sh b/test/identity-contract.sh
@@ -93,6 +93,29 @@ status 200 -H 'Remote-User: pim' -H 'Remote-Groups: test-pim-13' -H 'X-Requested
 echo 'ok   - roles are config-only; development environment variables cannot grant identity'
 
 awk '
+$1 == "role.drafter" { print "role.drafter = Office Staff, test-drafter-13"; next }
+$1 == "role.pim_admin" { print "role.pim_admin = Office Staff, test-pim-13"; next }
+{ print }
+' "$CF" > "$CF.identity-tmp"
+mv "$CF.identity-tmp" "$CF"
+stop_apis
+start_apis
+for endpoint in api/me pim-api/me; do
+	status 200 -H 'Remote-User: explicit' -H 'Remote-Groups: Office Staff' "$B/$endpoint"
+	jq -e '[.roles[]] | any(. == true)' /tmp/identity-response >/dev/null || fail 'group containing spaces did not match'
+	for groups in 'Delivery Staff' 'Staff' 'Office' 'office staff' 'test-drafter-13-other'; do
+		status 200 -H 'Remote-User: explicit' -H "Remote-Groups: $groups" "$B/$endpoint"
+		jq -e '[.roles[]] | all(. == false)' /tmp/identity-response >/dev/null || fail 'partial group name granted a role'
+	done
+	status 200 -H 'Remote-User: explicit' -H 'Remote-Groups: unrelated, Office Staff , test-signer-13' "$B/$endpoint"
+	case $endpoint in
+	api/me) jq -e '.roles.drafter and .roles.signer and (.roles.admin | not)' /tmp/identity-response >/dev/null ;;
+	pim-api/me) jq -e '.roles.pim_admin' /tmp/identity-response >/dev/null ;;
+	esac || fail 'comma-separated complete group names did not match'
+done
+echo 'ok   - group names containing spaces match exactly; shared words grant no roles'
+
+awk '
 $1 == "auth.user_header" { print "auth.user_header = Signet-Test-User"; next }
 $1 == "auth.groups_header" { print "auth.groups_header = Signet-Test-Groups"; next }
 { print }
diff --git a/todo.txt b/todo.txt
@@ -14,4 +14,4 @@ x 2026-09-19 Docs, invariants and acceptance sweep +docs +test +ops status:compl
 (A) 2026-11-22 Verify native OpenRC lifecycle, persistence, logging, coordinated restore and shared-service budgets +ops +api +worker +test status:needs-info id:26 blockedby:29 @native spec:.scratch/beta-release/native-operations.md
 (B) 2026-11-22 Verify rotated/CropBox PDFs and supported font fidelity; keep browser/server admission consistent +render +client +test status:ready-for-agent id:27 spec:.scratch/beta-release/pdf-fidelity.md
 (C) 2026-11-22 Make register records beyond200 reachable with bounded authorized pagination/search +api +client +test status:needs-triage id:28 spec:.scratch/beta-release/document-list.md
-(A) 2026-11-22 Deploy owner-authorized native BETA after confirming server/domain/SSO and minimum security/recovery boundaries +ops +api +worker +client +docs status:needs-info id:29 @owner-question @maa-1 @minci spec:.scratch/beta-release/rollout.md
+(A) 2026-11-22 Deploy owner-authorized native BETA after confirming server/domain/SSO and minimum security/recovery boundaries +ops +api +worker +client +docs status:ready-for-agent id:29 @maa-1 @minci spec:.scratch/beta-release/rollout.md note:.scratch/beta-release/native-20261124.md