Skip to content

fix(usage): avoid API key stats collisions#2210

Open
codeasier wants to merge 2 commits into
decolua:masterfrom
codeasier:issue-2206
Open

fix(usage): avoid API key stats collisions#2210
codeasier wants to merge 2 commits into
decolua:masterfrom
codeasier:issue-2206

Conversation

@codeasier

Copy link
Copy Markdown

Summary

  • use a SHA-256 fingerprint as the internal byApiKey aggregation identity instead of the masked API key
  • keep usage stats responses secret-safe with apiKeyMasked while preventing same-prefix key collisions
  • add regression coverage for 24h/today stats with colliding masked API key prefixes

Closes #2206

Tests

  • NODE_PATH=/tmp/node_modules /tmp/node_modules/.bin/vitest run --reporter=verbose --config ./tests/vitest.config.js tests/unit/db-sqlite-vs-lowdb.test.js tests/unit/security-audit.test.js
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: /api/usage/stats today merges API keys with same masked prefix

1 participant