‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy Class Reference
Inheritance diagram for TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy:
TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceInterface

Public Member Functions

 withType (HashType $type)
 
 isEmpty ()
 
 compile (?FrontendInterface $cache=null)
 
 serialize ()
 
 jsonSerialize ()
 

Static Public Member Functions

static glob (string $glob)
 
static urls (string ... $urls)
 
static knows (string $value)
 
static parse (string $value)
 

Public Attributes

 $promises = []
 
foreach($urls as $url) $resolvedPromises = Promise\Utils::settle($promises)->wait()
 

Private Member Functions

 compileHashValues (?FrontendInterface $cache)
 
array< string, fetchUrlContents(array $urls):array { $client=GeneralUtility::makeInstance(GuzzleClientFactory::class) -> getClient ()
 

Static Private Member Functions

static isValidUrl (string $value)
 

Private Attributes

const CACHE_LIFETIME = 604800
 
HashType $type = HashType::sha256
 
string $glob = null
 
array $urls = null
 

Detailed Description

Representation of Content-Security-Policy hash source, acting as proxy on files and URLs, to be resolved later when resource contents are actually compiled.

Definition at line 31 of file HashProxy.php.

Member Function Documentation

◆ compile()

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::compile ( ?FrontendInterface  $cache = null)

Compiled representation to be used for Content-Security-Policy HTTP header.

Returns
‪?string null means "not applicable / skip"

Implements TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface.

Definition at line 110 of file HashProxy.php.

References TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy\isEmpty().

◆ compileHashValues()

◆ getClient()

array<string, fetchUrlContents(array $urls): array { $client = GeneralUtility::makeInstance(GuzzleClientFactory::class)-> TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::getClient ( )
private
Parameters
list<string>‪$urls
Returns
‪array<string, ?string> URL (key) and their response body contents of fulfilled requests (value)

◆ glob()

◆ isEmpty()

◆ isValidUrl()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::isValidUrl ( string  $value)
staticprivate

Checks whether the given value is a valid URI and has a file-like part

Definition at line 142 of file HashProxy.php.

◆ jsonSerialize()

◆ knows()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::knows ( string  $value)
static

Determines whether a serialized representation is known and can be handled by a specific implementation, (e.g. "string starts with 'hash-proxy-").

Implements TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface.

Definition at line 72 of file HashProxy.php.

◆ parse()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::parse ( string  $value)
static

◆ serialize()

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::serialize ( )

Serialized representation to be used for persisting declaration (e.g. in database).

Returns
‪?string null means "not applicable / skip"

Implements TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface.

Definition at line 122 of file HashProxy.php.

References TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy\isEmpty().

◆ urls()

◆ withType()

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::withType ( HashType  $type)

Member Data Documentation

◆ $glob

string TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::$glob = null
private

◆ $promises

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::$promises = []

Definition at line 206 of file HashProxy.php.

◆ $resolvedPromises

foreach ( $urls as $url) TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::$resolvedPromises = Promise\Utils::settle($promises)->wait()

Definition at line 212 of file HashProxy.php.

◆ $type

HashType TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::$type = HashType::sha256
private

◆ $urls

◆ CACHE_LIFETIME

const TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashProxy::CACHE_LIFETIME = 604800
private

Definition at line 34 of file HashProxy.php.