Skip to content

feat(audit): search request logs by API key name - #187

Open
stoner-byte wants to merge 1 commit into
astaxie:mainfrom
keepcrazy:codex/request-log-api-key-name-search
Open

feat(audit): search request logs by API key name#187
stoner-byte wants to merge 1 commit into
astaxie:mainfrom
keepcrazy:codex/request-log-api-key-name-search

Conversation

@stoner-byte

Copy link
Copy Markdown

Summary

Allow the existing request history keyword search to match the name of the API Key that made a request. This makes per-key troubleshooting possible without exposing or searching raw API key secrets.

Related Issue

N/A

Changes

  • Match api_keys.name through the existing request_logs.api_key_id relation in request-log keyword searches.
  • Keep the current case-insensitive partial-match behavior and API Key ID search.
  • Update the request-history search placeholder in English, Simplified Chinese, and Japanese.
  • Add coverage for API Key name, name fragment, and raw-secret non-matching behavior.

Type of Change

  • Bug fix
  • New feature
  • Refactor or maintenance
  • Documentation
  • Deployment or configuration

Verification

  • go test ./... (backend)
  • go vet ./... (backend)
  • npx tsc --noEmit (frontend)
  • node --test tools/*.test.mjs
  • node tools/check-doc-translations.mjs
  • node tools/check-ui-translations.mjs
  • node tools/check-env-contract.mjs
  • node tools/check-source-lines.mjs
  • git diff --check

Compatibility, Security, and Operations

The existing q query parameter gains API Key name matching; its request and response shapes are unchanged. No schema migration, configuration, deployment change, or raw API key lookup is introduced.

Checklist

  • Tests were added or updated for behavior changes, or the reason they are unnecessary is documented.
  • No credentials, local .env files, databases, backups, or runtime logs are included.
  • Environment variable changes are synchronized across examples, Compose, start.sh, and deployment documentation where applicable. No environment variables changed.
  • Shared user-facing behavior is documented consistently in English, Simplified Chinese, and Japanese where applicable.
  • data/model-catalog.yaml remains tracked and catalog changes were reviewed where applicable. No catalog changes.
  • git diff --check passes.

setRequestPage(1);
}}
placeholder={tx("搜索请求 ID、模型、Provider、状态码")}
placeholder={tx("搜索请求 ID、API Key、模型、Provider、状态码")}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Please make the searchable API Key fields explicit

“API Key” can reasonably be read as the raw key secret, even though this endpoint intentionally supports only the key name/ID and the test verifies that raw secrets do not match. Because the input is serialized into the URL as q, this wording could encourage an operator to paste a credential into a value that may be retained by HTTP/proxy logs. Could we change this to “API Key 名称或 ID” and make the equivalent English/Japanese translation updates?

@astaxie

astaxie commented Aug 20, 2026

Copy link
Copy Markdown
Owner

@stoner-byte 抓紧修复上面的问题

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.

2 participants