Skip to content

Show anonymized (AAAA****ZZZZ) API key in remote server view (#10731)#10738

Open
lekanjava wants to merge 2 commits into
MISP:2.5from
lekanjava:feature/10731-anonymized-api-key
Open

Show anonymized (AAAA****ZZZZ) API key in remote server view (#10731)#10738
lekanjava wants to merge 2 commits into
MISP:2.5from
lekanjava:feature/10731-anonymized-api-key

Conversation

@lekanjava
Copy link
Copy Markdown
Contributor

Show anonymized (AAAA****ZZZZ) API key in remote server view (#10731)

What does it do?
It implements a feature to display an anonymized version of the API key used for remote server connections in both the /servers/index table view and the "Sync user" view button results.

Debugging remote server connections often requires verifying that the correct API key is being used. Previously, this required direct SQL access to the database. This change allows Site Administrators to see the masked key (format: AAAA****ZZZZ) directly in the UI, simplifying the debugging process while maintaining security.

Key Implementation Details:

Model Logic: Added Server::anonymizeAuthkey() which handles both plain and encrypted keys.
Access Control: The anonymized key is only fetched and displayed if the user is a Site Administrator. It is unset for all other users to ensure no leakage via UI or REST API.
API Support: Added the masked authkey field to the Server index API response (restricted to site admins).
Fixes #10731

Questions
Does it require a DB change? No
Are you using it in production? No (Development/Testing)
Does it require a change in the API (PyMISP for example)? Yes (Added masked authkey field to server index response for site admins)

When MISP.use_uuids_in_urls is set to true, the UI sends UUIDs instead
of numeric IDs in URL paths. The GET branches of delete() and
restSearchExport() only checked is_numeric($id) before falling through
to _jsonDecode($id), which fails on UUID strings with:
  'Invalid JSON input. Make sure that the JSON input is a correctly
   formatted JSON string.'

Add Validation::uuid() check alongside is_numeric() — consistent with
the pattern already used in the POST branches of both methods.

Fixes MISP#10631
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 Request: Show anonymized (AAAA****ZZZZ) API key in remote server view.

1 participant