-
Notifications
You must be signed in to change notification settings - Fork 0
Frontend - update settings dialog #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| from fastapi import APIRouter | ||
| from pydantic import BaseModel | ||
| from typing import Optional | ||
| import logging | ||
|
|
||
| router = APIRouter(prefix="/api/settings", tags=["settings"]) | ||
| logger = logging.getLogger(__name__) | ||
|
|
||
| class SettingsResponse(BaseModel): | ||
| ai_context: Optional[str] = None | ||
| auto_sync: bool = True | ||
| usage_analytics: bool = True | ||
|
|
||
|
|
||
| class SettingsUpdate(BaseModel): | ||
| ai_context: Optional[str] = None | ||
| auto_sync: Optional[bool] = None | ||
| usage_analytics: Optional[bool] = None | ||
|
|
||
|
|
||
| @router.get("", response_model=SettingsResponse) | ||
| async def get_settings(): | ||
| logger.debug("Fetching user settings - return a stub") | ||
| """Fetch user settings. Returns a stub for now.""" | ||
| return SettingsResponse( | ||
| ai_context="", | ||
| auto_sync=True, | ||
| usage_analytics=True | ||
| ) | ||
|
|
||
|
|
||
| @router.patch("", response_model=SettingsResponse) | ||
| async def update_settings(settings: SettingsUpdate): | ||
| """Update user settings. Does nothing for now, just returns the current stub.""" | ||
| logger.debug("Updating user settings with request %s" % str(settings)) | ||
| return SettingsResponse( | ||
|
Comment on lines
+32
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. No user audit context • The settings update action is not recorded as an audit event with required context (user ID, action description, and outcome). • The current log line is a debug message without a user identifier and does not clearly record success/failure, making event reconstruction difficult. • This weakens traceability for sensitive preference changes and hinders security investigations. Agent Prompt
|
||
| ai_context=settings.ai_context or "", | ||
| auto_sync=settings.auto_sync if settings.auto_sync is not None else True, | ||
| usage_analytics=settings.usage_analytics if settings.usage_analytics is not None else True | ||
| ) | ||
|
Comment on lines
+21
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Settings endpoints missing auth • The new /api/settings read/write endpoints (get_settings, update_settings) do not authenticate the caller or authorize access to a specific user. • This allows any client that can reach the API to read or modify settings, which is improper handling of external input and sensitive user state. • Settings are typically user-scoped; without a user context, the service cannot enforce per-user access control. Agent Prompt
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* Toast Notifications */ | ||
| .toast-container { | ||
| position: fixed; | ||
| top: 1rem; | ||
| right: 1rem; | ||
| z-index: 99999; | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.75rem; | ||
| max-width: 400px; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .toast { | ||
| pointer-events: auto; | ||
| } | ||
|
|
||
| .toast { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 0.75rem; | ||
| padding: 1rem; | ||
| background: var(--color-surface); | ||
| border: 1px solid var(--color-border); | ||
| border-radius: 8px; | ||
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); | ||
| animation: slideIn 0.3s ease-out; | ||
| } | ||
|
|
||
| @keyframes slideIn { | ||
| from { | ||
| transform: translateX(100%); | ||
| opacity: 0; | ||
| } | ||
| to { | ||
| transform: translateX(0); | ||
| opacity: 1; | ||
| } | ||
| } | ||
|
|
||
| .toast-icon { | ||
| font-size: 1.25rem; | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| .toast-success { | ||
| border-left: 4px solid var(--color-status-green); | ||
| } | ||
|
|
||
| .toast-success .toast-icon { | ||
| color: var(--color-status-green); | ||
| } | ||
|
|
||
| .toast-error { | ||
| border-left: 4px solid var(--color-status-red); | ||
| } | ||
|
|
||
| .toast-error .toast-icon { | ||
| color: var(--color-status-red); | ||
| } | ||
|
|
||
| .toast-info { | ||
| border-left: 4px solid var(--color-primary); | ||
| } | ||
|
|
||
| .toast-info .toast-icon { | ||
| color: var(--color-primary); | ||
| } | ||
|
|
||
| .toast-message { | ||
| flex: 1; | ||
| font-size: 0.875rem; | ||
| line-height: 1.4; | ||
| color: var(--color-text); | ||
| } | ||
|
|
||
| .toast-close { | ||
| background: none; | ||
| border: none; | ||
| padding: 0; | ||
| cursor: pointer; | ||
| color: var(--color-text-secondary); | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| transition: color 0.2s; | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| .toast-close:hover { | ||
| color: var(--color-text); | ||
| } | ||
|
|
||
| .toast-close .material-symbols-outlined { | ||
| font-size: 1.125rem; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Settings payload logged verbatim
📘 Rule violation⛨ SecurityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools