Skip to content

brakeman vulnaribility UnsafeReflection. #1587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ def whitelisted_params
end

def resource_class(mapping = nil)
if omniauth_params['resource_class']
omniauth_params['resource_class'].constantize
elsif params['resource_class']
params['resource_class'].constantize
else
raise 'No resource_class found'
end
return @resource_class if defined?(@resource_class)

constant_name = omniauth_params['resource_class'].presence || params['resource_class'].presence
@resource_class = ObjectSpace.each_object(Class).detect { |cls| cls.to_s == constant_name && cls.pretty_print_inspect.starts_with?(constant_name) }
raise 'No resource_class found' if @resource_class.nil?

@resource_class
end

def resource_name
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/model_concerns.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Models that include the `DeviseTokenAuth::Concerns::User` concern will have acce
response.headers.merge!(new_auth_header)
~~~

* **`build_auth_header`**: generates the auth header that should be sent to the client with the next request. Accepts `token` and `client` as arguments. Returns a string.
* **`build_auth_headers`**: generates the auth header that should be sent to the client with the next request. Accepts `token` and `client` as arguments. Returns a string.

**Example**:
~~~ruby
Expand Down