How to use the xssFilter function from helmet

Find comprehensive JavaScript helmet.xssFilter code examples handpicked from public code repositorys.

145
146
147
148
149
150
151
152
153
154

`xssFilter` - устанавливает заголовок `X-XSS-Protection`, активируя тем самым фильтр межсайтового скриптинга.

```js
app.use(
    helmet.xssFilter({
        setOnOldIE: true,
        reportUri: 'http://example.com/report',
    })
);
fork icon14
star icon101
watch icon3

+ 5 other calls in file

3
4
5
6
7
8
9

exports.dnsPreFetchControl = helmet.dnsPrefetchControl()
exports.frameGuard = helmet.frameguard()
exports.ieNoOpen = helmet.ieNoOpen()
exports.noSniff = helmet.noSniff()
exports.xssFilter = helmet.xssFilter()
exports.referrerPolicy = helmet.referrerPolicy({ policy: 'same-origin' })
fork icon1
star icon2
watch icon3

52
53
54
55
56
57
58
59
60
61
      objectSrc: ["'self'"],
      frameSrc: ["'self'"],
      fontSrc: ["'self'"],
    },
  }),
  helmet.xssFilter(true),
  helmet.referrerPolicy({
    policy: "no-referrer",
  })
);
fork icon0
star icon0
watch icon1