Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stevepolitodesign/rails-authentication-from-scratch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: mdchaney/rails-authentication-from-scratch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 7 commits
  • 14 files changed
  • 1 contributor

Commits on Jun 12, 2024

  1. Adds current_active_session helper.

    Closes #93, "Why is the ||= removed? current_user method".  This adds
    memoization back to current_user / Current.user, plus causes log out
    when the current session is destroyed.
    mdchaney committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    100dc0c View commit details
    Browse the repository at this point in the history
  2. Remove extraneous check for request.local?

    Closes #88.
    mdchaney committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    c4e6e7b View commit details
    Browse the repository at this point in the history
  3. Adds assertions for remember_me cookie.

    Asserts cookie is http_only, secure, and same-site is "strict".
    Closes #87.
    mdchaney committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    2e6e5b0 View commit details
    Browse the repository at this point in the history
  4. Prevent reuse of confirmation token.

    Closes #86.
    
    The issue is that signed tokens have a simple payload by default that
    doesn't verify anything other than the record id and the token's
    purpose.  This can lead to a security challenge as the token can be used
    to confirm anything that has the same "purpose" for that record.
    
    An example would be someone changing their email address to an email
    address that they don't control.  Using one account, they change the
    email to an email address that they control and get the confirmation
    token.  They then change the email to one that they can't access and
    use the token from the first request to "confirm" the second request.
    The tokens can be used any number of times as long as they're used
    before expiration.
    
    With this change, the email address is included as plain text in the
    request, as well as being used as part of the "purpose" in the token.
    The second request fails because the plain text email address is used to
    constrain the signed lookup.  If they change the plain text email
    address in the link then the message will fail to be validated as the
    "purpose" won't match.  Either way, the token is usable only for
    confirming the original email from the token's creation.
    mdchaney committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    9f1432a View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2024

  1. Updated ruby version.

    mdchaney committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    97e7a32 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d99e033 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    51cb1ed View commit details
    Browse the repository at this point in the history
Loading