harp_apps.dashboard.controllers¶
- class DashboardController[source]¶
Bases:
RoutingController- __init__(storage, settings, http_client, router=None)[source]¶
- Parameters:
storage (IStorage)
settings (DashboardSettings)
http_client (AsyncClient)
router (Router)
- http_client: AsyncClient¶
- name = 'ui'¶
- settings: DashboardSettings¶
- static_build_path = '/home/docs/checkouts/readthedocs.org/user_builds/harp-proxy/checkouts/latest/harp_apps/dashboard/web'¶
Static directory to look for pre-built assets.
- BASE_SECURITY_HEADERS = {'Referrer-Policy': 'same-origin', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'DENY'}¶
Sent on every dashboard response: never sniff a type, never render the dashboard in a frame, never leak a dashboard URL to another site.
- DASHBOARD_CONTENT_SECURITY_POLICY = "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'"¶
What the built dashboard needs, nothing more. Emotion injects <style> elements, hence ‘unsafe-inline’ for styles only; message bodies render images through blob: URLs.
- SAME_ORIGIN_FETCH_SITES = frozenset({'none', 'same-origin'})¶
Values of Sec-Fetch-Site for a request the dashboard itself initiated (or a user typing the URL).