mirror of
https://github.com/trufflesecurity/xsshunter
synced 2024-11-10 06:44:13 +00:00
add sentry (#34)
This commit is contained in:
parent
fcad36363d
commit
8bd420f044
4 changed files with 114 additions and 1 deletions
2
api.js
2
api.js
|
@ -201,7 +201,7 @@ async function set_up_api_server(app) {
|
|||
res.redirect("/app/");
|
||||
} catch (error) {
|
||||
console.log(`Error Occured: ${error}`);
|
||||
res.status(500).send("Error Occured");
|
||||
res.status(500).send("Error Occured. We're seeing a lot of traffic now. Please try again soon.");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
27
app.js
27
app.js
|
@ -17,6 +17,8 @@ const notification = require('./notification.js');
|
|||
const api = require('./api.js');
|
||||
const validate = require('express-jsonschema').validate;
|
||||
const constants = require('./constants.js');
|
||||
const Sentry = require('@sentry/node');
|
||||
const Tracing = require("@sentry/tracing");
|
||||
|
||||
function set_secure_headers(req, res) {
|
||||
res.set("X-XSS-Protection", "mode=block");
|
||||
|
@ -51,6 +53,31 @@ const SCREENSHOT_FILENAME_REGEX = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]
|
|||
|
||||
async function get_app_server() {
|
||||
const app = express();
|
||||
|
||||
if (process.env.SENTRY_ENABLED === "true") {
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
integrations: [
|
||||
// enable HTTP calls tracing
|
||||
new Sentry.Integrations.Http({ tracing: true }),
|
||||
// enable Express.js middleware tracing
|
||||
new Tracing.Integrations.Express({ app }),
|
||||
],
|
||||
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 0.01,
|
||||
});
|
||||
|
||||
// RequestHandler creates a separate execution context using domains, so that every
|
||||
// transaction/span/breadcrumb is attached to its own Hub instance
|
||||
app.use(Sentry.Handlers.requestHandler());
|
||||
// TracingHandler creates a trace for every incoming request
|
||||
app.use(Sentry.Handlers.tracingHandler());
|
||||
app.use(Sentry.Handlers.errorHandler());
|
||||
}
|
||||
|
||||
app.set('trust proxy', true);
|
||||
app.disable('x-powered-by');
|
||||
|
||||
|
|
84
package-lock.json
generated
84
package-lock.json
generated
|
@ -12,6 +12,8 @@
|
|||
"@deveodk/vue-toastr": "^1.1.0",
|
||||
"@google-cloud/storage": "^6.9.0",
|
||||
"@sendgrid/mail": "^7.7.0",
|
||||
"@sentry/node": "^7.34.0",
|
||||
"@sentry/tracing": "^7.34.0",
|
||||
"@truffledustin/node-client-sessions": "^0.8.0",
|
||||
"bcrypt": "^5.0.1",
|
||||
"body-parser": "^1.20.1",
|
||||
|
@ -1128,6 +1130,78 @@
|
|||
"node": "6.* || 8.* || >=10.*"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/core": {
|
||||
"version": "7.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.34.0.tgz",
|
||||
"integrity": "sha512-J1oxsYZX1N0tkEcaHt/uuDqk6zOnaivyampp+EvBsUMCdemjg7rwKvawlRB0ZtBEQu3HAhi8zecm03mlpWfCDw==",
|
||||
"dependencies": {
|
||||
"@sentry/types": "7.34.0",
|
||||
"@sentry/utils": "7.34.0",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/node": {
|
||||
"version": "7.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.34.0.tgz",
|
||||
"integrity": "sha512-VM4XeydRdgeaNTRe8kwqYg2oNPddVyY74PlCFEFnPEN1NccycNuwiFno68kNrApeqxxLlTTmzkJy0BWo16x2Yg==",
|
||||
"dependencies": {
|
||||
"@sentry/core": "7.34.0",
|
||||
"@sentry/types": "7.34.0",
|
||||
"@sentry/utils": "7.34.0",
|
||||
"cookie": "^0.4.1",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"lru_map": "^0.3.3",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/node/node_modules/cookie": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
|
||||
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/tracing": {
|
||||
"version": "7.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.34.0.tgz",
|
||||
"integrity": "sha512-JtfSWBfcWslfIujcpGEPF5oOiAOCd5shMoWYrdTvCfruHhYjp4w5kv/ndkvq2EpFkcQYhdmtQEytXEO8IJIqRw==",
|
||||
"dependencies": {
|
||||
"@sentry/core": "7.34.0",
|
||||
"@sentry/types": "7.34.0",
|
||||
"@sentry/utils": "7.34.0",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/types": {
|
||||
"version": "7.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.34.0.tgz",
|
||||
"integrity": "sha512-K+OeHIrl35PSYn6Zwqe4b8WWyAJQoI5NeWxHVkM7oQTGJ1YLG4BvLsR+UiUXnKdR5krE4EDtEA5jLsDlBEyPvw==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/utils": {
|
||||
"version": "7.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.34.0.tgz",
|
||||
"integrity": "sha512-VIHHXEBw0htzqxnU8A7WkXKvmsG2pZVqHlAn0H9W/yyFQtXMuP1j1i0NsjADB/3JXUKK83kTNWGzScXvp0o+Jg==",
|
||||
"dependencies": {
|
||||
"@sentry/types": "7.34.0",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sinclair/typebox": {
|
||||
"version": "0.25.21",
|
||||
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz",
|
||||
|
@ -3714,6 +3788,11 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lru_map": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz",
|
||||
"integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ=="
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
|
@ -5286,6 +5365,11 @@
|
|||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
|
||||
},
|
||||
"node_modules/tsscmp": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz",
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
"@deveodk/vue-toastr": "^1.1.0",
|
||||
"@google-cloud/storage": "^6.9.0",
|
||||
"@sendgrid/mail": "^7.7.0",
|
||||
"@sentry/node": "^7.34.0",
|
||||
"@sentry/tracing": "^7.34.0",
|
||||
"@truffledustin/node-client-sessions": "^0.8.0",
|
||||
"bcrypt": "^5.0.1",
|
||||
"body-parser": "^1.20.1",
|
||||
|
|
Loading…
Reference in a new issue