forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define CSP list and associated enums from Content Security Policy Spec
- Loading branch information
1 parent
e8ff9b6
commit c08e44e
Showing
4 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2024, Noah Bright <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <AK/HashTable.h> | ||
#include <AK/String.h> | ||
#include <LibURL/Origin.h> | ||
|
||
// https://w3c.github.io/webappsec-csp/#framework-policy | ||
namespace Web::HTML { | ||
|
||
enum class PolicyDisposition { | ||
Enforce, | ||
Report | ||
}; | ||
|
||
enum class PolicySource { | ||
Head, | ||
Meta | ||
}; | ||
|
||
// https://w3c.github.io/webappsec-csp/#content-security-policy-object | ||
struct Policy { | ||
// https://w3c.github.io/webappsec-csp/#directives | ||
OrderedHashMap<String, Optional<HashTable<String>>> directive_set; | ||
PolicyDisposition disposition; | ||
PolicySource source; | ||
URL::Origin self_origin; | ||
}; | ||
|
||
using CSPList = Vector<Policy>; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters