ldrouter 1.11.0 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/) and the project adheres to
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [1.11.1] - 2026-09-02
8
+
9
+ ### Fixed
10
+
11
+ - **Custom API keys without an `ld-` prefix now authenticate**: the API-key creation form accepts any custom key value, but gateway authentication rejected every key not starting with `ld-` (401 "Invalid API key format"), making custom keys unusable. Authentication now accepts any stored secret verbatim — auto-generated keys still use the `ld-<base64url(32 bytes)>` format.
12
+
7
13
  ## [1.11.0] - 2026-09-01
8
14
 
9
15
  ### Added
@@ -37,9 +37,8 @@ export function authenticateGatewayKey(req) {
37
37
  candidate = anthropic;
38
38
  if (!candidate)
39
39
  return null;
40
- if (!candidate.startsWith('ld-')) {
41
- throw new GatewayError('authentication_error', 'Invalid API key format', { status: 401 });
42
- }
40
+ // Custom keys are stored verbatim (no prefix requirement); auto-generated
41
+ // keys start with ld-, but authentication must accept any stored secret.
43
42
  const digest = sha256Hex(candidate);
44
43
  const db = getDb();
45
44
  const row = db.select().from(schema.apiKeys).where(eq(schema.apiKeys.keyDigest, digest)).get();
@@ -188,7 +188,8 @@ export const modelAliases = sqliteTable('model_aliases', {
188
188
  aliasIdx: uniqueIndex('uniq_alias').on(t.alias),
189
189
  }));
190
190
  // ============================================================================
191
- // API keys (gateway keys with ld- prefix)
191
+ // API keys (gateway keys; auto-generated ones start with ld-, but custom
192
+ // values without prefix are now supported)
192
193
  // ============================================================================
193
194
  export const apiKeys = sqliteTable('api_keys', {
194
195
  id: text('id').primaryKey(),
@@ -39,7 +39,7 @@ const DEFAULT_SECRET_KEYS = [
39
39
  ];
40
40
  const SECRET_KEY_REGEX = /(authorization|api[-_]?key|api[-_]?secret|password|passwd|secret|token|cookie|master[-_]?key|totp|recovery|private[-_]?key|session)/i;
41
41
  const PLAINTEXT_PATTERNS = [
42
- /\bld-[A-Za-z0-9_-]{20,}\b/g, // gateway api keys
42
+ /\bld-[A-Za-z0-9_-]{20,}\b/g, // auto-generated gateway api keys (custom keys are covered by the Bearer/x-api-key patterns below)
43
43
  /(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{8,}/gi,
44
44
  /sk-[A-Za-z0-9_-]{12,}/g, // OpenAI-style
45
45
  /anthropic[_-]?[A-Za-z0-9_-]{20,}/gi,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ldrouter",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "LateDev Router — lightweight self-hosted LLM gateway with admin UI",
5
5
  "type": "module",
6
6
  "license": "MIT",