fix(security): restrict FontAwesome settings endpoints to admins and hide FA key#47
fix(security): restrict FontAwesome settings endpoints to admins and hide FA key#47Micsi wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3dfe9e785
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| """Gibt die gespeicherten Icons-Einstellungen zurück (FA API Key).""" | ||
| row = await db.fetchone("SELECT value FROM app_settings WHERE key = ?", (_FA_KEY_SETTING,)) | ||
| return IconsSettingsOut(fa_api_key=row["value"] if row else None) | ||
| return IconsSettingsOut(has_fa_api_key=bool(row and row["value"])) |
There was a problem hiding this comment.
Keep
fa_api_key in settings response for compatibility
GET /icons/settings now returns only has_fa_api_key, but the existing UI still reads data.fa_api_key in gui/src/views/SettingsView.vue (line 1459). After this change, faSavedKey is always set to null on reload, so admins lose the “Gespeichert” state and the delete-key action despite a key still being stored. This is a client-visible regression introduced by the response shape change in this commit; either the frontend needs to be updated in the same change or the backend should preserve the old field for backward compatibility.
Useful? React with 👍 / 👎.
Motivation
/api/v1/icons/settings.Description
get_admin_userand switch theGET /icons/settingsandPUT /icons/settingsdependencies fromget_current_usertoget_admin_userso only admins can call these endpoints.IconsSettingsOutto expose only a booleanhas_fa_api_keyinstead of returning the storedfa_api_keyplaintext value.has_fa_api_keyaccordingly.obs/api/v1/icons.py(authorization and response model updates) and added theget_admin_userimport.Testing
pytest -qin the repository, which failed during test collection due to a missing test dependency (ModuleNotFoundError: No module named 'pytest_asyncio').Codex Task