Skip to content

Commit 338e190

Browse files
julien-ncsusnux
authored andcommitted
fix: build vuedraggable to avoid importing a UMD bundle which does things that are forbidden by our CSP policy
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent c482e40 commit 338e190

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

apps/dashboard/lib/Controller/DashboardController.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
1616
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
1717
use OCP\AppFramework\Http\Attribute\OpenAPI;
18-
use OCP\AppFramework\Http\ContentSecurityPolicy;
1918
use OCP\AppFramework\Http\FeaturePolicy;
2019
use OCP\AppFramework\Http\TemplateResponse;
2120
use OCP\AppFramework\Services\IInitialState;
@@ -80,10 +79,6 @@ public function index(): TemplateResponse {
8079
'pageTitle' => $this->l10n->t('Dashboard'),
8180
]);
8281

83-
$csp = new ContentSecurityPolicy();
84-
$csp->addAllowedScriptDomain("'unsafe-eval'");
85-
$response->setContentSecurityPolicy($csp);
86-
8782
// For the weather widget we should allow the geolocation
8883
$featurePolicy = new FeaturePolicy();
8984
$featurePolicy->addAllowedGeoLocationDomain('\'self\'');

apps/dashboard/src/DashboardApp.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ import { getCurrentUser } from '@nextcloud/auth'
133133
import axios from '@nextcloud/axios'
134134
import { loadState } from '@nextcloud/initial-state'
135135
import { generateOcsUrl, generateUrl } from '@nextcloud/router'
136-
import Draggable from 'vuedraggable'
136+
// import this directly so Vite builds it and we don't end up using the UMD bundle which
137+
// tries to run "new Function(...)" (for no good reason) which is blocked by our CSP
138+
import Draggable from 'vuedraggable/src/vuedraggable.js'
137139
import NcButton from '@nextcloud/vue/components/NcButton'
138140
import NcModal from '@nextcloud/vue/components/NcModal'
139141
import NcUserStatusIcon from '@nextcloud/vue/components/NcUserStatusIcon'

0 commit comments

Comments
 (0)