Skip to content
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

KeyLogger bug #12

Open
ClayShentrup opened this issue Dec 20, 2021 · 1 comment
Open

KeyLogger bug #12

ClayShentrup opened this issue Dec 20, 2021 · 1 comment

Comments

@ClayShentrup
Copy link

ClayShentrup commented Dec 20, 2021

key_logger.rb has this:

      def lookup(locale, key, scope = [], options = {})
        key = (Array(scope || []) + [key]).compact.join('.')
        I18n::Coverage::KeyLogger.store_key(key)
        super
      end

This coverts a key like unauthenticated into devise.failure.unauthenticated, resulting in failures in otherwise perfectly functioning code.

I assume this was just an oversight, and you didn't realize super would pass through the altered key rather than the original argument. Proof of concept demo.

irb(main):001:1* class Parent
irb(main):002:2*   def foo(key)
irb(main):003:2*     puts "key is #{key}"
irb(main):004:1*   end
irb(main):005:0> end
=> :foo
irb(main):006:1* class Child < Parent
irb(main):007:2*   def foo(key)
irb(main):008:2*     key = "banana"
irb(main):009:2*     super
irb(main):010:1*   end
irb(main):011:0> end
=> :foo
irb(main):012:0> Child.new.foo("ohai")
key is banana
@ClayShentrup
Copy link
Author

Fixed by this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant