mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb/CSP: Implement the report-uri directive
This doesn't do anything by itself, the report a violation algorithm will handle this directive itself.
This commit is contained in:
committed by
Alexander Kalenik
parent
85ad99b98a
commit
ed0230bb93
Notes:
github-actions[bot]
2025-08-07 17:26:58 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/ed0230bb936 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5765
@@ -20,6 +20,7 @@
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/MediaSourceDirective.h>
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/Names.h>
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/ObjectSourceDirective.h>
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/ReportUriDirective.h>
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/ScriptSourceAttributeDirective.h>
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/ScriptSourceDirective.h>
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/ScriptSourceElementDirective.h>
|
||||
@@ -68,6 +69,9 @@ GC::Ref<Directive> create_directive(GC::Heap& heap, String name, Vector<String>
|
||||
if (name == Names::ObjectSrc)
|
||||
return heap.allocate<ObjectSourceDirective>(move(name), move(value));
|
||||
|
||||
if (name == Names::ReportUri)
|
||||
return heap.allocate<ReportUriDirective>(move(name), move(value));
|
||||
|
||||
if (name == Names::ScriptSrcAttr)
|
||||
return heap.allocate<ScriptSourceAttributeDirective>(move(name), move(value));
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/ReportUriDirective.h>
|
||||
|
||||
namespace Web::ContentSecurityPolicy::Directives {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(ReportUriDirective);
|
||||
|
||||
ReportUriDirective::ReportUriDirective(String name, Vector<String> value)
|
||||
: Directive(move(name), move(value))
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/ContentSecurityPolicy/Directives/Directive.h>
|
||||
|
||||
namespace Web::ContentSecurityPolicy::Directives {
|
||||
|
||||
// https://w3c.github.io/webappsec-csp/#directive-report-uri
|
||||
class ReportUriDirective final : public Directive {
|
||||
GC_CELL(ReportUriDirective, Directive)
|
||||
GC_DECLARE_ALLOCATOR(ReportUriDirective);
|
||||
|
||||
public:
|
||||
virtual ~ReportUriDirective() = default;
|
||||
|
||||
private:
|
||||
ReportUriDirective(String name, Vector<String> value);
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user