How to read it
The model assumes four things:
- A remote caller controls every byte of a request: the path, the headers and the body. A caller that is not a browser can forge any header, including
OriginandX-Forwarded-For. - Your own code, your plugins, your log sinks and your dependencies are trusted. They can contain mistakes, and much of this model is about catching those, but skeld does not isolate them from the process or its credentials.
- Node, the operating system and the installed packages are what they claim to be.
- TLS, reverse proxies, traffic limits across many clients, the database server and the storage of logs belong to your deployment.
"What skeld does" names a control that is on with no option set, unless the row says "provided" (you turn it on) or "yours". A row marked "by design, not yet demonstrated" describes code that is in the product and that no test or recorded observation has yet shown working.
Overview
Each cell is one of four answers.
- Covered: skeld has a control, on by default, for the threats found here.
- Partly: skeld has controls, and something you should know about is left open. Known limits lists it.
- Yours: skeld has no control here by design. Your application or deployment supplies it.
- None found: the model found no threat of this kind at this place.
| Where the attack enters | Spoofing | Tampering | Repudiation | Disclosure | Denial of service | Elevation |
|---|---|---|---|---|---|---|
| The network connection | Covered | Yours | Partly | Yours | Partly | None found |
| The request line and headers | Partly | Covered | Partly | Covered | Partly | None found |
| The request body | None found | Partly | None found | Covered | Partly | None found |
| What a handler returns and throws | Partly | Covered | None found | Partly | Partly | None found |
| The service's own declaration at startup | None found | Covered | None found | Partly | Partly | Covered |
| Logs | Covered | Partly | Partly | Partly | Partly | Covered |
| Sign-in, sessions and tokens | Partly | Partly | Covered | Partly | Partly | Partly |
| The database | Partly | Partly | Partly | Partly | Partly | Partly |
| The generated API document | None found | Partly | None found | Partly | Partly | None found |
| The typed client | Yours | Partly | None found | Partly | Covered | None found |
| The release that reaches npm | Partly | Partly | Covered | Covered | Covered | Covered |
"Partly" means at least one known limit applies to that cell, however narrow.
The network connection9 threats
skeld's server speaks HTTP/1.1 through Node's own node:http.
| Threat | Kind | What skeld does |
|---|---|---|
| A client opens a connection and sends its request very slowly, or not at all, to hold sockets open | Denial of service | Three timeouts are set explicitly: 60 s for the headers, 300 s for the whole request, 72 s for an idle kept-alive connection. A stalled request is answered 408 and closed. |
| A client sends an oversized or malformed request head | Denial of service | The head is limited to 16,384 bytes and read by Node's strict parser, which answers a bad one itself. |
| A client asks for a response and never reads it | Denial of service | When a waiting response has made no progress for 60 s, the connection is closed. A slow download that keeps moving is not cut. |
| A client opens connections without limit | Denial of service | At most 10,000 connections are open at once; one more is closed as it arrives. There is no limit per client address. |
| A client declares an upload larger than the route allows | Denial of service | The request is answered 413 before any of the body is read, and the connection is closed after the answer. |
| A deploy stops the service while responses are in flight | Denial of service | Shutdown stops accepting, lets responses in flight finish, and closes what is left after 10 s. |
A client writes its own X-Forwarded-For to appear as another address |
Spoofing | No forwarding header is read unless you list your proxies in trustProxy. Then the header is read from the right, skipping the proxies you listed. |
| A development service is reachable from the network by accident | Disclosure | The server binds 127.0.0.1 unless you give it a host. By design, not yet demonstrated. |
| Someone on the network path reads or changes traffic | Tampering, Disclosure | Yours. skeld serves plain HTTP; put a TLS terminator in front of it. |
The request line and headers7 threats
These checks run before any of your code.
| Threat | Kind | What skeld does |
|---|---|---|
| A request is framed so that a proxy in front and the service disagree about where it ends or which host it is for (request smuggling) | Tampering | A request that repeats Host, Authorization or Content-Type is answered 400 and its connection closed. |
| A path carries malformed percent-encoding to confuse routing | Tampering | Each path parameter is decoded once. Malformed encoding is a 400. |
| The same cookie name is sent twice so that two readers pick different values | Tampering | The Cookie header is parsed once per request. A declared cookie that appears twice fails validation; neither value is chosen. |
| Query, header or cookie values arrive that the route never declared | Tampering | Only the keys a route declares reach its handler, each checked against its schema. |
| Another site makes a signed-in visitor's browser send a state-changing request (cross-site request forgery) | Spoofing | Every POST, PUT, PATCH and DELETE is judged on its Origin and Sec-Fetch-Site headers before any hook runs. The default mode passes a request that carries neither header, for clients that are not browsers; strict mode refuses it. |
| A page on another origin reads a response because cross-origin access was granted too widely | Disclosure | No cross-origin header is sent unless you declare a policy. Origins are matched exactly, and * is never combined with credentials. |
| A client denies having made a request | Repudiation | Partly. A refused request is recorded at warning level. A request that was served leaves no record unless you turn the access record on. |
The request body9 threats
A route reads a body only when it declares one.
| Threat | Kind | What skeld does |
|---|---|---|
| A body larger than the service expects | Denial of service | A route's limit is 1 MiB, or less when its schema can never need that much. A body over the limit is a 413 and is not parsed. |
| JSON nested thousands of levels deep, to stall the parser | Denial of service | Text nested deeper than 64 levels is refused before it is parsed. |
| A body with thousands of invalid fields, to make the error reply expensive | Denial of service | A 400 lists at most 100 problems, and checking stops there. |
Keys such as __proto__ that would alter every object in the process (prototype pollution) |
Tampering | Refused with a 400 at any depth. |
| Fields the route did not declare (mass assignment), or a value of the wrong type | Tampering | A declared object is closed: an undeclared field is a 400 that names it. No value is converted to another type. |
| A form, a multipart upload or XML sent to be read as JSON | Tampering | A body must be application/json or text/plain; any other type is a 415. By design; each refused form is not yet demonstrated. |
| Text that is not well-formed Unicode, which a database would store altered | Tampering | Refused with a 400. |
| A password or token in the body that is later printed by accident | Disclosure | A field declared secret reaches the handler wrapped. Converting it to a string, serialising it or logging it gives [secret]; reading the value takes an explicit call. |
| A validation error that sends personal data back to the client | Disclosure | A validation message is built from the declaration and never contains the value received. |
What a handler returns and throws9 threats
skeld treats your handler's output as input: it is checked before it reaches the client.
| Threat | Kind | What skeld does |
|---|---|---|
| A handler returns a database row with a column nobody meant to send | Disclosure | Only the fields the response schema declares are written. |
| A handler returns a value that breaks its declared response | Tampering | The serializer checks types, bounds and required fields as it writes. A mismatch is answered with the fixed 500, and nothing is converted to fit. |
| An exception carries a stack trace, SQL text or a file path to the client | Disclosure | A thrown value that is not a deliberate HTTP error is answered with one fixed 500 body. |
| A header or cookie set before a failure leaves with the error response | Disclosure | Every header your code set is removed before an error body is written. |
| Code redirects to an address taken from the request (open redirect) | Spoofing | The Location of every 3xx response must be a local path or an origin you listed. Anything else is the fixed 500. |
| A cookie is written with injected attributes, or without its protections | Tampering | Cookies leave through one writer. Its defaults are Secure, HttpOnly, SameSite=Lax and Path=/, and it checks names and values. |
Code sets a framing header such as Content-Length and corrupts the response |
Tampering | Eight framing and connection header names belong to skeld alone; setting one is refused. |
| A browser treats a JSON response as script, shows it in a frame, or a cache stores a private response | Disclosure | Every response carries X-Content-Type-Options: nosniff, Content-Security-Policy: frame-ancestors 'none', X-Frame-Options: DENY and Cache-Control: no-store, unless you replace one. |
| A handler never finishes | Denial of service | A request has 30 s from its first wait. After that the client gets a 503, the request's abort signal fires, and a late reply is discarded. |
The service's own declaration at startup10 threats
skeld treats your contract as untrusted input too: a mistake in it should stop the start, not surface in production.
| Threat | Kind | What skeld does |
|---|---|---|
| A text field, a list or a map is declared with no maximum size | Denial of service | It does not compile without a maximum or a written reason. Startup refuses anything that got past the types. |
A response schema would send a field declared secret |
Disclosure | Startup refuses, unless the field is explicitly marked as exposed with a reason. |
| A contract mistake would otherwise show at the first request: a malformed path, an invalid cookie name, a method outside the five supported, a route with no handler | Tampering | Checked when the contract is defined or at startup. |
| A name or a literal in the declaration breaks out of the generated validation code | Elevation | Declaration text enters generated code only as JSON-encoded strings and finite numbers. |
| Request data triggers compilation or evaluation | Elevation | Code is generated only at startup, from the declaration. If the runtime forbids it, startup fails and names the flag. |
| A misspelt data class leaves a secret field unprotected | Disclosure | Any class other than secret, personal or public throws when it is declared. |
| A text field that holds personal data is declared with no class | Disclosure | Provided: with requireSensitivity, startup refuses any text field with no stated class. Off by default. |
| A route is added with no access rule and serves anyone | Elevation | On a server that uses @skeld/auth, startup refuses a route with no access declaration. |
| A plugin hangs at startup | Denial of service | Each plugin has 10 s. A failed start names the plugin and releases what was already set up. |
A misspelt option in @skeld/auth silently leaves the default in force |
Tampering | Auth's option objects refuse a key they do not know. |
Logs8 threats
A log is read by more people, and kept longer, than the data it describes.
| Threat | Kind | What skeld does |
|---|---|---|
| A secret or personal value is written to a log | Disclosure | The records skeld writes by itself hold fixed codes, the route's template, the status and a request id. A value logged with its schema is written by class: [secret], [personal], and undeclared fields left out. A validated part of the request passed whole to a log call is treated the same way. |
| An exception's message or stack carries request data or internals into the log | Disclosure | By default an error is logged as a type and a code from fixed lists. Message text, other identifiers and stack frames are three options, each off. |
| Text from a client forges a log line or overwrites one of skeld's fields | Tampering | Every string is escaped. One record is one line of at most 8,192 bytes, and your fields sit under a key of their own. |
| A client supplies another request's id to confuse who did what | Spoofing | Each request gets a random id made locally. An id sent by the client is recorded beside it, only when you turn correlation on, and never in its place. |
| A flood of refused requests fills the log | Denial of service | At most 20 records per event and route in 10 s. The rest are counted and summarised in one record. |
| A slow or dead log reader stalls requests or grows memory | Denial of service | Each server queues at most 1 MiB of records, keeps the last quarter for warnings and errors, and writes without blocking requests. |
| Records are lost with nothing to show it | Repudiation | Every lost record is counted by reason. The counts can be read in the process and are written as a record. |
| A hostile value (a getter, a Proxy) runs code or throws inside a log call | Elevation | Only plain data properties are read, and no log call throws, whatever it is given. |
Sign-in, sessions and tokens10 threats
This group applies when you use @skeld/auth. Without it, a skeld service has no authentication at all.
| Threat | Kind | What skeld does |
|---|---|---|
| A session token is guessed, planted before sign-in, or read from a copy of the store | Spoofing | A token is 32 random bytes and the store keeps only its SHA-256. Every sign-in issues a new token and ends the one presented. The cookie is __Host-, Secure, HttpOnly and SameSite=Lax. |
| A revoked or expired session keeps working | Elevation | Every request reads its session from the store; nothing is cached. A session expires after 1 hour idle and 24 hours in all, unless you set other values. |
| Another site drives a request that the session cookie authenticates | Spoofing | A route that reads the session cookie starts only under the strict cross-site check, and an unsafe request must also carry a token derived from the session. |
| A forged bearer JWT: no algorithm, a symmetric algorithm, another issuer or audience, a key the token names itself | Spoofing | The issuer, the audience, the algorithm (RS256 or ES256) and the keys are fixed at startup. A token that names its own key is refused, and an expiry is required. Provided: jwt.tokenTypes also refuses a token of another kind, such as an ID Token. |
| An API key is read from a copy of the store, or used beyond its scope | Disclosure | The store keeps only a SHA-256 of the key and compares in constant time. A key is admitted only on a route whose policy lists API keys, and only for a scope the key holds. |
| Password hashes from a stolen database are cracked | Disclosure | The helpers use Argon2id at 19 MiB and 2 passes, with the parameters stored in the hash so that they can be raised later. |
| An OpenID Connect sign-in is forged, replayed, or completed in another browser | Spoofing | Each attempt is single-use, lives 600 s, is bound to the browser by a cookie, and uses PKCE and a nonce. The ID Token must be signed by the configured issuer's published key, for this client, with that nonce. An external identity is its issuer and subject; an email address is never used to match an account. |
| A handler runs before the access decision, or a failed check is read as "allow" | Elevation | Identity is checked before the body is read and the route's policy after validation. Only an explicit admit runs the handler. A throw, a timeout, a malformed answer or a store that is down never admits; a store that is down is a 503. |
| Someone guesses at sign-in, or floods it | Denial of service | Provided: limits counted in the store, which your sign-in charges before it verifies a password. Password hashing runs two at a time with a bounded queue and refuses when the queue is full. |
| A sign-in, a sign-out or a key change leaves no trace | Repudiation | Auth records failed and successful sign-ins, sign-outs, revoked sessions and API keys issued or removed, at a level the default log settings write. |
The database10 threats
This group covers @skeld/data and the store @skeld/auth keeps its sessions in.
| Threat | Kind | What skeld does |
|---|---|---|
| A request value becomes SQL (injection) | Tampering | Values travel only as query parameters. Query text comes only from the literal parts of the sql tag, and a second statement in one query is refused. |
| Someone on the network path impersonates the PostgreSQL server or removes the encryption | Spoofing | TLS is asked for first, and the connection continues only on a verified certificate and host name, at TLS 1.2 or above whatever the process flags say. Only SCRAM-SHA-256 sign-in is answered. Plaintext needs an option named in code and cannot be set from a URL. |
| A hostile or broken server sends oversized or malformed messages | Denial of service | Every length is checked before anything is buffered. One result is limited to 16 MiB by default. |
| Database error text, SQL or the password appears in a response or a log | Disclosure | There is one error type with fixed messages. What the database sent is held in a private field that printing and serialising do not show. A client sees a 503 or the fixed 500. |
| A stored value or an added column reaches the handler unchecked, or a 64-bit integer is silently rounded | Tampering | A query that names a schema returns rows cut to their declared columns and checked. An integer too large for a JavaScript number is refused or returned as text. |
| A failed commit is reported as done, or a statement runs outside its transaction | Tampering | A transaction is a callback, and its handle stops working when the callback ends. A commit lost in flight is reported as unknown. |
| Slow statements or abandoned requests hold every connection | Denial of service | A pool has 10 connections and 50 waiters by default, and a wait ends after 5 s. A statement follows its request's abort signal, and an abandoned transaction is rolled back. |
| Two requests race on a session, a single-use sign-in attempt or a counter | Tampering | Each operation of auth's store commits whole or changes nothing. Both shipped stores, SQLite and PostgreSQL, pass the conformance kit that is published with the package. |
| Another local user reads the SQLite database file | Disclosure | A new database file is created readable and writable by its owner only. |
A forged X-Forwarded-For evades a rate limit, or the limiter's store fails |
Denial of service | The limiter counts by the address skeld itself established and stores only a digest of it. If its store fails, a limited route answers 503 and its handler does not run. |
The generated API document6 threats
@skeld/openapi turns a contract into an OpenAPI document. It serves nothing by itself.
| Threat | Kind | What skeld does |
|---|---|---|
| Two routes collapse into one operation, or a path cannot be expressed, and the document describes a different API | Tampering | Generation refuses and returns no partial document. |
| The document tells a client that the service accepts a shape it does not | Tampering | Each schema is mapped from a fixed list of fields. Where OpenAPI has no keyword for one of skeld's rules, the document carries an extension and the call returns a diagnostic that says where. |
| A protected route is published as open | Tampering | Generation refuses when the security you state contradicts the route's declared access. |
| Notes written for people reading the code, or a secret field, are published | Disclosure | Only listed schema fields are copied, never a written reason. A secret in a response is refused unless it is marked exposed. No example values are generated. |
| A server URL that carries credentials, such as a connection string, is published | Disclosure | Refused. By design, not yet demonstrated. |
| A very large or cyclic contract hangs the build | Denial of service | One call handles at most 10,000 routes, 100,000 schema nodes and 64 levels of nesting. |
The typed client8 threats
The client is generated from the same contract and treats the server's answer as untrusted.
| Threat | Kind | What skeld does |
|---|---|---|
| Whatever answers at the address returns a shape the contract does not declare | Tampering | Every declared response body is validated. A mismatch rejects the call. |
| The answer is a very large body | Denial of service | Each status has a byte limit taken from its schema, or 1 MiB where the schema gives none. A body past it is cancelled. |
| The peer never answers, or sends a few bytes at a time | Denial of service | A call ends after 30 s by default. |
| The peer answers with a redirect, so that the request and its credentials go somewhere else | Disclosure | A redirect is never followed. The call is rejected. |
| A bearer token is sent to a route that needs none, or a malformed token reaches a header | Disclosure | The token goes only to routes that are not public, and its form and length are checked before anything is sent. |
| A token or personal data in a URL is copied into an error message, and from there into a log | Disclosure | A client error message carries the method, the origin and the route's path template, never the actual path or query. |
A path parameter such as .. changes which resource is requested |
Tampering | Each parameter is percent-encoded, and . and .. are refused. By design, not yet demonstrated. |
| The connection is plain HTTP, or the server is not the one you meant | Spoofing | Yours. The client accepts an http: base URL; use https:. |
The release that reaches npm9 threats
A package you install is only as trustworthy as the path it took to the registry.
| Threat | Kind | What skeld does |
|---|---|---|
| A compromised third-party dependency arrives with the framework | Tampering | @skeld/core has no dependencies. @skeld/auth and @skeld/data depend on core alone, at the exact version released with them, and @skeld/openapi asks only for core beside it. |
| Installing a package runs code on your machine | Elevation | No package declares an install script, and the release check refuses a package that would. |
| Someone other than the release workflow publishes a version | Spoofing | Publishing uses npm's trusted publishing from one workflow, and the repository holds no npm token. The registry's own settings are kept by hand: by design, not yet demonstrated. |
| Code reaches a release without passing the checks, or from another branch or a fork | Tampering | The release runs only from the main branch of the project's repository, and first reads that branch's protection rules. The main branch takes changes only through a pull request that passed the checks. |
| The published file differs from the one that was built and checked | Tampering | Checksums are taken at the build and verified before each publish. The publish step installs nothing and runs no script. |
| A build tool changes between two builds, or a dependency's script runs during the release build | Tampering | Every tool has an exact version, and one lockfile holds an integrity hash for each package. The release build installs only what the four packages need, with install scripts off. |
| Development-only code ships inside a package, such as the repository's diagnostic recorder, which reads every request | Disclosure | A package holds compiled output, the licence and the README. The release check refuses a package that contains the recorder. |
| Injectable or known-vulnerable code is in the packages | Elevation | CodeQL and the project's own static rules run on pull requests that change code and weekly, and a release does not build while a finding is open. The locked dependencies of the build are audited on the same schedule. |
| You cannot tell which source produced a package | Repudiation | Every publish carries npm provenance that names the commit and the workflow. |