apache / apache/shenyu

[BUG] AppAuthServiceImpl.applyUpdate never persists open/enabled/phone/extInfo/userId and gates path-saving on the stale DB open

Open
#6,540 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
`applyUpdate` finds `appAuthDO` by appKey, then conditionally saves `authParam` and `authPath`, and publishes a `CREATE` event built from the *unchanged* entity. It never calls any mapper update, so the DTO's `open`/`enabled`/`phone`/`extInfo`/`userId` are dropped. Worse, the path-save guard uses the **DB** value `appAuthDO.getOpen()` (line 161), while validation (`hasMissingPathsWhenOpen`) uses the **DTO** value `authApplyDTO.getOpen()`. If the DB row has `open=false` and the client applies with `open=true` + paths, validation passes but paths are not saved, and the event carries `open=false`. The `applyCreate` path (built via `AppAuthDO.create(AuthApplyDTO)`) persists all those fields, confirming the asymmetry is a bug.

## Location
```
shenyu-admin/.../service/impl/AppAuthServiceImpl.java:145-178
applyCreate path builds DO via AppAuthDO.create
```

## Impact
Enabling path-level auth via the apply-update flow silently fails; published sync data is stale.

## Suggested fix
Persist the changed fields (`appAuthMapper.updateSelective(...)` built from the DTO), and use `authApplyDTO.getOpen()` for the path-save branch.

## Related existing issue(s)
#6279 (closed) was about the open/enable toggle UI symptom; this is the underlying persistence gap in `applyUpdate`, distinct.

_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

Start in shenyu-admin/.../service/impl/AppAuthServiceImpl.java:145-178 and compare applyUpdate with the AppAuthDO.create(AuthApplyDTO) path used by applyCreate. Trace the mapper update and event publication, then verify that the changed DTO fields persist, paths follow the DTO's open value, and the published data reflects the update.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.