Skip to content

Commit

Permalink
add allowed origin
Browse files Browse the repository at this point in the history
  • Loading branch information
ylebre committed Jan 19, 2024
1 parent 4da0bd5 commit b50fb8b
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions solid/lib/Controller/StorageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ public function handleRequest($userId, $path) {
if (isset($clientRegistration['client_name'])) {
$allowedOrigins[] = $clientRegistration['client_name'];
}
if (isset($clientRegistration['origin'])) {
$allowedOrigins[] = $clientRegistration['origin'];
}
}
if (!$this->WAC->isAllowed($request, $webId, $origin, $allowedOrigins)) {
$response = $this->resourceServer->getResponse()
Expand Down Expand Up @@ -428,19 +431,19 @@ private function respond($response) {
// $result->addHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
// $result->addHeader('Access-Control-Allow-Origin', $origin);

$policy = new EmptyContentSecurityPolicy();
$policy->addAllowedStyleDomain("*");
$policy->addAllowedStyleDomain("data:");
$policy->addAllowedScriptDomain("*");
$policy->addAllowedImageDomain("*");
$policy->addAllowedFontDomain("*");
$policy->addAllowedConnectDomain("*");
$policy->allowInlineStyle(true);
$policy->allowInlineScript(true);
$policy->allowEvalScript(true);
$result->setContentSecurityPolicy($policy);
$result->setStatus($statusCode);
$policy = new EmptyContentSecurityPolicy();
$policy->addAllowedStyleDomain("*");
$policy->addAllowedStyleDomain("data:");
$policy->addAllowedScriptDomain("*");
$policy->addAllowedImageDomain("*");
$policy->addAllowedFontDomain("*");
$policy->addAllowedConnectDomain("*");
$policy->allowInlineStyle(true);
$policy->allowInlineScript(true);
$policy->allowEvalScript(true);
$result->setContentSecurityPolicy($policy);
$result->setStatus($statusCode);
return $result;
}
}

0 comments on commit b50fb8b

Please sign in to comment.