Osy#betaRun it on Osyrin: osyrin.com

Reference / Security

[SealRecipient] — a row a value may be sealed for

[SealRecipient(Label = Member)] string? Key; // on an entity member holding a P-256 public key

Marks the member of an entity that holds a recipient's P-256 public key (base64 SPKI or PEM) — a build host's sealing key — so a value can be sealed (fcs1) for a ROW of that entity on the server: a stored keyed value with `Secret.X.SealFor(id, to: host, …)`, or a value an answer issues with `Http.PostSealedFor(…, to: host, …)`. The platform reads the key and the label from the row as stored, never from anything the code built or changed, so a key written as text, computed, or taken from a request can never be a recipient.

preview1 example compiled by CIsecuritycryptoentityattribute

Summary#

[SealRecipient(Label = Name)] on a string member says: this member holds a public key that a value may be sealed for, and Name is what the sealed text is bound to as its host. It is the only way to name a recipient of a server seal — the to: of Secret.X.SealFor and Http.PostSealedFor is a row of such an entity, never a key.

what it is
the membera string (or string?) holding the recipient's P-256 public key, as base64 SPKI or PEM
Label = Membera string member of the same entity; its text is the fcs1 host the sealed text opens as
one per entitya row is one recipient

Signature#

[SealRecipient(Label = Name)] string? SealingKey;

Description#

Declaring a recipient#

entity BuildHost {
  [MaxLength(200)] string Name;
  /// The host's P-256 public key, as the host reported it.
  [SealRecipient(Label = Name)] string? SealingKey;
  security { allow read when IsAuthenticated; }
}

Sealing for it#

A stored keyed value is sealed with Secret.X.SealFor — the id's value leaves the platform only as fcs1 text for the row's stored key, the fcs1 name is the id, and the secret's MayUse(id) is asked as the caller — see declaring secrets (app.Secrets):

string sealedKey = Secret.ModelKeys.SealFor(key.Id.ToString(), to: host, kind: "anthropic", why: "approved on the host page");

A value an answer issues is sealed with Http.PostSealedFor: it posts, and the field of the answer it names leaves the platform only as fcs1 text sealed for the row's stored key — see Http.* (#post-sealed-for):

var r = Http.PostSealedFor("https://api.github.com/app/installations/" + installation + "/access_tokens", "",
  "application/json", headers, field: "token", to: host, kind: "github", name: "GH_TOKEN", why: "a build on " + host.Name);

What the platform holds you to#

  • The row as stored. The key and the label are read from the database through a fresh read as the caller — an edit the code made to the row in memory is not what is sealed for, and a row the caller cannot read is refused.
  • No key, no seal. A row whose key member is empty, or whose key is not a P-256 public key, is refused before anything is sealed — and, for Http.PostSealedFor, before anything is sent, so a provider never issues a value nobody can receive.
  • Labels. The label, kind: and name: may not be empty or contain | (it separates the parts the sealed text is bound to).
  • Recorded. Every seal for a recipient — and every refused one — is recorded with the row, its label, the SHA-256 fingerprint of its key, the kind, who ran it, why and how it ended, and committed before the sealed text is handed back. The record never holds the value or the sealed text. A keyed secret's seals are read with Secret.X.UsesFor(id).
  • Shape. Not on a class (no rows), one per entity, on a string, and Label names another string member — each a compile error naming the fix.

See also#

Related

Http.*

Make an outbound HTTP call to a URL you build at runtime — a webhook, a third-party API, a discovered endpoint…

Crypto.SealToHost — seal a page input to a host's public key

Seals what a person types into an UNBOUND password input to a host's P-256 public key, in the browser, and answers the…

declaring secrets (app.Secrets)

`app.Secrets` declares the named secrets your app uses — API keys, tokens, client secrets. Each is `new…

The security model

How authorization works in Osy#, end to end. Everything is denied until you grant it; a grant is compiled into every…