SilverStripe CSP headers

ControllerCSPExtension extends Extension
in package

Class \Firesphere\CSPHeaders\Extensions\ControllerCSPExtension

This extension is applied to the PageController, to avoid duplicates. Any duplicates may be caused by extended classes. It should however, not affect the outcome

Table of Contents

Properties

$isTesting  : mixed
$owner  : Controller|ControllerCSPExtension
$addPermissionHeaders  : bool
Should permission policies be added
$addPolicyHeaders  : bool
Should we generate the policy headers or not
$csp_config  : array<string|int, mixed>
Base CSP configuration
$headTags  : array<string|int, mixed>
$inlineCSS  : array<string|int, mixed>
$inlineJS  : array<string|int, mixed>
$nonce  : string

Methods

addCSS()  : mixed
addJS()  : mixed
checkCookie()  : bool
getInlineCSS()  : array<string|int, mixed>
getInlineJS()  : array<string|int, mixed>
getNonce()  : null|string
isAddPolicyHeaders()  : bool
onBeforeInit()  : mixed
Add the needed headers from the database and config
addCSP()  : void
addInlineCSSPolicy()  : void
addInlineJSPolicy()  : void
addResponseHeaders()  : void
addCSPHeaders()  : void
addPermissionsHeaders()  : void
Add the Permissions-Policy header
trimDomain()  : string
Remove https://, trailing slash, etc.
ymlToPolicy()  : mixed

Properties

$nonce

protected string $nonce

randomised sha512 nonce for enabling scripts if you don't want to use validating of the full script

Methods

checkCookie()

public static checkCookie(HTTPRequest $request) : bool
Parameters
$request : HTTPRequest
Return values
bool

getInlineCSS()

public static getInlineCSS() : array<string|int, mixed>
Return values
array<string|int, mixed>

getInlineJS()

public static getInlineJS() : array<string|int, mixed>
Return values
array<string|int, mixed>

onBeforeInit()

Add the needed headers from the database and config

public onBeforeInit() : mixed
Tags
throws
Exception

addCSP()

protected addCSP(CSPBuilder $policy, Controller $owner) : void
Parameters
$policy : CSPBuilder
$owner : Controller

addInlineCSSPolicy()

protected addInlineCSSPolicy(CSPBuilder $policy, array<string|int, mixed> $config) : void
Parameters
$policy : CSPBuilder
$config : array<string|int, mixed>
Tags
throws
Exception

addInlineJSPolicy()

protected addInlineJSPolicy(CSPBuilder $policy, array<string|int, mixed> $config) : void
Parameters
$policy : CSPBuilder
$config : array<string|int, mixed>
Tags
throws
Exception

addResponseHeaders()

protected addResponseHeaders(array<string|int, mixed> $headers, Controller $owner) : void
Parameters
$headers : array<string|int, mixed>
$owner : Controller

addCSPHeaders()

private addCSPHeaders(mixed $ymlConfig, Controller $owner) : void
Parameters
$ymlConfig : mixed
$owner : Controller
Tags
throws
Exception

addPermissionsHeaders()

Add the Permissions-Policy header

private addPermissionsHeaders(array<string|int, mixed> $ymlConfig, Controller $controller) : void
Parameters
$ymlConfig : array<string|int, mixed>
$controller : Controller

trimDomain()

Remove https://, trailing slash, etc.

private trimDomain( $domain) : string
Parameters
$domain :
Return values
string

ymlToPolicy()

private ymlToPolicy(mixed $key, mixed $yml) : mixed
Parameters
$key : mixed
$yml : mixed

        
On this page

Search results