fix(security): Prestoui restrict img-src wildcard in CSP#26790
fix(security): Prestoui restrict img-src wildcard in CSP#26790tdcmeehan merged 1 commit intoprestodb:masterfrom
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideTightens the default Content-Security-Policy (CSP) for the Web UI by removing broad HTTP/HTTPS allowances from the img-src directive so that only self and data URLs are permitted for images. Sequence diagram for Web UI request with updated CSP img-src policysequenceDiagram
actor User
participant Browser
participant PrestoCoordinator
User->>Browser: Navigate to WebUI URL
Browser->>PrestoCoordinator: HTTP GET /ui
PrestoCoordinator-->>Browser: HTML + CSP header
Browser->>Browser: Parse CSP
Browser->>PrestoCoordinator: Request images from self
PrestoCoordinator-->>Browser: Serve images from self
Browser->>ExternalImageHost: Attempt to load external images (http/https)
ExternalImageHost-->>Browser: Image response
Browser->>Browser: Block external images due to CSP img-src 'self' data:
Browser->>Browser: Allow only self and data images to render
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
nishithakbhaskaran
left a comment
There was a problem hiding this comment.
Can you help me understand how do the change fixes the issue
|
Also you can change the title something like |
Removing |
nishithakbhaskaran
left a comment
There was a problem hiding this comment.
Thanks for the fix @adkharat . LGTM!
|
@yhwang and @tdcmeehan Can you please review the PR. |
|
@unidevel imported this issue as lakehouse/presto #26790 |
Description
Medium Dynamic scan CSV's issues flagged by ZAP.
Motivation and Context
(1) CSP: Wildcard Directive
Issue: CSP has a very broad
img-src:Removing
http: https:eliminates scheme-wide allowances that permitted any external image host, closing the “wildcard/broad img-src” finding. Only images served from the UI origin or inline data URIs will load; everything else is blocked by the browser.This directly addresses the reported CSP issue because the Content-Security-Policy header sent by the coordinator UI is the enforcement point; tightening the directive stops untrusted external image sources.
Release Notes
Please follow release notes guidelines and fill in the release notes below.