skeld Get started

Security

Measured against OWASP ASVS.

OWASP's verification standard lists what a secure application must do. skeld does part of it with nothing switched on, gives you a switch for more, and leaves the rest to you.

105
By default
32
Provided
81
Yours
127
Not applicable
345 requirements of OWASP ASVS 5.0.0, one answer each.

The four answers

Answer Means
By default skeld does it with no option set. For @skeld/auth and @skeld/data this means: once you use that package, no further option is needed.
Provided skeld gives you the means, and you must turn it on or call it.
Yours skeld cannot do it for you: your authorization rules, your deployment, your keys.
Not applicable The requirement is about something skeld does not do.

A requirement that skeld meets only in part takes the weaker answer. A protection you can switch off only by writing a named option, such as securityHeaders: false, still counts as "by default".

Counts by area

ASVS chapter By default Provided Yours Not applicable Total
V1 Encoding and Sanitization 11 1 1 17 30
V2 Validation and Business Logic 2 3 8 0 13
V3 Web Frontend Security 10 2 5 14 31
V4 API and Web Service 5 0 2 9 16
V5 File Handling 0 0 0 13 13
V6 Authentication 6 4 14 23 47
V7 Session Management 8 4 6 1 19
V8 Authorization 1 3 8 1 13
V9 Self-contained Tokens 5 1 0 1 7
V10 OAuth and OIDC 10 3 1 22 36
V11 Cryptography 9 2 7 6 24
V12 Secure Communication 2 0 9 1 12
V13 Configuration 4 3 10 4 21
V14 Data Protection 7 3 2 1 13
V15 Secure Coding and Architecture 13 1 5 2 21
V16 Security Logging and Error Handling 12 2 3 0 17
V17 WebRTC 0 0 0 12 12
Total 105 32 81 127 345

"Not applicable" covers what skeld has no part in: file handling, WebRTC, acting as an OAuth authorization server, second factors, and rendering pages in a browser.

19 of the 105 "by default" answers rest on a control that has no kept test or recorded observation yet.

Input: encoding, validation and the API surface

ASVS chapters V1, V2 and V4.

By default

  • Every input reaches a handler only through the schema its route declares.
  • A text field, a list or a map must state a maximum.
  • Path values are decoded once, before validation.
  • Text that is not well-formed Unicode is refused.
  • Responses are written by a generated serializer as JSON with a charset.
  • Code is generated only at startup, from your declaration.
  • A request that repeats Host, Authorization or Content-Type is refused.
  • No forwarding header is read unless you list the proxy.
  • Outbound requests go only to addresses fixed at startup.

Provided

  • The sql tag of @skeld/data, which sends every value as a parameter.
  • Transactions as a callback.
  • Rate limits: limitRoutes in @skeld/data, and auth.limits.charge, a policy's limit and addressLimit in @skeld/auth. No route of yours is limited until a rule names it.

Yours

  • Rules that span several fields.
  • Business limits and the order of your own steps.
  • Locking a scarce resource.
  • Message signatures, such as a webhook's.
  • Anything you build from a validated string: a shell command, HTML, or SQL passed to the two calls that take query text.
  • A JSON body that repeats a key is accepted with its last value; if a component in front of the service inspects bodies, check that it reads them the same way.
Browsers: cookies, headers and cross-site requests

ASVS chapter V3.

By default

  • X-Content-Type-Options: nosniff, Content-Security-Policy: frame-ancestors 'none', X-Frame-Options: DENY and Cache-Control: no-store on every response.
  • Cookies written Secure, HttpOnly and SameSite=Lax.
  • No cross-origin access unless you declare a policy.
  • A cross-site check on every POST, PUT, PATCH and DELETE.
  • A 3xx redirect only to a local path or an origin you listed.

Provided

  • Cookie names with the __Host- or __Secure- prefix, whose rules skeld then enforces.
  • Strict mode for the cross-site check, which needs publicOrigin.
  • redirectOrigins and trustedOrigins.

Yours

  • Strict-Transport-Security, which belongs with whatever terminates TLS.
  • A fuller Content Security Policy and a cross-origin resource policy, if a browser application needs them.
  • Keeping GET routes free of state changes.
  • Your host names: a sibling subdomain can plant a cookie with your cookie's name.
Authentication

ASVS chapter V6, with @skeld/auth. A service on @skeld/core alone has no authentication.

By default

  • A route admits only the kinds of credential its policy lists, and two credentials on one request are refused.
  • The password helpers hash with Argon2id, accept up to 1,024 bytes, and do not trim, truncate or impose composition rules.
  • A token signed with no algorithm or a symmetric one is refused.
  • An external identity is its issuer and subject together.

Provided

  • hashPassword, verifyPassword and needsRehash.
  • auth.limits.charge to limit sign-in attempts, charged before the password is verified.
  • resolveUser and the JWT map, which receive every claim so that you can require a sign-in method or strength.

Yours

  • Accounts: sign-up, password change, reset and recovery are not part of @skeld/auth.
  • Password rules: a minimum length, and screening against breached and context-specific passwords.
  • Second factors.
  • Messages to users about sign-ins and changes.
  • Answering every sign-in failure alike, so that a client cannot tell which accounts exist.
Sessions

ASVS chapter V7.

By default

  • A session is a reference token of 32 random bytes, read from the store on every request.
  • A new token is issued at every sign-in and the old one ended.
  • Idle expiry after 1 hour and absolute expiry after 24 hours.
  • A revoked or expired session is refused at its next request.

Provided

  • idleSeconds and absoluteSeconds.
  • auth.subjects.revokeSessions(userId) and auth.subjects.disable(userId), which end every session of one user.

Yours

  • Calling those when an account is disabled, deleted or changes its credential.
  • Asking for the password again before a sensitive operation.
  • A limit on sessions per user.
  • Showing a user their sessions and ending one of them: @skeld/auth cannot list them yet.
Authorization

ASVS chapter V8.

By default

  • The gate runs in the server on every matched route, before any of your hooks.

Provided

  • A policy and an action in each route's access. With the gate installed, a route that declares none stops the start.
  • A policy's load, which receives only validated inputs.
  • A tenant rule, tested before any action, that answers a non-member 404.

Yours

  • The rules themselves: who may do what to which record, field by field where that matters.
  • A valid id says the id is well formed; it does not say the caller owns the record.
  • Writes that bypass a policy's operation are not checked.
  • A permission removed while a request is running still applies to that request.
Tokens and OpenID Connect

ASVS chapters V9 and V10. skeld is a client of an identity provider and never a provider itself, so the requirements about authorization servers do not apply.

By default

  • A JWT is accepted only from the one issuer, for the one audience, under the algorithm and keys fixed at startup, with an expiry.
  • A token that names its own key is refused.
  • An OpenID Connect sign-in uses a random single-use state, PKCE and a nonce, bound to the browser by a cookie.
  • The ID Token's issuer, audience and nonce are checked.
  • A provider's tokens are never stored or logged.

Provided

  • jwt.tokenTypes, off by default, which admits only tokens whose header states a listed type. Set it when your issuer also signs ID Tokens or other tokens for the same audience.
  • The JWT map, which decides what a token's scopes and claims allow.

Yours

  • Revoking a JWT: it stays valid until it expires, so keep lifetimes short or deny in map.
  • Sender-constrained tokens are not offered.
Cryptography and transport

ASVS chapters V11 and V12.

By default

  • Every primitive is Node's own node:crypto.
  • Digests are SHA-256, random values come from the platform's generator, and secrets are compared in constant time.
  • Signatures are verified with RS256 or ES256 only.
  • Outbound TLS always verifies the certificate and the host name.
  • Connections to PostgreSQL refuse anything below TLS 1.2 and answer only SCRAM-SHA-256.

