fix: include home_content URL in CSP frame-src origins (fixes #1519)
This commit is contained in:
@@ -333,8 +333,8 @@ func safeRawJSONArray(raw string) json.RawMessage {
|
|||||||
return json.RawMessage("[]")
|
return json.RawMessage("[]")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFrameSrcOrigins returns deduplicated http(s) origins from purchase_subscription_url
|
// GetFrameSrcOrigins returns deduplicated http(s) origins from home_content URL,
|
||||||
// and all custom_menu_items URLs. Used by the router layer for CSP frame-src injection.
|
// purchase_subscription_url, and all custom_menu_items URLs. Used by the router layer for CSP frame-src injection.
|
||||||
func (s *SettingService) GetFrameSrcOrigins(ctx context.Context) ([]string, error) {
|
func (s *SettingService) GetFrameSrcOrigins(ctx context.Context) ([]string, error) {
|
||||||
settings, err := s.GetPublicSettings(ctx)
|
settings, err := s.GetPublicSettings(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -353,6 +353,9 @@ func (s *SettingService) GetFrameSrcOrigins(ctx context.Context) ([]string, erro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// home content URL (when home_content is set to a URL for iframe embedding)
|
||||||
|
addOrigin(settings.HomeContent)
|
||||||
|
|
||||||
// purchase subscription URL
|
// purchase subscription URL
|
||||||
if settings.PurchaseSubscriptionEnabled {
|
if settings.PurchaseSubscriptionEnabled {
|
||||||
addOrigin(settings.PurchaseSubscriptionURL)
|
addOrigin(settings.PurchaseSubscriptionURL)
|
||||||
|
|||||||
Reference in New Issue
Block a user