Add access loging

This commit is contained in:
LordMathis 2019-11-02 11:46:23 +01:00
parent bd6f1ce98d
commit 30557fdd7e
No known key found for this signature in database
GPG Key ID: 575849FD91CE470C
3 changed files with 27 additions and 0 deletions

View File

@ -26,6 +26,7 @@
"lodash": "^4.17.13", "lodash": "^4.17.13",
"markdown-it": "^10.0.0", "markdown-it": "^10.0.0",
"moment": "^2.24.0", "moment": "^2.24.0",
"morgan": "^1.9.1",
"node-sass": "^4.9.0", "node-sass": "^4.9.0",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.7.0", "react": "^16.7.0",

View File

@ -2,6 +2,7 @@ import express from 'express'
import helmet from 'helmet' import helmet from 'helmet'
import expressStaticGzip from 'express-static-gzip' import expressStaticGzip from 'express-static-gzip'
import path from 'path' import path from 'path'
import morgan from 'morgan'
import jsonfile from 'jsonfile' import jsonfile from 'jsonfile'
import { ServerRenderer } from './utils/serverRender' import { ServerRenderer } from './utils/serverRender'
import { Scanner } from './utils/scanner' import { Scanner } from './utils/scanner'
@ -17,6 +18,8 @@ if (config == null) {
const scanner = new Scanner(config) const scanner = new Scanner(config)
scanner.scan() scanner.scan()
app.use(morgan('common'))
app.use(helmet.contentSecurityPolicy({ app.use(helmet.contentSecurityPolicy({
directives: { directives: {
defaultSrc: ["'self'", `*.${config.baseUrl}`], defaultSrc: ["'self'", `*.${config.baseUrl}`],

View File

@ -1304,6 +1304,13 @@ base@^0.11.1:
mixin-deep "^1.2.0" mixin-deep "^1.2.0"
pascalcase "^0.1.1" pascalcase "^0.1.1"
basic-auth@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-2.0.1.tgz#b998279bf47ce38344b4f3cf916d4679bbf51e3a"
integrity sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==
dependencies:
safe-buffer "5.1.2"
bcrypt-pbkdf@^1.0.0: bcrypt-pbkdf@^1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
@ -4658,6 +4665,17 @@ moment@^2.24.0:
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
morgan@^1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.9.1.tgz#0a8d16734a1d9afbc824b99df87e738e58e2da59"
integrity sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==
dependencies:
basic-auth "~2.0.0"
debug "2.6.9"
depd "~1.1.2"
on-finished "~2.3.0"
on-headers "~1.0.1"
move-concurrently@^1.0.1: move-concurrently@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
@ -5044,6 +5062,11 @@ on-finished@~2.3.0:
dependencies: dependencies:
ee-first "1.1.1" ee-first "1.1.1"
on-headers@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f"
integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==
once@^1.3.0, once@^1.3.1, once@^1.4.0: once@^1.3.0, once@^1.3.1, once@^1.4.0:
version "1.4.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"