Add dropbox webhook signature verification and decaf cleanup (#6352)

* Decaf: move functions to top level, removing unused vars

* Decaf: fix camelcase identifiers

* Decaf: remove unnecessary code created because of implicit returns

* Decaf: remove next() fallback callbacks

* Decaf: shorten null checks, remove decaf/eslint comments

* Add signature verification for Dropbox webhook

* Add overleaf dropbox app secret to web (staging+prod)

* Add simple acceptance test for dropbox webhook events processing

* Add method for modules to register app middleware prior to bodyParser call, move rawBody middleware to Dropbox module

GitOrigin-RevId: 736f489e2eb5906f7b202c1049c4ce143deea74e
This commit is contained in:
Thomas 2022-02-01 11:53:28 +01:00 committed by Copybot
parent d069da46ae
commit 7a445eb489
2 changed files with 10 additions and 0 deletions

View file

@ -81,6 +81,14 @@ function loadViewIncludes(app) {
}
}
function registerAppMiddleware(app) {
for (const module of _modules) {
if (module.appMiddleware) {
module.appMiddleware(app)
}
}
}
function moduleIncludes(view, locals) {
const compiledPartials = _viewIncludes[view] || []
let html = ''
@ -144,6 +152,7 @@ module.exports = {
loadViewIncludes,
moduleIncludes,
moduleIncludesAvailable,
registerAppMiddleware,
hooks: {
attach: attachHook,
fire: fireHook,

View file

@ -132,6 +132,7 @@ app.set('views', Path.join(__dirname, '/../../views'))
app.set('view engine', 'pug')
Modules.loadViewIncludes(app)
Modules.registerAppMiddleware(app)
app.use(bodyParser.urlencoded({ extended: true, limit: '2mb' }))
app.use(bodyParser.json({ limit: Settings.max_json_request_size }))
app.use(methodOverride())