shenyu-dashboard icon indicating copy to clipboard operation
shenyu-dashboard copied to clipboard

[BUG] AuthRoute renders `<Route path={redirectPath} component={null}/>` instead of redirecting when the user lacks permission

Open dengliming opened this issue 2 months ago • 1 comments

Description

In the unauthorized branch of AuthRoute.render, the code returns a <Route> whose path is the redirect target (/exception/403) with a null component. That route never matches the current location, so nothing is rendered; the user is never sent to the 403 page.

Location

(The unauthorized branch is still present in the current snapshot.)

  • src/utils/AuthRoute.js:331-340

Impact

A user who opens a URL for a menu they are not authorized for (e.g. /config/plugin with a restricted role) sees a blank content area with no explanation. The redirectPath prop is effectively dead.

Suggested fix

Return <Redirect to={redirectPath} /> using the router API actually used by this component (dva/router). A standalone React Router v6 <Navigate> is not a drop-in replacement here. Test that an unauthorized URL reaches the 403 view. This is an error-page/navigation defect, not evidence that backend authorization is bypassed.

Related existing

None

Verified source

Rechecked against Dashboard fed203e and, where applicable, ShenYu Admin 31e0c3e on 2026-09-26.

dengliming avatar Sep 24 '26 06:09 dengliming

I'd like to work on this — I'll open a PR shortly.

hussnainahmedd avatar Oct 02 '26 07:10 hussnainahmedd