Provided

  • Password hashing cost that can be raised (needsRehash).
  • The JWT algorithms option.

Yours

  • TLS for inbound traffic: skeld serves plain HTTP, and the certificate, the protocol versions and the cipher suites belong to the terminator in front.
  • The scheme of a typed client's base URL: http: is accepted, so write https:.
  • Key management, rotation and inventory.
  • An issuer's RSA key is admitted from 2,048 bits, where the standard says RSA needs 3,072 to reach its floor; if that matters to you, use an issuer with ES256 keys.
Configuration and deployment

ASVS chapter V13.

By default

  • Every outbound destination is fixed at startup.
  • Pool sizes, deadlines and the absence of retries are enforced as documented, including the typed client's 30 s limit on a call.
  • The published packages have no debug mode.
  • A method no route declares, TRACE included, finds no route.

Provided

  • Documented limits for each connection: maxConnections, maxWaiters and acquireTimeoutMs in @skeld/data, maxClients in @skeld/auth.

Yours

  • Where secrets are kept, who can read them and when they rotate.
  • The privileges of the database role.
  • Network egress rules.
  • What your deployment exposes beside the service.
Sensitive data

ASVS chapter V14.

By default

  • Only declared response fields leave.
  • A secret field in a response stops the start unless you mark it exposed.
  • Cache-Control: no-store on every response.
  • Credentials travel in a cookie or a header.
  • Sign-out clears the session cookie after the store confirms the revocation.

Provided

  • Three data classes on a schema field: secret, personal and public.
  • request.classified and classified for logging by class.
  • requireSensitivity, off by default, which stops the start when a text field states no class.

Yours

  • Deciding which fields are sensitive: skeld cannot infer it, and a field with no class is treated as ordinary.
  • Encryption at rest and retention.
  • What you send to third parties.
  • Removing a user's data: @skeld/auth deletes its expired records, and keeps one small record per user id for as long as the store exists.
Architecture and coding

ASVS chapter V15.

By default

  • Body size, JSON depth, validation work, the handler deadline, an unread response, the connection count, password hashing and outbound calls are all bounded.
  • Undeclared fields are refused and nothing is converted between types.
  • Keys that would alter built-in objects are refused.
  • The packages contain no third-party code and nothing but compiled output.
  • Each store operation checks and writes in one step.

Provided

  • trustProxy, without which no forwarded address is believed.

Yours

  • Isolating the process.
  • A limit per client address and across many clients, at your proxy or with the limiters above.
  • A security policy for your own service.
  • Work that is slow by nature: put it behind a limit, and bound your own calls to other systems.
Logging and errors

ASVS chapter V16.

By default

  • Each record is one line of JSON with a UTC time, a severity, an event name and the request id.
  • Refusals for framing, size, forbidden keys, cross-site requests and rate limits are recorded.
  • With @skeld/auth, failed and successful sign-ins, sign-outs, revocations and API key changes are recorded.
  • Text from a client cannot break or forge a record.
  • An unexpected failure is the fixed 500 and is recorded, and a failed store or limiter refuses the request.

Provided

  • Logging by data class (request.classified, classified, sensitivity).
  • The access record for served requests, log: { access: true }.
  • The documented list of every event and field.

Yours

  • Storing the records, controlling who reads them, and keeping them as long as you must.
  • A business audit trail: who did what to which record. skeld records a served request only if you turn the access record on, and by default no record names the caller.
  • Handling errors outside a request: skeld installs no process-wide handler.

Before you expose sensitive data

Four decisions are yours whatever the framework does.

Decision What to settle
Identity and access How callers authenticate, and the rule for each record and tenant.
Transport and network TLS on every hop that is not trusted, which proxies you trust, and where the service may call out to.
Capacity Limits per client and in total, timeouts on your own calls, and a load test of the real deployment.
Data Which fields are secret or personal, who may see each one in a response, and how long logs are kept and who reads them.