Always check server token for internal APIs

This commit is contained in:
Alex "Mathy 2025-06-28 09:16:22 -05:00 committed by GitHub
parent a50d5dd488
commit 28dedcc14f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1127,6 +1127,7 @@ export const actions: { [k: string]: QueryHandler } = {
},
// sent by ps server
async 'smogon/validate'(params) {
await this.requireMainServer();
if (this.getIp() !== Config.restartip) {
throw new ActionError("Access denied.");
}
@ -1169,6 +1170,7 @@ export const actions: { [k: string]: QueryHandler } = {
},
async 'suspects/add'(params) {
await this.requireMainServer();
if (this.getIp() !== Config.restartip) {
throw new ActionError("Access denied.");
}
@ -1218,6 +1220,7 @@ export const actions: { [k: string]: QueryHandler } = {
return { success: true, url: (out as any).url };
},
async 'suspects/edit'(params) {
await this.requireMainServer();
if (this.getIp() !== Config.restartip) {
throw new ActionError("Access denied.");
}
@ -1253,6 +1256,7 @@ export const actions: { [k: string]: QueryHandler } = {
return { success: true };
},
async 'suspects/end'(params) {
await this.requireMainServer();
if (this.getIp() !== Config.restartip) {
throw new ActionError("Access denied.");
}
@ -1268,6 +1272,7 @@ export const actions: { [k: string]: QueryHandler } = {
return { success: true };
},
async 'suspects/verify'(params) {
await this.requireMainServer();
if (this.getIp() !== Config.restartip) {
throw new ActionError("Access denied.");
}