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

mongodb-js / devtools-shared / 14664746835

25 Apr 2025 12:36PM CUT coverage: 72.362% (-0.03%) from 72.39%
14664746835

push

github

mongodb-devtools-bot[bot]
chore(ci): bump packages

1460 of 2285 branches covered (63.89%)

Branch coverage included in aggregate %.

3093 of 4007 relevant lines covered (77.19%)

636.21 hits per line

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

10.26
/packages/devtools-connect/src/oidc/handler.ts
1
import type { RedirectServerRequestInfo } from '@mongodb-js/oidc-plugin';
2
import type { DevtoolsConnectOptions } from '../connect';
1✔
3
import {
2✔
4
  getStaticPage,
1✔
5
  HttpServerPage,
6
} from '@mongodb-js/oidc-http-server-pages';
×
7

×
8
export function oidcServerRequestHandler(
2✔
9
  options: Pick<DevtoolsConnectOptions, 'productDocsLink' | 'productName'>,
×
10
  info: RedirectServerRequestInfo,
×
11
): void {
×
12
  const { productDocsLink, productName } = options;
×
13
  const { res, result, status } = info;
×
14
  res.statusCode = status;
×
15

×
16
  if (result === 'redirecting') {
×
17
    res.setHeader('Location', info.location);
×
18
    res.end();
×
19
    return;
×
20
  }
21

22
  // This CSP is fairly restrictive. Since we are sending static pages only, the security
×
23
  // effects of this are limited, but this is also helpful for verifying that the generated
24
  // pages do not unintentionally rely on external resources (which they should never do).
×
25
  res.setHeader(
×
26
    'Content-Security-Policy',
27
    "default-src 'self'; style-src 'unsafe-inline'",
28
  );
29
  res.setHeader('Content-Type', 'text/html; charset=utf-8');
×
30

31
  switch (result) {
×
32
    case 'accepted':
33
      res.end(
×
34
        getStaticPage(HttpServerPage.OIDCAcceptedPage, {
35
          productDocsLink,
36
          productName,
37
        }),
×
38
      );
39
      break;
×
40
    case 'rejected':
41
      res.end(
×
42
        getStaticPage(HttpServerPage.OIDCErrorPage, {
43
          productDocsLink,
44
          productName,
45
          error: info.error,
46
          errorDescription: info.errorDescription,
47
          errorURI: info.errorURI,
48
        }),
49
      );
50
      break;
×
51
    default:
52
      res.end(
×
53
        getStaticPage(HttpServerPage.OIDCNotFoundPage, {
54
          productDocsLink,
55
          productName,
56
        }),
57
      );
58
      break;
×
59
  }
60
}
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

© 2025 Coveralls, Inc