Skip to content

Commit

Permalink
FEATURE: Disallow bots (UNFINISHED).
Browse files Browse the repository at this point in the history
  • Loading branch information
benel committed Sep 14, 2024
1 parent b2067f6 commit 5864d48
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var logger = require('morgan');
var cors = require('cors');
var yaml = require('yaml');
var fs = require('fs');
var robots = require('express-robots-txt');
var AAAforREST = require('./index');

process.on('uncaughtException', function(e) {
Expand All @@ -16,6 +17,7 @@ let settings = yaml.parse(fs.readFileSync('conf/config.yml', 'utf8'));
let aaa = new AAAforREST(settings);

let getSession = session(settings.session);
let disallowBots = robots({ UserAgent: '*', Disallow: '/' });

let destroySession = function (request, response, next) {
request.session = null;
Expand Down Expand Up @@ -58,6 +60,7 @@ app.route('/_users/*')

app.route('*')
.get(
disallowBots,
getSession,
aaa.loadInSession,
aaa.parseAuthenticationHeader,
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"cors": "^2.8.5",
"express": "^4.17.1",
"express-http-proxy": "^1.6.0",
"express-robots-txt": "^1.0.0",
"express-session": "^1.17.1",
"fs": "0.0.1-security",
"ldapjs": "^2.2.0",
Expand Down

0 comments on commit 5864d48

Please sign in to comment.