Skip to content

Commit

Permalink
updatesfor csp
Browse files Browse the repository at this point in the history
  • Loading branch information
jgadsden committed Aug 2, 2024
1 parent 405f476 commit 86a03ed
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 48 deletions.
File renamed without changes.
29 changes: 0 additions & 29 deletions td.server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion td.server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"bitbucket": "^2.11.0",
"dotenv": "^16.0.3",
"express": "^4.19.2",
"express-csp-header": "^5.2.1",
"express-rate-limit": "^7.2.0",
"helmet": "^6.0.1",
"jsonwebtoken": "^9.0.0",
Expand Down
16 changes: 0 additions & 16 deletions td.server/src/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expressCspHeader, NONE, SELF } from 'express-csp-header';

import express from 'express';
import path from 'path';
import rateLimit from 'express-rate-limit';
Expand All @@ -25,19 +23,6 @@ const limiter = rateLimit({
legacyHeaders: false // Disable the `X-RateLimit-*` headers
});

const cspDirectives = {
directives: {
'default-src': [SELF],
'frame-ancestors': [NONE],
'form-action': [NONE],
'script-src': [SELF],
'style-src': [SELF],
'img-src': [SELF],
'worker-src': [NONE],
'block-all-mixed-content': true
}
};

const create = () => {
let logger;

Expand All @@ -61,7 +46,6 @@ const create = () => {

// Force HTTPS in production
app.use(https.middleware);
app.use(expressCspHeader(cspDirectives));

// static content
app.use('/public', express.static(siteDir));
Expand Down
2 changes: 0 additions & 2 deletions td.vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@
"express": ">=4.19.2",
"follow-redirects": ">=1.15.6",
"glob-parent@<5.1.2": ">=5.1.2",
"ip@<1.1.9": "1.1.9",
"ip@=2.0.0": ">=2.0.1",
"lodash@<4.17.21": ">=4.17.21",
"minimist@>=1.0.0 <1.2.3": ">=1.2.3",
"node-fetch": ">=2.6.7",
Expand Down
6 changes: 6 additions & 0 deletions td.vue/src/service/x6/graph/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { CELL_SELECTED, CELL_UNSELECTED } from '@/store/actions/cell.js';
import { THREATMODEL_MODIFIED } from '@/store/actions/threatmodel.js';
import shapes from '@/service/x6/shapes/index.js';

const canvasResized = ({ width, height }) => {
console.debug('canvas resized to width ', width, ' height ', height);
};

const edgeConnected = ({ isNew, edge }) => {
if (isNew) {
edge.connector = 'smooth';
Expand Down Expand Up @@ -142,6 +146,7 @@ const nodeAddFlow = (graph) => ({ node }) => {
};

const listen = (graph) => {
graph.on('resize', canvasResized);
graph.on('edge:connected', edgeConnected);
graph.on('edge:dblclick', cellSelected);
graph.on('edge:move', cellSelected);
Expand All @@ -157,6 +162,7 @@ const listen = (graph) => {
};

const removeListeners = (graph) => {
graph.off('resize', canvasResized);
graph.off('edge:connected', edgeConnected);
graph.off('edge:dblclick', cellSelected);
graph.off('edge:move', cellSelected);
Expand Down

0 comments on commit 86a03ed

Please sign in to comment.