Fix /open/user/init auth bypass allowing credential reset on initialized systems (#2941)

* Initial plan

* fix: add /open/user/init paths to init guard to prevent auth bypass

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Co-authored-by: whyour <imwhyour@gmail.com>
This commit is contained in:
Copilot 2026-03-01 18:02:21 +08:00 committed by GitHub
parent ce599d306f
commit 6bec52dca1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,7 +120,14 @@ export default ({ app }: { app: Application }) => {
app.use(async (req, res, next) => {
const pathLower = req.path.toLowerCase();
if (!['/api/user/init', '/api/user/notification/init'].includes(pathLower)) {
if (
![
'/api/user/init',
'/api/user/notification/init',
'/open/user/init',
'/open/user/notification/init',
].includes(req.path)
) {
return next();
}
const authInfo =