feat: registerAuthWhitelist 强制增加插件名前缀

避免越权申请白名单的问题(表面防止)
pull/64/head
moonrailgun 3 years ago
parent 8e4908fced
commit 56387371ab

@ -285,15 +285,15 @@ export abstract class TcService extends Service {
/**
* token
* @param urls
* @example "/user/login"
* @param urls serviceName
* @example "/login"
*/
registerAuthWhitelist(urls: string[]) {
this.waitForServices('gateway').then(() => {
this.broker.broadcast(
'gateway.auth.addWhitelists',
{
urls,
urls: urls.map((url) => `/${this.serviceName}${url}`),
},
'gateway'
);

@ -48,9 +48,7 @@ class GithubSubscribeService extends TcService {
});
this.registerAction('webhook.callback', this.webhookHandler);
this.registerAuthWhitelist([
'/plugin:com.msgbyte.github.subscribe/webhook/callback',
]);
this.registerAuthWhitelist(['/webhook/callback']);
}
protected onInited(): void {

@ -68,7 +68,7 @@ class PrettyinviteService extends TcService {
},
});
this.registerAuthWhitelist(['/plugin:com.msgbyte.prettyinvite/badge']);
this.registerAuthWhitelist(['/badge']);
}
async badge(

@ -58,9 +58,7 @@ class SimpleNotifyService extends TcService {
},
});
this.registerAuthWhitelist([
'/plugin:com.msgbyte.simplenotify/webhook/callback',
]);
this.registerAuthWhitelist(['/webhook/callback']);
}
protected onInited(): void {

@ -42,7 +42,7 @@ class ConfigService extends TcService {
},
});
this.registerAuthWhitelist(['/config/client']);
this.registerAuthWhitelist(['/client']);
}
/**

@ -201,7 +201,7 @@ class UserService extends TcService {
visibility: 'public',
});
this.registerAuthWhitelist(['/user/forgetPassword', '/user/resetPassword']);
this.registerAuthWhitelist(['/forgetPassword', '/resetPassword']);
}
/**

@ -24,7 +24,7 @@ class OpenBotService extends TcService {
visibility: 'public',
});
this.registerAuthWhitelist(['/openapi/bot/login']);
this.registerAuthWhitelist(['/bot/login']);
}
/**

Loading…
Cancel
Save