File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed
Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ Ensure generic webhooks have appropriate Content-Security-Policy headers.
Original file line number Diff line number Diff line change 5555 "cors" : " ^2.8.5" ,
5656 "express" : " ^4.18.2" ,
5757 "figma-js" : " ^1.14.0" ,
58+ "helmet" : " ^7.1.0" ,
5859 "http-status-codes" : " ^2.2.0" ,
5960 "ioredis" : " ^5.2.3" ,
6061 "jira-client" : " ^8.2.2" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Logger } from "matrix-appservice-bridge";
44import { ApiError , ErrCode } from "../api" ;
55import { GenericWebhookEvent , GenericWebhookEventResult } from "./types" ;
66import * as xml from "xml2js" ;
7+ import helmet , { crossOriginOpenerPolicy } from "helmet" ;
78
89const WEBHOOK_RESPONSE_TIMEOUT = 5000 ;
910
@@ -83,6 +84,17 @@ export class GenericWebhooksRouter {
8384 const router = Router ( ) ;
8485 router . all (
8586 '/:hookId' ,
87+ helmet ( {
88+ contentSecurityPolicy : {
89+ useDefaults : true ,
90+ directives : {
91+ defaultSrc : "'self'" ,
92+ sandbox : ''
93+ }
94+ } ,
95+ xFrameOptions : { action : 'deny' } ,
96+ crossOriginResourcePolicy : { policy : 'same-site' } ,
97+ } ) ,
8698 GenericWebhooksRouter . xmlHandler ,
8799 express . urlencoded ( { extended : false } ) ,
88100 express . json ( ) ,
Original file line number Diff line number Diff line change 44904490 resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
44914491 integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
44924492
4493+ helmet@^7.1.0 :
4494+ version "7.1.0"
4495+ resolved "https://registry.yarnpkg.com/helmet/-/helmet-7.1.0.tgz#287279e00f8a3763d5dccbaf1e5ee39b8c3784ca"
4496+ integrity sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg==
4497+
44934498homerunner-client@^1.0.0 :
44944499 version "1.0.0"
44954500 resolved "https://registry.yarnpkg.com/homerunner-client/-/homerunner-client-1.0.0.tgz#fa535d7aa5d84ff5b1c0e9b116bd3a6bc12bf4df"
You can’t perform that action at this time.
0 commit comments