Automattic / Automattic/jetpack

Protect: API returns 'invalid action' for successful_login

Open
#14,577 1 comment 0 reactions 0 assignees View on GitHub
[Feature] Protect [Pri] Normal Enhancement
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

#### Steps to reproduce the issue

1. Enable Protect
2. Login with a successful user/pass
3. Watch API requests and see that the Protect API returns an invalid action upon successful login

Example with curl, with particulars removed:
```
$ curl https://api.bruteprotect.com/ -d 'ip=1.2.3.4&api_key=abcdef&headers={"REMOTE_ADDR":"1.2.3.4"}&action=successful_login' -s | jq

{
"status": "ok",
"msg": "Invalid Action Specified",
"seconds_remaining": 60,
"blocked_attempts": "1",
"error": "Invalid Action Specified"
}
```

This doesn't appear to cause any issues within the Protect module, but may be indicative of either the module being out-of-date with the API or something of the like.

This was noticed while debugging a Protect API issue related to WordPress.org for https://meta.trac.wordpress.org/ticket/4989 - It's often that around the early hours in UTC that the call seems to return unsafe values for 'good' IPs.

Source: https://github.com/Automattic/jetpack/blob/458aae06fc108ec6ba4c27b2feeff96c7495eb75/modules/protect.php#L342-L353

Contributor guide

Open the contributing guide

Research direction

Start with modules/protect.php at lines 342-353 and reproduce the documented curl request using action=successful_login. Compare the API response with the Protect module's expected handling, then confirm that successful login requests no longer produce an invalid-action response or document the external API mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.