Data and security¶
This page is for your site's IT. It says what passes between your site and
youSleep, which keys there are and who holds each, what the runner must
reach, and what doctor checks.
Your organisation works with youSleep at its site in one of two ways:
- Site compute. Your runner runs your organisation's analyses. The recordings are in youSleep's storage (Set up a site).
- Site compute and storage. A project also keeps its recordings in your organisation's own bucket (Keep recordings in your own bucket). Only your runner reads the bucket, so storage at your site needs compute at your site: youSleep does not offer storage alone.
A project's place is fixed when it is created, so an organisation with a bucket can have projects of both kinds.
By design¶
- The runner only connects out, over HTTPS. It opens no port, and nothing connects to it.
- Requests and answers are signed. The runner signs its requests with its own key, which stays on the host. It acts only on answers youSleep signed, checked against the root key pinned at install.
- Your configuration sets the limits. It names the storage the runner may reach, the kinds and sizes of job it takes, the largest output, and whether a run's log lines leave your site. Root owns it, and the runner reads every limit from it alone and never writes it, so nothing youSleep sends can widen them. The limits bound what youSleep may ask of the runner; they are not a wall around the runner's own user, which runs its own Podman. Keep that account for the runner alone.
- The runner checks each job before it acts. It runs an analysis's image only when the job names it by its digest. It refuses a job whose recording carries no header rule, so no container reads a header uncleaned. It checks an ingest's report against its schema and size before sending it. It follows no redirect from storage.
- Jobs run with no network. Each analysis or ingest runs in a container
as an unprivileged user, on a read-only file system, with hard limits on
memory, CPU and processes. The runner moves every file in and out. Your
runner tells youSleep whether its configuration gives job containers a
network (
sandbox.network), and youSleep gives it no work while it does. That catches a mistake in the configuration. The report comes from your runner, so it is youSleep's rule, not something youSleep could enforce on a runner changed to report otherwise. - A job's files move only by signed URL, and only to the storage your configuration names. The runner refuses a job that names any other storage before anything moves, and follows no redirect.
- youSleep's servers never connect to your bucket. youSleep holds the bucket's key and signs each request; a browser or your runner sends it.
What reaches youSleep¶
| Site compute | Site compute and storage | |
|---|---|---|
| The signals | Stored in youSleep's storage. For each analysis your runner fetches a copy, and deletes it when the run ends | Never. They stay in your bucket, and browsers and your runner fetch them from there |
| The header | Stored with the recording, cleaned | Only the cleaned header, sent when a recording is uploaded or registered |
| Names | The recording's name, or the code that replaces it | The same. For a file registered where it is, also its key in the bucket. When someone looks for new files in a folder, the keys, sizes and ETags of its EDF files |
| The file's size, ETag and SHA-256 | All three: youSleep's storage holds the file | As your runner read them from the bucket |
| Annotations | Their times and labels, and the free text of one that matches no label | Their times and labels. Free text stays at your site |
| Results | In youSleep's storage | The same |
| A run's log lines | Only if your configuration sends them (policy.share_log_tails, off by default) |
The same |
| Activity | Who viewed or downloaded each recording and result | Also who listed the bucket, and which files' headers were read |
The project's rule cleans a header: it blanks the patient and recording identification, and the start date where the project removes dates. The channels' names, units and rates stay.
Site compute¶
sequenceDiagram
box Your site
participant R as Your runner
end
box youSleep
participant A as youSleep's API
participant S as youSleep's storage
end
R->>A: Ask for work, signed with the runner's key
A-->>R: A lease, signed by youSleep: the image and signed URLs
R->>S: GET the recording
Note over R: Cleans its copy's header, then runs the analysis with no network
R->>S: PUT the result
R->>A: How it ended: exit code, SHA-256s, image digest
Note over R: Deletes its copy
- People upload recordings to youSleep's storage, as on the platform. youSleep's own runners read each new recording once, to check it and take its annotations.
- Your runner runs the analyses. It deletes its copy of the recording when the run ends, however it ended.
Site compute and storage¶
sequenceDiagram
box Your network
participant B as A browser
participant R as Your runner
participant K as Your bucket
end
box youSleep
participant A as youSleep's API
participant S as youSleep's storage
end
B->>A: Upload: the cleaned header, the name, the size
A-->>B: A PUT, signed with the bucket's key
B->>K: PUT the recording
R->>A: Ask for work
A-->>R: An ingest or an analysis, with signed URLs
R->>K: GET the recording
Note over R: Cleans its copy's header, then reads or analyses it with no network
R->>S: PUT the annotations without free text, or the result
R->>A: How it ended: SHA-256, size, ETag, exit code
B->>K: GET parts of the recording, to view it
Note over K,A: youSleep's servers never connect to the bucket
- Uploads. A browser on your network, or the SDK, cleans the header, sends it to youSleep, and puts the file in your bucket with a URL youSleep signed. To register a file already in the bucket, it first reads the file's header from the bucket.
- Ingest. Your runner reads each new recording once. A container of the runner's own image reads the cleaned copy, with no network, and writes the header's SHA-256 and the annotations, without their free text. youSleep checks them against what was registered, stores the annotations, and erases the document. The recording's analyses run only once its ingest has checked it.
- Analyses run as in site compute, from the bucket. Their results go to youSleep's storage.
- Deletes. When a recording uploaded to the bucket is deleted, your
runner deletes the file from the bucket. It sends a delete only for a file
under
youSleep/and refuses any other. A file registered where it was is only unregistered: youSleep never writes or deletes it. - Viewing. The browser reads the recording from the bucket, a part at a time.
What your runner sends¶
| When | What |
|---|---|
| It enrols | Its public key, its name (the host's name unless --name sets another), its version, and the cores and memory it offers |
| It asks for work | Its free and total cores and memory, the largest job it takes, its disk free for jobs, the kinds of job it takes, and its storage addresses |
| A job runs | Which jobs it holds, and whether each has started |
| A job ends | How it ended and its exit code; the SHA-256 and size of each file it read and uploaded, each input's ETag, and each input's SHA-256 as the container was handed it (the recording's after its header was cleaned); the image's digest; its own version; the peak memory and the run's length. For an ingest, whether cleaning changed the header |
| It gives a job back | A short reason, such as a storage status code or a failed pull |
doctor checks the bucket |
Which steps passed, and why the first that failed did. Never a URL |
What stays on the host: the runner's private key, a registry login, each job's files until the job ends, a run's log lines unless your configuration sends them, and the runner's own log. A support bundle leaves only when someone sends it, scrubbed of secrets (Send a support bundle).
Keys¶
| Key | Where it is | What youSleep holds |
|---|---|---|
| The runner's key | Made on the host when the runner enrols, in its home, readable by the runner's user alone | Its public half and its fingerprint. Never the private key |
| The enrolment token | Shown once on Add a runner. It enrols one runner, once, within a short time. The runner does not store it | A hash of it |
| youSleep's root key | Offline, with youSleep | Your runner pins its public half at install. youSleep's servers do not hold the private key |
| youSleep's signing key | youSleep's servers | It signs every answer to the runner, and the root key certifies it. The runner refuses a certificate with a lower serial than the newest it has seen |
| Your bucket's key | Your storage issues it, and you give it to youSleep | Its ID, and its secret, encrypted with AES-256-GCM under a key that youSleep keeps. youSleep opens the secret only to use it, and never shows it again |
| A registry login | On the host, readable by root and the runner's group | Nothing |
| Signed URLs | Given to a browser or to the runner, each for one request on one object | youSleep signs them. Each expires: a browser's soon after it is signed, a job's at the job's deadline. The runner's log leaves out their signatures |
youSleep holds your bucket's key, so a request it signs works wherever the bucket answers. Three things bound that:
- The bucket answers only on your network. When you register it, and when you ask again, youSleep's servers try to reach it, and should fail. They try public addresses only, open one TCP connection, and send nothing.
- The key may do only what youSleep needs: list the bucket and read its
files, and write and delete under
youSleep/(Its key). Cloudflare R2 cannot confine a key to a prefix, only to a bucket. - You can revoke the key in your storage at any time. From then on nothing youSleep signs for the bucket works: uploads, viewing and the runner's reads stop until you give youSleep a new key.
A runner revoked on the Compute page is refused from its next request, and stops. The signed URLs it holds expire with its jobs' deadlines.
The network allow-list¶
The runner connects out over HTTPS. Allow these destinations:
| Destination | Port | For | Needed |
|---|---|---|---|
api.yousleep.ai |
443 | Enrolment, jobs, results, and doctor |
Always |
| youSleep's storage address | 443 | Recordings in youSleep's storage, the results an analysis builds on, and every result and ingest document the runner uploads | Always |
| Your bucket's endpoint | Its port: 443 unless the endpoint names another | Reading recordings, deleting uploads, and doctor's check |
With your bucket |
ghcr.io and pkg-containers.githubusercontent.com |
443 | The runner's image and the analyses' images | Always |
| A registry your site operates | Its port | The analyses' images, when they come from there | If you use one |
- Add a runner shows the storage addresses, your bucket's among them, and
the install command names each one (
--storage-origin). The runner reaches no other storage. - Through a proxy: the runner can reach all of them through your site's
HTTPS proxy (
--https-proxyat install), and reach some, such as your bucket on the site's network, directly (--proxy-bypass). A proxy that inspects TLS needs its certificate given to the runner (--ca-bundle), as does a bucket your own certificate authority signed. Such a proxy can read what passes through it, the signed URLs and the recordings' bytes among it, but it cannot change what the runner accepts from youSleep: every answer is signed with a key the runner checks against the root key it pinned at install. - The host resolves these names, and keeps its clock in time, as by NTP: youSleep refuses a request whose time is more than 60 seconds off.
- People's browsers reach youSleep, and with your bucket, the bucket itself, whose CORS rule allows youSleep's address (Its CORS rule).
What doctor checks¶
Run doctor as Check the runner shows. The
install script runs it too: the host checks before it changes anything, and
every check once the runner has enrolled. Each line of its output starts
ok or FAIL, and says what it found. It exits 0 when every check passes.
| Check | Passes when |
|---|---|
state directory, work directory |
The runner can write to each |
root key |
The pinned root key loads |
container network |
Jobs run with no network |
connection |
Always: it says how the runner connects out, directly or through the proxy (named without its password), and which certificates it trusts |
podman |
The runner's Podman answers, at version 5.7 or later |
cgroup v2 |
The host uses cgroup v2 |
rootless |
Podman runs rootless |
controllers |
The cpu, memory and pids controllers are delegated to the runner's user |
platform |
youSleep's API answers its health check, through the proxy if there is one. A certificate that does not verify is named with the likely cause: a proxy that inspects TLS, or a certificate authority to give with --ca-bundle |
clock |
The host's clock is within 30 seconds of youSleep's |
image, one line per image |
Once the runner has enrolled: each image of an analysis the runner may be asked to run, and its configuration would run, pulls. One it would never run is listed, not pulled |
bucket |
Once the runner is approved, at a site with a bucket: the bucket check passes from this host |
doctor --no-pull checks the host alone, and neither pulls nor checks the
bucket.
The bucket check runs the browser check's steps from the runner's host, on
a test file under youSleep/checks/, with requests youSleep signs for this
runner:
- Write the test file.
- Read part of it back.
- Find it by listing the bucket.
- Write it again, which the bucket should refuse.
-
Delete it.
-
A bucket address your configuration does not name fails the check, and no request is sent.
- A bucket that lets the test file be overwritten passes, with a warning.
- youSleep records the result, and the Storage page shows it beside the browser's. The check neither makes the bucket ready nor lets its key sign.