LibWeb/CSP: Add Keyword Sources FlyStrings

This commit is contained in:
Luke Wilde 2024-11-26 11:58:12 +00:00 committed by Shannon Booth
commit 050f984625
Notes: github-actions[bot] 2025-06-30 22:26:10 +00:00
4 changed files with 45 additions and 2 deletions

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/FlyString.h>
namespace Web::ContentSecurityPolicy::Directives::KeywordSources {
// https://w3c.github.io/webappsec-csp/#grammardef-keyword-source
#define ENUMERATE_KEYWORD_SOURCES \
__ENUMERATE_KEYWORD_SOURCE(Self, "'self'") \
__ENUMERATE_KEYWORD_SOURCE(UnsafeInline, "'unsafe-inline'") \
__ENUMERATE_KEYWORD_SOURCE(UnsafeEval, "'unsafe-eval'") \
__ENUMERATE_KEYWORD_SOURCE(StrictDynamic, "'strict-dynamic'") \
__ENUMERATE_KEYWORD_SOURCE(UnsafeHashes, "'unsafe-hashes'") \
__ENUMERATE_KEYWORD_SOURCE(ReportSample, "'report-sample'") \
__ENUMERATE_KEYWORD_SOURCE(UnsafeAllowRedirects, "'unsafe-allow-redirects'") \
__ENUMERATE_KEYWORD_SOURCE(WasmUnsafeEval, "'wasm-unsafe-eval'")
#define __ENUMERATE_KEYWORD_SOURCE(name, value) extern FlyString name;
ENUMERATE_KEYWORD_SOURCES
#undef __ENUMERATE_KEYWORD_SOURCE
}