Skip to content

Commit 331f3b0

Browse files
committed
Don't show HTTP Basic auth on dev dashboard
The dashboard will show the URL for the content store and search, which will contain a username/password combo for integration. This hides the info.
1 parent 3046af8 commit 331f3b0

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ group :development, :test do
2525
gem 'govuk-lint'
2626
gem 'govuk_schemas', '~> 3.3'
2727
gem 'jasmine-rails'
28-
gem 'pry-byebug'
2928
end
3029

3130
group :development do

Gemfile.lock

-8
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ GEM
6464
binding_of_caller (0.8.0)
6565
debug_inspector (>= 0.0.1)
6666
builder (3.2.3)
67-
byebug (11.0.0)
6867
capybara (3.26.0)
6968
addressable
7069
mini_mime (>= 0.1.3)
@@ -198,12 +197,6 @@ GEM
198197
ast (~> 2.4.0)
199198
phantomjs (2.1.1.0)
200199
plek (3.0.0)
201-
pry (0.12.2)
202-
coderay (~> 1.1.0)
203-
method_source (~> 0.9.0)
204-
pry-byebug (3.7.0)
205-
byebug (~> 11.0)
206-
pry (~> 0.10)
207200
public_suffix (3.1.1)
208201
puma (4.0.0)
209202
nio4r (~> 2.0)
@@ -383,7 +376,6 @@ DEPENDENCIES
383376
minitest-reporters
384377
mocha
385378
plek (~> 3.0)
386-
pry-byebug
387379
rack_strip_client_ip (~> 0.0.2)
388380
rails (~> 5.2.3)
389381
rails-controller-testing (~> 1.0)

app/controllers/development_controller.rb

+11
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@ def index
1212

1313
@paths = YAML.load_file("test/wraith/config.yaml")["paths"]
1414
end
15+
16+
private
17+
18+
helper_method :remove_secrets
19+
20+
def remove_secrets(original_url)
21+
parsed_url = URI.parse(original_url)
22+
original_url = original_url.gsub(parsed_url.user, "***") if parsed_url.user
23+
original_url = original_url.gsub(parsed_url.password, "***") if parsed_url.password
24+
original_url
25+
end
1526
end

app/views/development/index.html.erb

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
<table>
2929
<tr>
3030
<td>Content store</td>
31-
<td><%= link_to Plek.find('content-store'), Plek.find('content-store') %></td>
31+
<td><%= link_to remove_secrets(Plek.find('content-store')), remove_secrets(Plek.find('content-store')) %></td>
3232
</tr>
3333
<tr>
3434
<td>Static</td>
35-
<td><%= link_to Plek.find('static'), Plek.find('static') %></td>
35+
<td><%= link_to remove_secrets(Plek.find('static')), remove_secrets(Plek.find('static')) %></td>
3636
</tr>
3737
<tr>
3838
<td>Search</td>
39-
<td><%= link_to Plek.find('search'), Plek.find('search') %></td>
39+
<td><%= link_to remove_secrets(Plek.find('search')), remove_secrets(Plek.find('search')) %></td>
4040
</tr>
4141
</table>
4242

startup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bundle install
55
function set_env() {
66
export GOVUK_APP_DOMAIN=www.$1
77
export GOVUK_WEBSITE_ROOT=https://www.$1
8-
export PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://www.$1/api}
8+
export PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://test:bla@www.$1/api}
99
export PLEK_SERVICE_RUMMAGER_URI=${PLEK_SERVICE_RUMMAGER_URI-https://www.$1/api}
1010
export PLEK_SERVICE_SEARCH_URI=${PLEK_SERVICE_SEARCH_URI-https://www.$1/api}
1111
}

0 commit comments

Comments
 (0)