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

agentic-dev-library / thumbcode / 21933635344

12 Feb 2026 04:31AM UTC coverage: 28.282% (-0.09%) from 28.372%
21933635344

Pull #120

github

web-flow
Merge 85853f9b5 into 82c88cdf1
Pull Request #120: fix(quality): SonarCloud bug, code smells, Readonly props

388 of 2123 branches covered (18.28%)

Branch coverage included in aggregate %.

1 of 40 new or added lines in 9 files covered. (2.5%)

2 existing lines in 2 files now uncovered.

1038 of 2919 relevant lines covered (35.56%)

8.06 hits per line

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

2.86
/packages/core/src/api/api.ts
1
/**
2
 * Secure API Client
3
 *
4
 * A wrapper around the global fetch function that adds request signing
5
 * for all calls to the MCP server.
6
 */
7
import { requestSigningService } from '../security/RequestSigningService';
8

9
const MCP_SERVER_HOST = 'mcp.thumbcode.com'; // Replace with actual host
3✔
10

11
export async function secureFetch(
12
  input: RequestInfo | URL,
13
  init?: RequestInit
14
): Promise<Response> {
15
  let url: string;
NEW
16
  if (typeof input === 'string') {
×
NEW
17
    url = input;
×
NEW
18
  } else if (input instanceof URL) {
×
NEW
19
    url = input.href;
×
20
  } else {
NEW
21
    url = input.url;
×
22
  }
23

24
  // Securely validate the hostname to prevent subdomain attacks
25
  // Only match exact hostname OR legitimate subdomains (prefixed with '.')
26
  const hostname = new URL(url).hostname;
×
27
  const isValidMcpHost =
28
    hostname === MCP_SERVER_HOST || hostname.endsWith(`.${MCP_SERVER_HOST}`);
×
29

30
  if (isValidMcpHost) {
×
31
    const method = init?.method?.toUpperCase() || 'GET';
×
32
    let body: string | undefined;
NEW
33
    if (!init?.body) {
×
NEW
34
      body = undefined;
×
NEW
35
    } else if (typeof init.body === 'string') {
×
NEW
36
      body = init.body;
×
37
    } else {
NEW
38
      body = JSON.stringify(init.body);
×
39
    }
40

41
    const signingHeaders = await requestSigningService.signRequest(url, method, body);
×
42

43
    if (signingHeaders) {
×
44
      init = {
×
45
        ...init,
46
        headers: {
47
          ...init?.headers,
48
          ...signingHeaders,
49
        },
50
      };
51
    }
52
  }
53

54
  return fetch(input, init);
×
55
}
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