Skip to content

Commit

Permalink
Added override_csp options - thanks @ykzts - closes #281
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 6, 2019
1 parent fc5f0e3 commit 3d9428e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.4.0 [unreleased]

- Added `spec` option
- Added `override_csp` option
- Show all databases in Rails 6 when no config

## 2.3.0
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/pg_hero/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ class HomeController < ActionController::Base
before_action :set_show_details, only: [:index, :queries, :show_query]
before_action :ensure_query_stats, only: [:queries]

if PgHero.config["override_csp"]
after_action do
response.headers["Content-Security-Policy"] = "default-src 'self' 'unsafe-inline'"
end
end

def index
@title = "Overview"
@extended = params[:extended]
Expand Down

1 comment on commit 3d9428e

@ykzts
Copy link

@ykzts ykzts commented on 3d9428e Nov 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.