Skip to content

Commit

Permalink
Don't show HTTP Basic auth on dev dashboard
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tijmenb committed Jul 17, 2019
1 parent 3046af8 commit 331f3b0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ group :development, :test do
gem 'govuk-lint'
gem 'govuk_schemas', '~> 3.3'
gem 'jasmine-rails'
gem 'pry-byebug'
end

group :development do
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ GEM
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
builder (3.2.3)
byebug (11.0.0)
capybara (3.26.0)
addressable
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -198,12 +197,6 @@ GEM
ast (~> 2.4.0)
phantomjs (2.1.1.0)
plek (3.0.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (3.1.1)
puma (4.0.0)
nio4r (~> 2.0)
Expand Down Expand Up @@ -383,7 +376,6 @@ DEPENDENCIES
minitest-reporters
mocha
plek (~> 3.0)
pry-byebug
rack_strip_client_ip (~> 0.0.2)
rails (~> 5.2.3)
rails-controller-testing (~> 1.0)
Expand Down
11 changes: 11 additions & 0 deletions app/controllers/development_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,15 @@ def index

@paths = YAML.load_file("test/wraith/config.yaml")["paths"]
end

private

helper_method :remove_secrets

def remove_secrets(original_url)
parsed_url = URI.parse(original_url)
original_url = original_url.gsub(parsed_url.user, "***") if parsed_url.user
original_url = original_url.gsub(parsed_url.password, "***") if parsed_url.password
original_url
end
end
6 changes: 3 additions & 3 deletions app/views/development/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
<table>
<tr>
<td>Content store</td>
<td><%= link_to Plek.find('content-store'), Plek.find('content-store') %></td>
<td><%= link_to remove_secrets(Plek.find('content-store')), remove_secrets(Plek.find('content-store')) %></td>
</tr>
<tr>
<td>Static</td>
<td><%= link_to Plek.find('static'), Plek.find('static') %></td>
<td><%= link_to remove_secrets(Plek.find('static')), remove_secrets(Plek.find('static')) %></td>
</tr>
<tr>
<td>Search</td>
<td><%= link_to Plek.find('search'), Plek.find('search') %></td>
<td><%= link_to remove_secrets(Plek.find('search')), remove_secrets(Plek.find('search')) %></td>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bundle install
function set_env() {
export GOVUK_APP_DOMAIN=www.$1
export GOVUK_WEBSITE_ROOT=https://www.$1
export PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://www.$1/api}
export PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://test:bla@www.$1/api}
export PLEK_SERVICE_RUMMAGER_URI=${PLEK_SERVICE_RUMMAGER_URI-https://www.$1/api}
export PLEK_SERVICE_SEARCH_URI=${PLEK_SERVICE_SEARCH_URI-https://www.$1/api}
}
Expand Down

0 comments on commit 331f3b0

Please sign in to comment.