-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1770 from 18F/jmhooper-session-decrypt-error
Raise on session decryption errors
- Loading branch information
Showing
5 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class SessionEncryptorErrorHandler | ||
def self.call(error, _sid) | ||
raise error | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'rails_helper' | ||
|
||
feature 'Session decryption' do | ||
context 'when there is a session decryption error' do | ||
it 'should raise an error and log the user out' do | ||
sign_in_and_2fa_user | ||
|
||
session_encryptor = Rails.application.config.session_options[:serializer] | ||
allow(session_encryptor).to receive(:load).and_raise(Pii::EncryptionError) | ||
|
||
expect { visit account_path }.to raise_error(Pii::EncryptionError) | ||
|
||
allow(session_encryptor).to receive(:load).and_call_original | ||
visit account_path | ||
|
||
# Should redirect to root since the user has been logged out | ||
expect(current_path).to eq(root_path) | ||
end | ||
end | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters