Recruitment needs `write:admin` and `write:organization`, which the everyday token must not carry. A second token keeps the repository and issue scopes least privileged, falls back to `GITEA_TOKEN` so existing installs keep working, and a 403 now names the missing scope instead of pretending Gitea did not answer.
This commit is contained in:
9 files changed
+141
-34
No files matched your search
@@ -37,6 +37,22 @@ describe('env schema', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps the recruitment token separate and admin-scoped', () => {
|
||||
const token = BY_KEY.GITEA_RECRUITMENT_TOKEN;
|
||||
|
||||
assert.equal(token.type, 'secret');
|
||||
assert.equal(token.testable, 'gitea-recruitment');
|
||||
assert.match(token.help, /write:admin/);
|
||||
assert.match(token.help, /write:organization/);
|
||||
assert.match(token.help, /read:user/);
|
||||
});
|
||||
|
||||
it('warns when a Gitea token has no URL to talk to', () => {
|
||||
const warnings = crossCheck({ GITEA_RECRUITMENT_TOKEN: 'jeton-admin' });
|
||||
|
||||
assert.ok(warnings.some((warning) => warning.includes('GITEA_URL')));
|
||||
});
|
||||
|
||||
it('covers the variables the bot refuses to start without', () => {
|
||||
assert.deepEqual(requiredKeys().sort(), ['DISCORD_CLIENT_ID', 'DISCORD_GUILD_ID', 'DISCORD_TOKEN']);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user