-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
treewide: forbid use of selected site variables in domain specific or…
… site configs [Matthias schiffer: rebase, add a few more restrictions]
- Loading branch information
Showing
14 changed files
with
53 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
need_string_array 'authorized_keys' | ||
need_string_array(in_site('authorized_keys')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
need_string 'autoupdater.branch' | ||
need_string(in_site('autoupdater.branch')) | ||
|
||
local function check_branch(k, _) | ||
assert_uci_name(k) | ||
|
||
local prefix = string.format('autoupdater.branches[%q].', k) | ||
|
||
need_string(prefix .. 'name') | ||
need_string(in_site(prefix .. 'name')) | ||
need_string_array_match(prefix .. 'mirrors', '^http://') | ||
need_number(prefix .. 'good_signatures') | ||
need_string_array_match(prefix .. 'pubkeys', '^%x+$') | ||
need_number(in_site(prefix .. 'good_signatures')) | ||
need_string_array_match(in_site(prefix .. 'pubkeys'), '^%x+$') | ||
end | ||
|
||
need_table('autoupdater.branches', check_branch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$', false) | ||
need_string_match(in_domain('next_node.mac'), '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$', false) | ||
|
||
if need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$', false) then | ||
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$') | ||
if need_string_match(in_domain('next_node.ip4'), '^%d+.%d+.%d+.%d+$', false) then | ||
need_string_match(in_domain('prefix4'), '^%d+.%d+.%d+.%d+/%d+$') | ||
end | ||
|
||
need_string_match('next_node.ip6', '^[%x:]+$', false) | ||
need_string_match(in_domain('next_node.ip6'), '^[%x:]+$', false) | ||
|
||
|
||
for _, config in ipairs({'wifi24', 'wifi5'}) do | ||
if need_table(config .. '.ap', nil, false) then | ||
need_string(config .. '.ap.ssid') | ||
need_string(in_domain(config .. '.ap.ssid')) | ||
need_boolean(config .. '.ap.disabled', false) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
if need_table('config_mode', nil, false) and need_table('config_mode.owner', nil, false) then | ||
need_boolean('config_mode.owner.obligatory', false) | ||
if need_table(in_site('config_mode'), nil, false) and need_table(in_site('config_mode.owner'), nil, false) then | ||
need_boolean(in_site('config_mode.owner.obligatory'), false) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
if need_table('config_mode', nil, false) and need_table('config_mode.geo_location', nil, false) then | ||
need_boolean('config_mode.geo_location.show_altitude', false) | ||
if need_table(in_site('config_mode'), nil, false) and need_table(in_site('config_mode.geo_location'), nil, false) then | ||
need_boolean(in_site('config_mode.geo_location.show_altitude'), false) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$', false) | ||
need_string_array_match('extra_prefixes6', '^[%x:]+/%d+$', false) | ||
need_string_match(in_domain('prefix4'), '^%d+.%d+.%d+.%d+/%d+$', false) | ||
need_string_array_match(in_domain('extra_prefixes6'), '^[%x:]+/%d+$', false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
need_boolean('mesh_vpn.enabled', false) | ||
need_boolean(in_site('mesh_vpn.enabled'), false) | ||
need_number('mesh_vpn.mtu') | ||
|
||
if need_table('mesh_vpn.bandwidth_limit', nil, false) then | ||
need_boolean('mesh_vpn.bandwidth_limit.enabled', false) | ||
need_number('mesh_vpn.bandwidth_limit.ingress', false) | ||
need_number('mesh_vpn.bandwidth_limit.egress', false) | ||
if need_table(in_site('mesh_vpn.bandwidth_limit'), nil, false) then | ||
need_boolean(in_site('mesh_vpn.bandwidth_limit.enabled'), false) | ||
need_number(in_site('mesh_vpn.bandwidth_limit.ingress'), false) | ||
need_number(in_site('mesh_vpn.bandwidth_limit.egress'), false) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
need_string('roles.default', false) | ||
need_string(in_site('roles.default'), false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
need_boolean('setup_mode.skip', false) | ||
|
||
need_boolean(in_site('setup_mode.skip'), false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
if need_table('config_mode', nil, false) and need_table('config_mode.remote_login', nil, false) then | ||
need_boolean('config_mode.remote_login.show_password_form', false) | ||
need_number('config_mode.remote_login.min_password_length', false) | ||
if need_table(in_site('config_mode'), nil, false) and need_table(in_site('config_mode.remote_login'), nil, false) then | ||
need_boolean(in_site('config_mode.remote_login.show_password_form'), false) | ||
need_number(in_site('config_mode.remote_login.min_password_length'), false) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
assert(need_boolean('mesh_vpn.fastd.configurable') == true, | ||
assert(need_boolean(in_site('mesh_vpn.fastd.configurable')) == true, | ||
"site.conf error: expected `mesh_vpn.fastd.configurable' to be true") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
need_string 'roles.default' | ||
need_string_array 'roles.list' | ||
need_string(in_site('roles.default')) | ||
need_string_array(in_site('roles.list')) |