apache / apache/shenyu

[BUG] AppAuthServiceImpl.updateDetail uses full UPDATE and NULLs out phone/userId/extInfo

Open Beginner friendly
#6,538 1 comment 0 reactions 0 assignees View on GitHub
admin priority: high type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
`updateDetail` calls `appAuthMapper.update(appAuthDO)` where the DO is mapped straight from the DTO. The `update` SQL is a *full* update: `SET app_key=?, app_secret=?, phone=?, user_id=?, ext_info=?, open=?, enabled=?`. In `AppAuthDTO`, `phone`/`userId`/`extInfo` have no `@NotNull`, so any field the client omits becomes null on the DO and is written as `NULL`. Every other update path (`createOrUpdate`, `modifyPassword`) correctly uses `updateSelective`.

## Location
```
shenyu-admin/.../service/impl/AppAuthServiceImpl.java:184
SQL at shenyu-admin/src/main/resources/mappers/app-auth-sqlmap.xml:251-262
```

## Impact
`phone`, `user_id`, `ext_info` are silently wiped. The published `DataChangedEvent(UPDATE)` carries the already-nullified entity, so the gateway also receives the wrong data.

## Suggested fix
Use `appAuthMapper.updateSelective(appAuthDO)`, or merge the existing record's `phone/userId/extInfo` before the full `update`.

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Read AppAuthServiceImpl.java around line 184 and compare the mapper calls with the update SQL in app-auth-sqlmap.xml lines 251-262. Verify that an update omitting phone, userId, or extInfo preserves their stored values and that the published UPDATE event carries the preserved entity.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
backend, database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.