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

mongodb-js / devtools-shared / 14489071719

16 Apr 2025 09:12AM CUT coverage: 72.282%. First build
14489071719

Pull #528

github

gagik
docs: add keywords and versioning
Pull Request #528: docs: better naming and description for native-machine-id

1452 of 2277 branches covered (63.77%)

Branch coverage included in aggregate %.

3083 of 3997 relevant lines covered (77.13%)

634.5 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