Managing apps¶
An app in Gatekeeper is a protected service identified by a slug.
Examples:
docsgrafanajupyteradmin-panel
The slug is what nginx sends in X-GK-App during the auth subrequest.
Registering apps¶
uv run gk apps add --slug docs --name "Engineering Docs"
uv run gk apps add --slug grafana --name "Grafana"
The slug must contain only lowercase letters, numbers, and hyphens.
Listing and inspecting apps¶
uv run gk apps list
uv run gk apps show --slug docs
Granting access¶
Explicit grants matter most for external users and for any deployment using strict app registration.
uv run gk apps grant --slug docs --email contractor@example.net
uv run gk apps grant --slug docs --email alice@example.com --role editor
uv run gk apps grant --slug wiki --all-approved
Revoking access¶
uv run gk apps revoke --slug docs --email contractor@example.net
Removing apps¶
uv run gk apps remove --slug old-dashboard --force
Internal vs external access¶
Gatekeeper distinguishes between:
internal users: email domain is in
ACCEPTED_DOMAINSexternal users: everyone else
Registered app behavior:
internal users are broadly allowed
external users need explicit grants
admins bypass normal app restrictions
Unregistered app behavior is controlled by DEFAULT_APP_ACCESS:
allow: signed-in users can pass validation for unregistered appsdeny: unregistered apps return403
If you want tight control, set DEFAULT_APP_ACCESS=deny and register every protected app.
Roles¶
Roles are optional string hints attached to an app grant.
uv run gk apps grant --slug docs --email alice@example.com --role editor
Gatekeeper does not enforce role semantics. It forwards the role to your app in the auth response headers if your nginx config exposes it:
auth_request_set $auth_role $upstream_http_x_auth_role;
proxy_set_header X-Auth-Role $auth_role;
Common patterns:
viewer,editor,adminread,writemember,owner
Gatekeeper app admin roles¶
Gatekeeper app administration is separate from the runtime X-Auth-Role header, but it can now be derived from it.
Each app has an admin_roles setting. If a user is granted one of those roles for that app, Gatekeeper treats them as an app admin for that app only. That gives them access to the scoped app-management surface in Gatekeeper, including grants, settings, scoped API keys, and app audit visibility.
Example:
app roles:
viewer,editor,ownerapp admin roles:
owner
In that setup:
viewerandeditorusers can use the app normallyownerusers also become Gatekeeper app admins for that app
Gatekeeper still forwards the assigned role to the app in X-Auth-Role. Your app decides what that role means at runtime.
nginx integration¶
Typical protected-app snippet:
location = /_gk/validate {
internal;
proxy_pass https://auth.example.com/api/v1/auth/validate;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-GK-App docs;
proxy_set_header Host auth.example.com;
proxy_set_header Cookie $http_cookie;
}
The Host header on the auth subrequest must be the Gatekeeper auth host, not the protected app host. That keeps the subrequest aligned with the auth layer and avoids cross-host validation bugs.
What the admin wizard generates¶
When you create an app from the admin UI, the wizard generates a protected-app nginx block that:
proxies
/_gk/validateto your Gatekeeper auth URLsets
Hostto the Gatekeeper auth hostnameforwards
X-GK-Appwith the app slug you registeredcaptures Gatekeeper response headers and forwards them to your upstream app
redirects
401users to Gatekeeper signinredirects
403users to the Gatekeeper access-request pageroutes
/logoutand/signoutback through the auth host so users land on a clean signin flow
How your app should use those headers¶
Treat X-Auth-User as the primary identity key. Most apps should map that header to their local session/user model on each request.
Treat X-Auth-Role as an authorization hint coming from Gatekeeper. Gatekeeper does not enforce role semantics inside your app. You define what viewer, editor, admin, or any custom role means once the request reaches your application.
Recommended pattern:
reject or redirect if
X-Auth-Useris missinglook up the user by
X-Auth-Usermap
X-Auth-Roleto your internal permissionsdefault safely if the role header is empty
If you need app-local super-admin behavior, use a Gatekeeper app role like admin or owner and map that role in your own authorization layer.
For internal apps on public hostnames, add:
add_header X-Robots-Tag "noindex, nofollow, noarchive" always;
If you also control the app HTML, add:
<meta name="robots" content="noindex, nofollow, noarchive">
This is especially relevant for engineering docs, dashboards, notebooks, and internal admin tools.