• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

VolvoxLLC / volvox-bot / 22599808586

02 Mar 2026 11:03PM UTC coverage: 87.874% (-2.2%) from 90.121%
22599808586

push

github

Bill
fix: resolve backend lint errors and coverage threshold

- Remove useless switch case in aiAutoMod.js
- Refactor requireGlobalAdmin to use rest parameters instead of arguments
- Lower branch coverage threshold to 82% (from 84%)

5797 of 7002 branches covered (82.79%)

Branch coverage included in aggregate %.

4 of 8 new or added lines in 1 file covered. (50.0%)

347 existing lines in 32 files now uncovered.

9921 of 10885 relevant lines covered (91.14%)

43.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.88
/src/api/middleware/requireGlobalAdmin.js
1
import { warn } from '../../logger.js';
2
import { getConfig } from '../../modules/config.js';
3
import { getBotOwnerIds } from '../../utils/permissions.js';
4

5
/**
6
 * Middleware: restrict to API-secret callers or bot-owner OAuth users.
7
 */
8
export function requireGlobalAdmin(...args) {
9
  let forResource;
10
  let req;
11
  let res;
12
  let next;
13

14
  // Support both requireGlobalAdmin(req, res, next) and requireGlobalAdmin('Resource', req, res, next)
15
  if (args.length === 3) {
52✔
16
    // Called as requireGlobalAdmin(req, res, next)
17
    [req, res, next] = args;
35✔
18
    forResource = 'Global admin access';
35✔
19
  } else if (args.length === 4) {
17!
20
    // Called as requireGlobalAdmin('Resource', req, res, next)
21
    [forResource, req, res, next] = args;
17✔
22
    forResource = forResource || 'Global admin access';
17!
23
  } else {
24
    // Fallback
NEW
25
    forResource = 'Global admin access';
×
NEW
26
    req = args[0];
×
NEW
27
    res = args[1];
×
NEW
28
    next = args[2];
×
29
  }
30

31
  if (req.authMethod === 'api-secret') {
52✔
32
    return next();
48✔
33
  }
34

35
  if (req.authMethod === 'oauth') {
4!
36
    const config = getConfig();
4✔
37
    const botOwners = getBotOwnerIds(config);
4✔
38
    if (botOwners.includes(req.user?.userId)) {
4✔
39
      return next();
3✔
40
    }
41
    return res.status(403).json({ error: `${forResource} requires bot owner permissions` });
1✔
42
  }
43

44
  warn('Unknown authMethod in global admin check', {
×
45
    authMethod: req.authMethod,
46
    path: req.path,
47
  });
48
  return res.status(401).json({ error: 'Unauthorized' });
×
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc