Security and access model

The security and access model of RTEdge.net answers three questions: which site a deployment lives in, who a visitor is, and what that visitor may do. Every deployment is its own site with its own sign-in session. Visitors sign in with GitHub, Google, Microsoft or Apple, and each session is signed and checked at the edge. Owners then use three attributes to decide who may view a deployment and who may open its source.

Overview

Five layers decide what a visitor can do on RTEdge.net. Each one is set in a different place.

LayerDecidesSet by
SiteWhich cookies, storage and sign-in session a deployment has.The host: name.rt.ht or your own domain.
SessionWho the visitor is.Signing in with ::si. The session is signed and checked at the edge.
Owner and editorsWho may deploy a route, and who is always permitted.The first deployer, and the Editors field of the Code dialog.
View gateWho may see the deployment.edge:user
Source gateWho may open the source with ?.io:user, io:guest and the edge workers you deploy.

Each deployment is its own site

rt.ht is on the Public Suffix List, so browsers treat every name.rt.ht as a separate site. A deployment cannot set cookies for .rt.ht, and a.rt.ht and b.rt.ht do not share cookies, storage or sign-in sessions.

Session cookies are host-only. Every name.rt.ht and every custom domain therefore signs a visitor in separately, and signing out of one host leaves the others alone. The path routes of one host, such as name.rt.ht and name.rt.ht/docs/, share one origin, and so they share the sign-in session.

In the playground, the editor and the output of your code also run on separate origins.

Signing in and sessions

A visitor signs in by opening ::si on your host. RTCode.io shows its sign-in page, where the visitor picks GitHub, Google, Microsoft or Apple, and verifies the account with that provider. Multi-factor sign-in and passkeys work through the identity provider, if the account has them enabled. RTEdge.net adds no multi-factor layer of its own.

The result is a signed session for the host. It records the visitor's email, the provider and the time of sign-in. Sessions are signed with ECDSA P-384 and checked at the edge on every request.

PropertyValue
ProvidersGitHub, Google, Microsoft and Apple.
SignatureECDSA P-384.
CheckedAt the edge, on every request to the host.
Lifetime24 hours from sign-in. After that the visitor is treated as signed out and signs in again. There is no silent refresh.
ScopeOne host. The path routes of a host share it.
Sign-out::so, which signs the visitor out of the current host only.

If the visitor is still signed in to RTCode.io, ::si completes without asking for a provider again. GitHub sign-in needs an email address on the GitHub account.

You write no authentication code. A page reads the signed-in email with fetch('::su'), and a worker reads request.rt.user: a string, or null. For ordinary visitors, request.rt.user reflects only a verified session. See Adding sign-in.

Owners, editors and savers

Owner

The account that first deploys a route. Only the owner can delete the route or change its editors. The owner always passes both gates.

Editors

Accounts authorized to view, open the source and redeploy a route. They pass both gates; they cannot delete the route or change its editors. An editor's deploy keeps the owner and the saved editor list. See Editors for entry syntax and managing these permissions.

Saver

The account that saved a version. For a deploy by an editor, the saver is that editor. A version records the saver as its author and the owner as its committer.

Editors also see the route in the * index. See Domains and subdomains for the claim that every route's owner holds on its domain.

Who can view a deployment

edge:user is the view gate. When a deployment has at least one edge:user element that does not also carry edge:guest Experimental, RTEdge.net lets only the owner, the editors and the accounts the attribute lists see it.

The gate guards the root page, the exported o:= files and the requests that fall back to the worker. It does not guard explicit worker calls with /:. A worker that must authenticate checks request.rt.user itself. See edge:user and /:.

Who can open the source

The source is the full authored page, as saved at deploy time. Anyone can open it with ? unless the deployment has one of these:

When the source is private, the owner, the editors and the accounts listed by io:user may open it. Deploying any edge worker without io:guest therefore makes the source private by default. A deployment with no edge:user, no io:user and no edge worker, or with edge workers that all carry io:guest, has a public source. See io:user, io:guest and ?.

How the view and source gates combine

The two gates are independent, and neither attribute overrides the other. RTEdge.net applies these rules:

The deployment hasWho can view itWho can open the source with ?
None of the rows belowAnyoneAnyone
An edge worker without io:guestAnyoneThe owner, the editors and io:user permits
Edge workers that all carry io:guest, and nothing else from this tableAnyoneAnyone
An io:user element without io:guestAnyoneThe owner, the editors and io:user permits
An edge:user element without edge:guestThe owner, the editors and edge:user permitsThe owner, the editors and io:user permits, if there are any

Permits

edge:user and io:user take a space-separated list of permits. The Editors field takes the same three forms.

person@domain.tld

That exact account.

domain.tld

Any account whose email domain is exactly that domain. example.com matches a@example.com, but not a@mail.example.com.

*

Any signed-in user. It never matches an anonymous visitor, who is asked to sign in instead.

Write permits and editor entries in lower case. Attribute values are lower-cased when you deploy. An attribute with an empty value still switches its gate on, so that only the owner and the editors pass.

What a denied visitor sees

RequestVisitorResponse
View, with edge:userAnonymous401 page "You are not authenticated.", with a "Sign in" link (::si).
View, with edge:userSigned in, not permitted403 page "You are not authorized.", with a "Sign in as a different user" link (::sa).
Source, with ?Anonymous303 redirect through sign-in (::sit), then back to ?.
Source, with ?Signed in, not permitted403 page "You are not authorized.", with a "Sign in as a different user" link (::sa).

See Error pages for every platform page.

Redaction is not secrecy

edge:redact and edge:remove change only the HTML that RTEdge.net serves. The source opened with ? still contains the redacted or removed content whenever the source is public, and every deploy also saves the complete source as a version. copy:redact works in the editor only and has no effect on a deploy.

To keep a value private, keep the source private (a non-guest edge worker, io:user or edge:user) and keep the value inside the private edge worker. See Keeping secrets out of deployments, edge:redact and edge:remove.

Order of checks

For a request to a deployed host, the checks that matter for access run in this order. Request routing has the complete order.

  1. Platform suffixes answer first, on every URL of the host and without any access gate: the sign-in suffixes, ::qr, ::clear and /::edge.
  2. ::owner and the ::kv viewer answer next.
  3. Any other path that contains :, except ::meta, goes straight to the route's worker. No access gate applies.
  4. A * index requires sign-in. A URL that ends in ?? redirects to the versions page.
  5. RTEdge.net loads the deployment and its access rules. ?m=uo and the 404 for an undeployed route answer here, before any gate.
  6. The source gate applies, when the deployment has source rules. A permitted source request is answered with the source.
  7. The view gate applies, when the deployment has edge:user.
  8. ::meta answers, then the exported files, then the page or the worker fallback.

Guarantees and limits

Request routing

The order in which a request is answered, including every access check.

Anatomy of a deployment

What a deploy produces, including the access rules compiled from your attributes.

Playground and edge differences

What the playground emulates of sign-in and access, and what only RTEdge.net does.

Architecture

How the editor, the output, the deploy pipeline and the edge fit together.

See also