Skip to content

Don't allow any /verify/* path in prod without SP context (LG-3942)#4543

Closed
solipet wants to merge 3 commits intomasterfrom
dprice-lg-3942-block-all-nonSP-verify-paths
Closed

Don't allow any /verify/* path in prod without SP context (LG-3942)#4543
solipet wants to merge 3 commits intomasterfrom
dprice-lg-3942-block-all-nonSP-verify-paths

Conversation

@solipet
Copy link
Contributor

@solipet solipet commented Dec 29, 2020

@aduth noted in #4538 that this should probably apply to all /verify/* paths, not just /verify.

The spec on the IdvController tests that the before action does what it is supposed to do, and the other specs simply assure that the before action is present on the controller. Was using the have_actions matcher to ensure that the before action was applied to each controller, but that matcher doesn't appear to actually do anything.

extend ActiveSupport::Concern

included do
before_action :sp_context_needed?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is pretty broad, I just want to double-check we want to verify in all cases.

One example: When we send user an email including a link to reverify, will there be an SP associated?

<%= link_to idv_recovery_step_url(step: :recover, token: @token, locale: @locale),
idv_recovery_step_url(step: :recover, token: @token, locale: @locale),
target: '_blank',
class: 'float-center', align: 'center' %>

…lly work?"

Correctly use the have_action matcher

This reverts commit 2e3fae7.
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


def sp_context_needed?
return if sp_from_sp_session.present?
return if LoginGov::Hostdata.env != 'prod'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this use the config from #4545 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is out of date and superceded by #4545


describe 'before_actions' do
it 'includes before_actions from IdvSession' do
expect(subject).to have_actions(:sp_context_needed?)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT of using controller instead of subject?

Suggested change
expect(subject).to have_actions(:sp_context_needed?)
expect(controller).to have_actions(:sp_context_needed?)

@solipet
Copy link
Contributor Author

solipet commented Feb 1, 2021

Closing - work moved to #4634

@solipet solipet closed this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants