Skip to content

Activity log: add user-login to failed login attempts#8817

Merged
simison merged 9 commits intomasterfrom
update/activity-failed-login-user
Feb 20, 2018
Merged

Activity log: add user-login to failed login attempts#8817
simison merged 9 commits intomasterfrom
update/activity-failed-login-user

Conversation

@simison
Copy link
Copy Markdown
Member

@simison simison commented Feb 12, 2018

An activity for failed login attempt should look like:

[user_login] had a failed login attempt from IP Address: 123.123.123.123
image

But it currently looks like :
image

This adds user login we can then show in Calypso.

  • Send user_login (username or email) used in a failed login attempt.
  • Removes IP from args since it's already being sent in author object.

Backwards compatibility?

Should I be worrying about backwards compatibility for jpp_log_failed_attempt action?

In the new version, it'll send an array containing login_user instead of a string containing IP.

Before:

jetpack/modules/protect.php

Lines 272 to 281 in 1db8bc3

/**
* Fires before every failed login attempt.
*
* @module protect
*
* @since 3.4.0
*
* @param string jetpack_protect_get_ip IP stored by Protect.
*/
do_action( 'jpp_log_failed_attempt', jetpack_protect_get_ip() );

After:

jetpack/modules/protect.php

Lines 273 to 285 in ee0f162

/**
* Fires before every failed login attempt.
*
* @module protect
*
* @since 3.4.0
*
* @param array Information about failed login attempt
* [
* 'user_login' => (string) Username or email used in failed login attempt
* ]
*/
do_action( 'jpp_log_failed_attempt', array( 'login_user' => $login_user ) );

Changelog entry

  • We improved the way we show failed login attempts in Jetpack's Activity Log.

@simison simison self-assigned this Feb 12, 2018
@simison simison requested a review from a team as a code owner February 12, 2018 15:51
@jeherve jeherve added [Feature] Protect Also known as Brute Force Attack Protection [Status] In Progress [Feature] Activity Log labels Feb 12, 2018
Copy link
Copy Markdown
Contributor

@roccotripaldi roccotripaldi left a comment

Choose a reason for hiding this comment

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

This looks good, and I've tested fully and it works as expected. Nice work!

I left one minor comment. Once that is addressed, and we can get the unit tests passing, I'll approve!

* @since 3.4.0
*
* @param string jetpack_protect_get_ip IP stored by Protect.
* @param string IP
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's use the same description from before

Tests for:
- generated user
- empty login_user (should return empty string)
(Breaks backwards compatibility)
Copy link
Copy Markdown
Contributor

@roccotripaldi roccotripaldi left a comment

Choose a reason for hiding this comment

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

LGTM!

@simison
Copy link
Copy Markdown
Member Author

simison commented Feb 19, 2018

Noting that I got okay from @lezama regarding breaking backwards compatibility of jpp_log_failed_attempt action — it isn't used anywhere else at Jetpack and we account for the change at wpcom already.

Copy link
Copy Markdown
Contributor

@lezama lezama left a comment

Choose a reason for hiding this comment

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

🚢 IT

@simison simison merged commit b8954ce into master Feb 20, 2018
@simison simison deleted the update/activity-failed-login-user branch February 20, 2018 14:14
@oskosk oskosk added this to the 5.9 milestone Feb 27, 2018
oskosk added a commit that referenced this pull request Feb 27, 2018
oskosk added a commit that referenced this pull request Feb 27, 2018
* update changelog.txt

* Update readme.txt with scaffolding for 5.9 changelog and release draft shortlink

* Add changelog entry for #8243

* Add changelog entry for #8296

* Add changelog entry for #8367

* Add changelog entry for #8686

* Add changelog entry for #8707

* Add changelog entry for #8709 and #8714

* Add changelog entry for #8729

* Add changelog entry for #8777

* Add changelog entry for #8780

* Add changelog entry for #8786

* Add changelog entry for #8787

* Add changelog entry for #8801 #8805 #8832 #8865 and #8804

* Add changelog entry for #8817

* Add changelog entry for #8822

* Add changelog entry for #8823

* Add changelog entry for #8829

* Add changelog entry for #8834

* move some items to major enhancements

* Add changelog entry for #8836

* Add changelog entry for #8839

* Add changelog entry for #8861

* Add changelog entry for #8862

* Add changelog entry for #8863

* Add changelog entry for #8866

* Add changelog entry for #8870

* Add changelog entry for #8874

* Add changelog entry for #8875

* Add changelog entry for #8881

* Add changelog entry for #8890

* Add changelog entry for #8911

* Add changelog entry for #8927

* Add changelog entry for #8931

* Add changelog entry for #8933

* Add changelog entry for #8930

* fix wording

* typo

* minor fixes

* replace partner scripts for Jetpack Start in changelog entry

* Update to-test.md

* Update to-test.md

* minor style fixes to to-test.md

* minor style fixes to to-test.md

* minor fixes on to-test.md

* Add changelog entry for #8868

* Add changelog entry for #8844

* Add changelog entry for #8664

* Add changelog entry for #8935

* Add changelog entry for #8425

* Add changelog entry for #8625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Activity Log [Feature] Protect Also known as Brute Force Attack Protection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants