mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
These form the basis of Content Security Policy. A policy is a collection of directives that are parsed from either the Content-Security-Policy(-Report-Only) HTTP header, or the `<meta>` element. The directives are what restrict the operations can be performed in the current global execution context. For example, "frame-ancestors: none" tells us to prevent the page from being loaded in an embedded context, such as `<iframe>`. You can see it a bit like OpenBSD's pledge() functionality, but for the web platform: https://man.openbsd.org/pledge.2
31 lines
669 B
C++
31 lines
669 B
C++
/*
|
|
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/ContentSecurityPolicy/SerializedPolicy.h>
|
|
#include <LibWeb/HTML/EmbedderPolicy.h>
|
|
#include <LibWeb/ReferrerPolicy/ReferrerPolicy.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
struct SerializedPolicyContainer {
|
|
Vector<ContentSecurityPolicy::SerializedPolicy> csp_list;
|
|
EmbedderPolicy embedder_policy;
|
|
ReferrerPolicy::ReferrerPolicy referrer_policy;
|
|
};
|
|
|
|
}
|
|
|
|
namespace IPC {
|
|
|
|
template<>
|
|
ErrorOr<void> encode(Encoder&, Web::HTML::SerializedPolicyContainer const&);
|
|
|
|
template<>
|
|
ErrorOr<Web::HTML::SerializedPolicyContainer> decode(Decoder&);
|
|
|
|
}
|