2017-01-10 13:24:29 +00:00
|
|
|
# security
|
2017-01-13 03:11:55 +00:00
|
|
|
[![version 0.0.0-alpha+1](https://img.shields.io/badge/pub-v0.0.0--alpha+1-red.svg)](https://pub.dartlang.org/packages/angel_security)
|
2017-01-12 23:57:13 +00:00
|
|
|
[![build status](https://travis-ci.org/angel-dart/security.svg)](https://travis-ci.org/angel-dart/security)
|
|
|
|
|
2017-01-13 03:11:55 +00:00
|
|
|
Angel middleware designed to enhance application security by patching common Web security
|
|
|
|
holes.
|
2017-01-12 23:57:13 +00:00
|
|
|
|
2017-01-13 03:11:55 +00:00
|
|
|
Currently unfinished, with incomplete code coverage - **USE AT YOUR OWN RISK!!!**
|
2017-01-12 23:57:13 +00:00
|
|
|
|
|
|
|
## Sanitizing HTML
|
|
|
|
|
|
|
|
```dart
|
|
|
|
app.before.add(sanitizeHtmlInput());
|
|
|
|
|
|
|
|
// Or:
|
|
|
|
app.chain(sanitizeHtmlInput()).get(...)
|
2017-01-13 03:11:55 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## CSRF Tokens
|
|
|
|
|
|
|
|
```dart
|
|
|
|
app.chain(verifyCsrfToken()).post('/form', ...);
|
|
|
|
app.responseFinalizers.add(setCsrfToken());
|
|
|
|
```
|
|
|
|
|
|
|
|
## Banning IP's
|
|
|
|
|
|
|
|
```dart
|
|
|
|
app.before.add(banIp('1.2.3.4'));
|
|
|
|
|
|
|
|
// Or a range:
|
|
|
|
app.before.add(banIp('1.2.3.*'));
|
|
|
|
app.before.add(banIp('1.2.*.4'));
|
|
|
|
|
|
|
|
// Or multiple filters:
|
|
|
|
app.before.add(banIp(['1.2.3.4', '192.*.*.*', new RegExp(r'1\.2.\3.\4')]));
|
2017-01-12 23:57:13 +00:00
|
|
|
```
|