#53692 closed defect (bug) (fixed)
Inaccurate schema for the app_id property in the application-passwords endpoints
| Reported by: | johnbillion | Owned by: | johnbillion |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.9 |
| Component: | Application Passwords | Version: | 5.6 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | rest-api |
Description
The schema for the app_id property of objects in the wp/v2/application-passwords/* endpoints has a format of uuid. This is not entirely accurate because if no app ID was provided when the application password was registered then this field contains an empty string.
Change History (6)
This ticket was mentioned in PR #1507 on WordPress/wordpress-develop by johnbillion.
5 years ago
#1
- Keywords has-patch added; needs-refresh needs-patch removed
This ticket was mentioned in PR #8282 on WordPress/wordpress-develop by @sukhendu2002.
20 months ago
#2
- Keywords has-unit-tests added; needs-unit-tests removed
…rtelated unit test
Trac ticket: https://core.trac.wordpress.org/ticket/53692
Reference PR: https://github.com/WordPress/wordpress-develop/pull/1507
@johnbillion commented on PR #1507:
15 months ago
#3
Closing in favour of #8282
@jkmassel commented on PR #8282:
11 months ago
#6
A late note on this – it changed the behaviour of the Application Password registration and update endpoints – they no longer accept app_id: null. This is a sensible change – you should omit the parameter to reflect your intention. Documenting the change here for future reference.
#!/bin/bash
# Bug: WordPress 6.9-RC3 rejects `app_id: null` in application-passwords endpoint
# This worked in previous versions.
# Replace these with your test credentials
USER="test@example.com"
PASSWORD="password"
SITE_URL="http://localhost/"
echo "=== Test 1: app_id omitted (works) ==="
curl -s --user "$USER:$PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name": "test_omitted"}' \
"$SITE_URL/wp-json/wp/v2/users/1/application-passwords" | jq .
echo ""
echo "=== Test 2: app_id: null (FAILS in 6.9-RC3) ==="
curl -s --user "$USER:$PASSWORD" \
-H "Content-Type: application/json" \
-d '{"app_id": null, "name": "test_null"}' \
"$SITE_URL/wp-json/wp/v2/users/1/application-passwords" | jq .
echo ""
echo "=== Test 3: app_id: \"\" empty string (works) ==="
curl -s --user "$USER:$PASSWORD" \
-H "Content-Type: application/json" \
-d '{"app_id": "", "name": "test_empty"}' \
"$SITE_URL/wp-json/wp/v2/users/1/application-passwords" | jq .
echo ""
echo "=== Test 4: app_id: valid UUID (works) ==="
curl -s --user "$USER:$PASSWORD" \
-H "Content-Type: application/json" \
-d '{"app_id": "550e8400-e29b-41d4-a716-446655440000", "name": "test_uuid"}' \
"$SITE_URL/wp-json/wp/v2/users/1/application-passwords" | jq .
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/53692
Needs tests.