Skip to content

Bare rescue in load_session_from_redis silently discards wide variety of exceptions #97

@brodygov

Description

@brodygov

There is a bare rescue (which rescues all exceptions that inherit from StandardError) in RedisSessionStore#load_session_from_redis.

This is extremely bad practice, because it will cause a huge variety of exceptions to be silently ignored, including virtually all exceptions generated by any ruby library, including ThreadError, LocalJumpError, etc.

https://github.com/roidrage/redis-session-store/blame/bcf779297078db78d7e17b868c40b1ffd4dea243/lib/redis-session-store.rb#L106

This is just the built in tree of exceptions that would be silently swallowed:

StandardError
  FiberError
  ThreadError
  IndexError
    StopIteration
    KeyError
  Math::DomainError
  LocalJumpError
  IOError
    EOFError
  EncodingError
    Encoding::ConverterNotFoundError
    Encoding::InvalidByteSequenceError
    Encoding::UndefinedConversionError
    Encoding::CompatibilityError
  RegexpError
  SystemCallError
    Errno::ERPCMISMATCH
    # ... lots of system call errors ...
  RangeError
    FloatDomainError
  ZeroDivisionError
  RuntimeError
    Gem::Exception
      # ... lots of gem errors ...
  NameError
    NoMethodError
  ArgumentError
    Gem::Requirement::BadRequirementError
  TypeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions