Skip to content

LG-320 Account History should log when their personal key is changed#2217

Merged
stevegsa merged 1 commit intomasterfrom
stevegsa-account-history-should-log-new-personal-key
Jun 6, 2018
Merged

LG-320 Account History should log when their personal key is changed#2217
stevegsa merged 1 commit intomasterfrom
stevegsa-account-history-should-log-new-personal-key

Conversation

@stevegsa
Copy link
Contributor

@stevegsa stevegsa commented Jun 4, 2018

Why: A user should be aware of sensitive account changes

How: Create a new new_personal_key event when a user changes their personal key.

Hi! Before submitting your PR for review, and/or before merging it, please
go through the following checklist:

  • For DB changes, check for missing indexes, check to see if the changes
    affect other apps (such as the dashboard), make sure the DB columns in the
    various environments are properly populated, coordinate with devops, plan
    migrations in separate steps.

  • For route changes, make sure GET requests don't change state or result in
    destructive behavior. GET requests should only result in information being
    read, not written.

  • For encryption changes, make sure it is compatible with data that was
    encrypted with the old code.

  • For secrets changes, make sure to update the S3 secrets bucket with the
    new configs in all environments.

  • Do not disable Rubocop or Reek offenses unless you are absolutely sure
    they are false positives. If you're not sure how to fix the offense, please
    ask a teammate.

  • When reading data, write tests for nil values, empty strings,
    and invalid formats.

  • When calling redirect_to in a controller, use _url, not _path.

  • When adding user data to the session, use the user_session helper
    instead of the session helper so the data does not persist beyond the user's
    session.

  • When adding a new controller that requires the user to be fully
    authenticated, make sure to add before_action :confirm_two_factor_authenticated.

**Why**: A user should be aware of sensitive account changes

**How**: Create a new new_personal_key event when a user changes their personal key.
def create
user_session[:personal_key] = create_new_code
analytics.track_event(Analytics::PROFILE_PERSONAL_KEY_CREATE)
Event.create(user_id: current_user.id, event_type: :new_personal_key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to call this in the personal key generator so the event get created every time a new personal key is generate? This is missing the event that occurs when the personal key is created on sign up and during identity verification.

That'd look more like phone and email, where we capture those events on sign up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could do that but the hacker one finding only identified when the personal key changed and that's how this PR was scoped.

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW looking at the other events, we don't have 'create' events for the individual items, only 'change' events, perhaps implying that they are covered by the 'create' event for the account. This PR is consistent with that pattern.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, we trigger those events on sign up as well though. IIRC there are events for confirming email and phone that show up after you create your account.

Copy link
Contributor

Choose a reason for hiding this comment

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

aaahhh, then might as well handle both cases here so we don't have to revisit...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To me these extra conditions seem redundant since they are mandatory steps vs someone requesting a new key on your account. Moreover they aren't giving the user any useful information for security purposes and perhaps would create more confusion.

Copy link
Contributor

Choose a reason for hiding this comment

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

@andrewhughey: Any thoughts on ☝️

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm comfortable with the scoping as-is. It addresses the H1 report and the use case described.

We don't include in the event history that a password was created or email confirmed. The only events that show up at creation time are: Account created and phone confirmed

We're taking a good look at /account and account management in general, so we can solve for the larger problems there. Let's keep this to addressing "changing" the key.

@stevegsa stevegsa merged commit 2fbfbf0 into master Jun 6, 2018
@amathews-fs amathews-fs deleted the stevegsa-account-history-should-log-new-personal-key branch January 7, 2021 18:35
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.

4 participants