Skip to content

Instantly share code, notes, and snippets.

@butonic
Last active April 4, 2017 10:45
Show Gist options
  • Save butonic/4e6d050b778866e3aa99af14d9474613 to your computer and use it in GitHub Desktop.
Save butonic/4e6d050b778866e3aa99af14d9474613 to your computer and use it in GitHub Desktop.
MyCSP app for ownCloud
<?php
/**
* ownCloud
*
* @author Jörn Friedrich Dreyer <[email protected]>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// see https://github.com/owncloud/core/pull/21989#issue-129480520
$policy = new OCP\AppFramework\Http\EmptyContentSecurityPolicy();
$policy->addAllowedScriptDomain('foo.bar.com');
\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy);
<?xml version="1.0"?>
<info>
<id>mycsp</id>
<name>My custom CSP</name>
<description>
This application shows how to customize the CSP</description>
<licence>AGPL</licence>
<author>Jörn Friedrich Dreyer</author>
<version>0.0.1</version>
<types>
<session/><!-- load as early as possible -->
</types>
<dependencies>
<owncloud min-version="9.1" max-version="10" />
</dependencies>
</info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment