Skip to content

Commit 4e7bfd1

Browse files
committed
Add Rails filters to remove more sensitive fields
This focuses on removing sensitive parameter fields related to users and authentication. We exclude specific fields in the auth hash, in case apps use them elsewhere, as well as the entire raw auth hash. Additionally, this excludes parameters use specifically in the OAuth flow redirects. This also filters redirects to external system auth endpoints as these can contain sensitive code and state data. Similarly, anything related to the configured provider account system is removed as well to avoid leaking more information. See: - http://guides.rubyonrails.org/v5.1.6/action_controller_overview.html#log-filtering - https://github.com/rails/rails/blob/v5.1.6/actionpack/lib/action_dispatch/http/filter_parameters.rb - https://github.com/rails/rails/blob/v5.1.6/actionpack/lib/action_dispatch/http/filter_redirect.rb
1 parent 7c0c1ac commit 4e7bfd1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/kracken/railtie.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,27 @@ class Railtie < ::Rails::Railtie
77
app.middleware.insert_after ActionDispatch::DebugExceptions,
88
::Kracken::JsonApi::PublicExceptions
99
end
10+
11+
config.before_initialize do |app|
12+
app.config.filter_parameters += %i[
13+
code
14+
email
15+
linked_accounts
16+
raw_info
17+
redirect_to
18+
redirect_uri
19+
state
20+
token
21+
]
22+
app.config.filter_redirect += [
23+
"auth/radius",
24+
"auth/token",
25+
]
26+
end
27+
28+
# Allow apps to configure the provider in initializers
29+
config.after_initialize do |app|
30+
app.config.filter_redirect << URI(Kracken.config.provider_url).host
31+
end
1032
end
1133
end

0 commit comments

Comments
 (0)