Skip to content

Commit e2ee2cb

Browse files
committed
enforce a 'deny all' default rule
this ensures that an access list is 'secure by default' and requires the user to create exceptions or holes in the proection instead of building the wall entirely. This also means that we no longer require the user to input any username/passwords or client addressses and can avoid internal errors which generate unhelpful user errors.
1 parent 005e64e commit e2ee2cb

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

backend/internal/access-list.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ const internalAccessList = {
2525
create: (access, data) => {
2626
return access.can('access_lists:create', data)
2727
.then((/*access_data*/) => {
28-
if ((typeof data.items === 'undefined' || !data.items.length) && (typeof data.clients === 'undefined' || !data.clients.length)) {
29-
throw new error.InternalValidationError('At leaste one user/pass or address must be defined');
30-
}
31-
3228
return accessListModel
3329
.query()
3430
.omit(omissions())
@@ -114,10 +110,6 @@ const internalAccessList = {
114110
update: (access, data) => {
115111
return access.can('access_lists:update', data.id)
116112
.then((/*access_data*/) => {
117-
if ((typeof data.items === 'undefined' || !data.items.length) && (typeof data.clients === 'undefined' || !data.clients.length)) {
118-
throw new error.InternalValidationError('At leaste one user/pass or address must be defined');
119-
}
120-
121113
return internalAccessList.get(access, {id: data.id});
122114
})
123115
.then((row) => {

frontend/js/app/nginx/access/form.ejs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@
5555
<!-- Access -->
5656
<div class="tab-pane" id="access">
5757
<div class="clients"><!-- clients --></div>
58+
<div class="row">
59+
<div class="col-sm-3 col-md-3">
60+
<div class="form-group">
61+
<input type="text" class="form-control disabled" value="deny" disabled>
62+
</div>
63+
</div>
64+
<div class="col-sm-9 col-md-9">
65+
<div class="form-group">
66+
<input type="text" class="form-control disabled" value="all" disabled>
67+
</div>
68+
</div>
69+
</div>
5870
<div class="text-muted">Note that the <code>allow</code> and <code>deny</code> directives will be applied in the order they are defined.</div>
5971
</div>
6072

frontend/js/app/nginx/access/form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ module.exports = Mn.View.extend({
119119
}
120120
}
121121

122-
let clients_to_add = 5 - clients.length;
122+
let clients_to_add = 4 - clients.length;
123123
if (clients_to_add) {
124124
for (let i = 0; i < clients_to_add; i++) {
125125
clients.push({});

0 commit comments

Comments
 (0)