Skip to content

Commit 0d4ccc3

Browse files
authored
Merge pull request #633 from mini-bomba/fix/dearrow-authorization-order
run dearrow authorization checks after request validation
2 parents 18f95cb + 84b2ecc commit 0d4ccc3

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/routes/postBranding.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ export async function postBranding(req: Request, res: Response) {
5353

5454
try {
5555
const hashedUserID = await getHashCache(userID);
56-
const isVip = await isUserVIP(hashedUserID);
57-
const shouldLock = isVip && autoLock !== false;
58-
const hashedVideoID = await getHashCache(videoID, 1);
59-
const hashedIP = await getHashCache(getIP(req) + config.globalSalt as IPAddress);
60-
const isBanned = await checkBanStatus(hashedUserID, hashedIP);
6156

6257
const matchedRule = isRequestInvalid({
6358
userAgent,
@@ -80,6 +75,12 @@ export async function postBranding(req: Request, res: Response) {
8075
return;
8176
}
8277

78+
const isVip = await isUserVIP(hashedUserID);
79+
const shouldLock = isVip && autoLock !== false;
80+
const hashedVideoID = await getHashCache(videoID, 1);
81+
const hashedIP = await getHashCache(getIP(req) + config.globalSalt as IPAddress);
82+
const isBanned = await checkBanStatus(hashedUserID, hashedIP);
83+
8384
// treat banned users as existing users who "can submit" for the purposes of these checks
8485
// this is to avoid their titles from being logged and them taking up "new user" slots with every submission
8586
const permission = isBanned ? {

0 commit comments

Comments
 (0)