Skip to Content
🎉 BSH Engine v0.0.7 is out with new features and improvements. See what's new →

BSH Engine 0.0.7

All releases
Released Latest

Hardens authentication: the engine now manages its own signing keys with automatic rotation, and adds long-lived sessions with refresh token rotation, plus new APIs and dashboard pages to manage them, and an admin Runtime Health page.

Signing Keys

To strengthen security, the engine uses dynamically generated signing keys instead of a static secret to sign tokens. Access and refresh tokens are signed using separate keys, which are automatically rotated periodically (every 30 days by default) to limit the lifetime of each key.

When a new signing key is generated, the previous key moves to the Retired status. A retired key can no longer sign new tokens but remains available for signature verification until all tokens signed with it have expired, ensuring that existing sessions remain valid after key rotation.

The engine uses asymmetric cryptography, where each signing key consists of a private and a public key. The private key is securely stored and used exclusively by the engine to sign tokens, while the public key is used to verify their signatures and can be safely shared with external services. The public keys used to sign access tokens are published through a JSON Web Key Set (JWKS) endpoint, allowing external services to independently verify BSH access tokens without contacting the engine.

Auth sessions

Every login now opens an auth session that represents the user’s sign-in on a given device. Users stay signed in for up to 30 days as long as they remain active, while inactive sessions close automatically. Logging out ends the session on the engine, so it can no longer be used from anywhere.

Sessions are protected against stolen credentials. When the engine detects signs that a session’s tokens may have been stolen, it blocks the session to protect the account. Each closed session keeps the reason it ended, such as a logout, inactivity or a block, making it easy to understand what happened.

Each session also records the device it was opened from, including the browser, operating system, device type and app name. Admins can review and revoke every session under Security → Auth Sessions in the dashboard, while users can see where they are signed in and sign out their other devices from their profile. Sessions can also be managed through the API and the SDK.

Tokens and Authentication

  • Tokens contain only the information required to identify the user and the session. No user profile information is embedded in them, keeping tokens smaller and reducing the amount of sensitive data stored in them.
  • Access and refresh tokens have distinct purposes and cannot be used in place of each other.
  • Token expiration is evaluated against the currently configured lifetimes, including for tokens that have already been issued. Changing these settings therefore affects existing tokens.
  • Tokens can be delivered through cookies, in the JSON response, or both, depending on the auth.config.delivery setting. See Authentication for details.
  • API keys can now also be provided using the Authorization: Bearer bsh_… header.

Runtime Health

To help administrators monitor the engine’s operational status and resource usage, Runtime Health provides insights into boot time, uptime, memory, CPU, threads, garbage collection, disk usage, and database connection pool statistics. This information is accessible through a dedicated dashboard page.

Triggerable entities

Each entity now chooses whether it fires triggers through the Triggerable option, which is off by default. Entities that don’t rely on triggers skip that work entirely, avoiding unnecessary processing.

Identity and Audit Fields

User email addresses are now case-insensitive, meaning User@Example.com and user@example.com are treated as the same account. Audit fields (CreatedBy and LastUpdatedBy) now store user references using their IDs, while API key references use the apikey:<id> format. This makes it easier to identify whether a change was performed by a user or an API key integration.

Other Changes

  • Error Responses: Errors now provide clear explanations without exposing internal details. Database outages return a 503 response with a descriptive reason, while sensitive database driver details remain hidden from API responses.
  • CORS Handling: Rejected CORS requests now return a 403 JSON error.
  • Configuration Validation: An invalid BSH_CONFIG prevents the engine from starting and provides an explanation of the issue, including the line and column for JSON syntax errors.
  • Date Parsing: Date values now support more flexible parsing, including ISO variants, short offsets, and epoch timestamps in seconds or milliseconds. Values without an explicit offset are interpreted as UTC.
  • Public Version Endpoint: The GET /api/utils/version endpoint is now publicly accessible, allowing clients to retrieve the engine version without authentication.
Last updated on