refactor(quickconnect): validate secret length and format in quick connect check

This commit is contained in:
fallenbagel
2025-12-13 09:33:31 +08:00
parent 4aac476137
commit 655e1f2708

View File

@@ -623,10 +623,16 @@ authRoutes.post('/jellyfin/quickconnect/initiate', async (req, res, next) => {
authRoutes.get('/jellyfin/quickconnect/check', async (req, res, next) => {
const secret = req.query.secret as string;
if (!secret || typeof secret !== 'string') {
if (
!secret ||
typeof secret !== 'string' ||
secret.length < 8 ||
secret.length > 128 ||
!/^[A-Za-z0-9]+$/.test(secret)
) {
return next({
status: 400,
message: 'Secret required',
message: 'Invalid secret',
});
}