File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -7,5 +7,6 @@ def index
7
7
repo = `git remote show origin -n | perl -ne 'print $1 if m{Fetch URL: .*github\\ .com[:/](.*)\\ .git}'`
8
8
@github_origin = "https://github.com/#{ repo } /tree/"
9
9
@request_env = request . env
10
+ @alaveteli_configuration = AlaveteliConfiguration . to_sanitized_hash
10
11
end
11
12
end
Original file line number Diff line number Diff line change 45
45
46
46
< h2 > Configuration</ h2 >
47
47
48
+ < div class ="help-block ">
49
+ < p >
50
+ See the < a href ="https://alaveteli.org/docs/customising/config/ ">
51
+ documentation</ a > for more information about configuring Alaveteli.
52
+ </ p >
53
+
54
+ < p >
55
+ Sensitive values are replaced with < tt > [FILTERED]</ tt > . Use the
56
+ < tt > config/general.yml</ tt > configuration file to view these.
57
+ </ p >
58
+ </ div >
59
+
48
60
< table class ="table table-condensed table-debug ">
49
61
< tr >
50
62
< td > Rails env:</ td >
56
68
</ tr >
57
69
</ table >
58
70
71
+ < table class ="table table-condensed table-debug ">
72
+ <% @alaveteli_configuration . each do |k , v | %>
73
+ < tr >
74
+ < td > <%= k %> </ td >
75
+ < td > <%= v %> </ td >
76
+ </ tr >
77
+ <% end %>
78
+ </ table >
79
+
59
80
< h2 > Environment variables</ h2 >
60
81
61
82
< table class ="table table-condensed table-debug ">
Original file line number Diff line number Diff line change 2
2
3
3
## Highlighted Features
4
4
5
+ * Render Alaveteli configuration values on admin debug page (Gareth Rees)
5
6
* Update user email to be sent from the blackhole address (Graeme Porteous)
6
7
* Remove ability to publicly view authority contact email addresses to prevent
7
8
harvesting (Gareth Rees)
Original file line number Diff line number Diff line change 13
13
# TODO: Make this return different values depending on the current rails environment
14
14
15
15
module AlaveteliConfiguration
16
+ # WARNING: AlaveteliConfiguration is rendered to admin users in
17
+ # Admin::DebugController.
18
+ #
19
+ # Ensure any sensitive values match this pattern, or add to the pattern if
20
+ # adding a new value that doesn't fit.
21
+ SENSITIVE_KEY_PATTERNS = /SECRET|PASSWORD|LICENSE_KEY/
22
+
16
23
unless const_defined? ( :DEFAULTS )
17
24
18
25
# rubocop:disable Layout/LineLength
@@ -150,4 +157,12 @@ def self.method_missing(name)
150
157
super
151
158
end
152
159
end
160
+
161
+ def self . to_sanitized_hash
162
+ DEFAULTS . keys . each_with_object ( { } ) do |key , memo |
163
+ value = send ( key )
164
+ value = '[FILTERED]' if value . present? && key =~ SENSITIVE_KEY_PATTERNS
165
+ memo [ key ] = value
166
+ end
167
+ end
153
168
end
You can’t perform that action at this time.
0 commit comments