feat: add external images support via CSP configuration#28
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new configuration-driven way to allow loading external (HTTPS) images in rendered messages by extending the web UI’s CSP img-src directive, with corresponding config plumbing, UI surface area, and documentation.
Changes:
- Introduces
conversations.external_images.enabledconfig (default disabled) with accessor helpers and parsing/tests. - Updates CSP nonce middleware to optionally include
https:inimg-srcand wires the config into server startup. - Adds Settings dialog toggle plus documentation updates describing the feature and privacy/security implications.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
web/static/components/SettingsDialog.js |
Loads/saves conversations.external_images.enabled and adds an “Allow External Images” toggle in Advanced UI settings. |
internal/web/server.go |
Reads external-images setting from config and passes it into CSP middleware options. |
internal/web/csp_nonce.go |
Builds img-src directive dynamically based on allowExternalImages. |
internal/web/csp_nonce_test.go |
Adds unit coverage for CSP generation with external images enabled/disabled. |
internal/config/config.go |
Adds ExternalImagesConfig, integrates it into ConversationsConfig, and parses YAML into the new field. |
internal/config/config_test.go |
Adds unit tests for new config helpers and YAML parsing. |
docs/config/web/README.md |
Updates security-headers docs to explicitly mention CSP affects scripts and images and links to external-images config. |
docs/config/conversations.md |
Documents external image blocking rationale and how to enable it. |
config/config.default.yaml |
Documents the new external_images option in the default config template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address review feedback: - Add '(requires restart)' to external images toggle description - Update docs to say 'restart Mitto' instead of 'refresh the page'
Review Comments AddressedThank you for the thorough review! I've addressed all 4 comments in commit ac9ec0c: Changes Made:
The approach follows the existing pattern in the Settings dialog where macOS-specific settings that require restart (native notifications, show in all Spaces) include "(requires restart)" in their description text. |
Summary
Add support for displaying external images in agent responses by configuring CSP (Content Security Policy) headers.
Fixes #21
Changes
Configuration
Backend
Frontend
Documentation
Security Considerations
Testing