Skip to content

[WebAPI Bug] Customer can change disable_auto_group_change attribure at /V1/customers/me #39240

Open
@wubinworks

Description

@wubinworks

Preconditions and environment

  • Magento 2.4.7 Community Edition
  • Register a customer for reproduce if needed

Steps to reproduce

  1. Generate <CUSTOMER TOKEN> as described in office document.
  2. Confirm customer data:
curl --request GET 'https://<domain>/rest/V1/customers/me' \
    --header 'Authorization: Bearer <CUSTOMER TOKEN>'

Output body:
{
    "id": 1,
    "email": "[email protected]",
    "firstname":"Firstname",
    "lastname":"Lastname",
    ...
    "disable_auto_group_change": 0,
    "created_in": "Default Store View",
    "extension_attributes": {
        "is_subscribed": false
    }
    ...
}
  1. Change customer data:
curl --request PUT 'https://<domain>/rest/V1/customers/me' \
    --header 'Authorization: Bearer <CUSTOMER TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "customer": {
            "id": 1,
            "email": "[email protected]",
            "firstname":"Firstname",
            "lastname":"Lastname",
            "disable_auto_group_change": 1,
            "created_in": "Changed",
            "confirmation": "Hello",
            "extension_attributes": {
                "is_subscribed": true
            }
        }
    }'
  1. Confirm customer data again:
curl --request GET 'https://<domain>/rest/V1/customers/me' \
    --header 'Authorization: Bearer <CUSTOMER TOKEN>'

Output body:
{
    "id": 1,
    "email": "[email protected]",
    "firstname":"Firstname",
    "lastname":"Lastname",
    ...
    "disable_auto_group_change": 1,
    "created_in": "Changed",
    "confirmation": "Hello",
    "extension_attributes": {
        "is_subscribed": true
    }
    ...
}

Expected result

At least disable_auto_group_change and confirmation should not be changed.
Maybe Magento WebAPI needs to throw exception.

Actual result

Both disable_auto_group_change, created_in, confirmation and extension_attributes.is_subscribed is editable in Customer User Context.

disable_auto_group_change checkbox change can be confirmed on Admin Panel.

Additional information

disable_auto_group_change: it should only be changeable by Admin or Integration.
created_in: this attribute is set during registration but not used elsewhere.
confirmation: it should only be changeable by Admin or Integration.
extension_attributes.is_subscribed: this one should only be changeable by unsubscribe link?

Additional:
disable_auto_group_change and confirmation should not be visible in Customer User Context WebAPI output.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Ready for Grooming

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions