Skip to content

feat(web): warn when API key alias is saved for a key not in CPA api-keys#298

Open
fengshao1227 wants to merge 1 commit into
seakee:mainfrom
fengshao1227:feat/warn-alias-key-not-in-cpa
Open

feat(web): warn when API key alias is saved for a key not in CPA api-keys#298
fengshao1227 wants to merge 1 commit into
seakee:mainfrom
fengshao1227:feat/warn-alias-key-not-in-cpa

Conversation

@fengshao1227

@fengshao1227 fengshao1227 commented Jul 7, 2026

Copy link
Copy Markdown

Summary

When saving an API key alias, cross-check the key against the currently saved CPA config's api-keys list using SHA-256 hash comparison. Show a warning if the key is not in the active config yet.

Scope

  • Frontend panel
  • Manager Server
  • CPA panel mode
  • Full Docker mode
  • Native packages / release
  • Docs / Wiki
  • CI / build / tooling

Changes

  • Import useConfigStore in ApiKeysCardEditor to access the saved CPA config's apiKeys
  • After successful alias save, hash all saved api-keys and compare against the aliased key's hash
  • If the key is NOT in the saved config: show a warning notification explaining the key needs to be added and config saved
  • If the key IS in the saved config: show the existing success notification
  • Add alias_saved_key_not_in_cpa i18n key for all 4 locales

User Impact

Users who save an alias for a newly added key (before saving the CPA config) now get a clear warning instead of a misleading success message, preventing confusion about why the key doesn't work for requests.

Compatibility / Runtime Notes

  • CPA panel mode: Warning relies on config.apiKeys from the config store; in CPA panel mode the config is fetched from the CPA instance
  • Manager Server mode: Same behavior — the config store reflects the last fetched CPA config
  • Full Docker / native packages: Same behavior

Data / Security Notes

N/A — no new data stored; uses existing config store state

Risk / Rollback

Risk level: Low

Rollback notes:

  • Revert the commit to restore the unconditional success notification

Verification

  • Type check
  • Lint
  • Tests
  • Build
  • Manual UI check
  • Docs/link check
  • Not applicable, docs-only

Commands / evidence:

npm --workspace apps/web run test    # 82 passed, 673 tests
npm --workspace apps/web run type-check  # clean

Screenshots / Recordings

N/A

Docs

  • README updated
  • Wiki updated
  • Release notes needed
  • Not needed

Related

Closes #286

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.

[Feature]: Warn when API key alias is saved for a key missing from CPA api-keys

1 participant