Skip to content

[RQ-737]: Skip SSL Verification#308

Open
TejaChitturi wants to merge 1 commit intomasterfrom
RQ-737-desktop
Open

[RQ-737]: Skip SSL Verification#308
TejaChitturi wants to merge 1 commit intomasterfrom
RQ-737-desktop

Conversation

@TejaChitturi
Copy link

@TejaChitturi TejaChitturi commented Mar 18, 2026

https://browserstack.atlassian.net/browse/RQ-737

Summary by CodeRabbit

  • New Features
    • Added support for disabling SSL certificate verification for API requests. When enabled, this feature allows the application to establish connections to servers with invalid or self-signed certificates. This capability is designed to facilitate development and testing scenarios where certificate validation may not be available or needed.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Walkthrough

This PR introduces an SSL verification bypass mechanism controlled by a sslVerificationDisabled flag. When enabled through a proxy, it creates a proxy agent with rejectUnauthorized: false. For non-proxy paths, the flag is passed to configure the https agent appropriately, with special handling for localhost requests that preserves existing IP interception logic. The flag is threaded from makeApiClientRequest.js into the axios request options so the interceptor can access it.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • wrongsahil
  • nsrCodes
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately reflects the main change: adding a mechanism to skip SSL verification through a new sslVerificationDisabled flag in the axios configuration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch RQ-737-desktop
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/actions/getProxiedAxios.ts`:
- Around line 95-97: The request interceptor uses loose truthy checks on
requestConfig.sslVerificationDisabled (in instance.interceptors.request.use and
the similar branches at the other occurrences) which can accidentally disable
TLS verification; change those conditions to an explicit boolean comparison
(requestConfig.sslVerificationDisabled === true) and, where possible, narrow the
type of requestConfig (or cast to a known ApiRequest shape) before checking to
ensure type-safety for the properties used on lines referencing
sslVerificationDisabled (e.g., in the request interceptor and the blocks at the
other occurrences).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 722100dc-1c74-45cb-aae7-78e044d7ac92

📥 Commits

Reviewing files that changed from the base of the PR and between f5d6154 and edebecd.

📒 Files selected for processing (2)
  • src/main/actions/getProxiedAxios.ts
  • src/main/actions/makeApiClientRequest.js

Comment on lines +95 to +97
instance.interceptors.request.use((requestConfig: any) => {
if (requestConfig.sslVerificationDisabled) {
requestConfig.httpsAgent = new PatchedHttpsProxyAgent({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== All references to sslVerificationDisabled (with context) ==="
rg -n -C2 '\bsslVerificationDisabled\b' --type ts --type js

echo
echo "=== Potential non-boolean assignments in object literals ==="
rg -nP --type ts --type js 'sslVerificationDisabled\s*:\s*(["`\x27].*["`\x27]|[0-9]+|null|undefined)\b'

echo
echo "=== Type declarations mentioning sslVerificationDisabled ==="
rg -n --type ts 'sslVerificationDisabled\s*[:?]\s*boolean'

Repository: requestly/requestly-desktop-app

Length of output: 2235


🏁 Script executed:

# Read the context around makeApiClientRequest.js where sslVerificationDisabled is assigned
cat -n src/main/actions/makeApiClientRequest.js | head -120 | tail -30

Repository: requestly/requestly-desktop-app

Length of output: 1202


🏁 Script executed:

# Search for interface/type definitions of sslVerificationDisabled
rg -n --type ts 'sslVerificationDisabled' -B2 -A2 | grep -E '(interface|type|declare|:|\?)'

Repository: requestly/requestly-desktop-app

Length of output: 859


🏁 Script executed:

# Look at the full context of getProxiedAxios.ts to understand the requestConfig type
head -200 src/main/actions/getProxiedAxios.ts | tail -100

Repository: requestly/requestly-desktop-app

Length of output: 3082


🏁 Script executed:

# Search for where apiRequest parameter comes from in makeApiClientRequest.js
rg -n --type js 'export|function makeApiClientRequest|const makeApiClientRequest' src/main/actions/makeApiClientRequest.js -A 10

Repository: requestly/requestly-desktop-app

Length of output: 565


🏁 Script executed:

# Find where makeApiClientRequest is called
rg -n 'makeApiClientRequest' --type ts --type js -B2 -A2

Repository: requestly/requestly-desktop-app

Length of output: 1210


🏁 Script executed:

# Search for interface definitions for apiRequest or similar request structures
rg -n 'interface.*Request|type.*Request' --type ts | head -30

Repository: requestly/requestly-desktop-app

Length of output: 259


🏁 Script executed:

# Check if sslVerificationDisabled comes from JSON parsing or external sources
rg -n 'JSON.parse|IPC|ipcMain|ipcRenderer|sslVerificationDisabled' --type ts --type js | grep -E '(JSON.parse|IPC|sslVerificationDisabled)' | head -20

Repository: requestly/requestly-desktop-app

Length of output: 2150


🏁 Script executed:

# Look for where the request object structure is defined or used
rg -n 'sslVerificationDisabled.*:' --type ts --type js -B2 -A2

Repository: requestly/requestly-desktop-app

Length of output: 508


🏁 Script executed:

# Find the ApiRequest type definition
fd -e ts -e tsx | xargs rg -l 'type ApiRequest|interface ApiRequest'

Repository: requestly/requestly-desktop-app

Length of output: 59


🏁 Script executed:

# Read the type definition file
cat -n src/renderer/actions/local-sync/types.ts | grep -A 20 'ApiRequest'

Repository: requestly/requestly-desktop-app

Length of output: 1394


🏁 Script executed:

# Check if there's validation before calling makeApiClientRequest in events.js
sed -n '190,210p' src/main/events.js

Repository: requestly/requestly-desktop-app

Length of output: 617


🏁 Script executed:

# Test actual JSON serialization behavior with boolean
node -e "console.log(JSON.stringify({a: true, b: false})); console.log(JSON.parse(JSON.stringify({a: true, b: false})))"

Repository: requestly/requestly-desktop-app

Length of output: 117


🏁 Script executed:

# Find the schemas file
fd -name "schemas*" --type f

Repository: requestly/requestly-desktop-app

Length of output: 305


🏁 Script executed:

# Search for sslVerificationDisabled in all files to find where it's defined
rg -n 'sslVerificationDisabled' --type ts --type js -B5 -A2 | grep -E '(type |interface |:.*boolean|: \{)' -A 3

Repository: requestly/requestly-desktop-app

Length of output: 57


🏁 Script executed:

# Check if there's runtime validation/schema enforcement
rg -n 'zod|joi|ajv|schema.*validate|validate.*schema' --type ts --type js | head -20

Repository: requestly/requestly-desktop-app

Length of output: 2284


🏁 Script executed:

# Find the schemas file with correct fd syntax
fd schemas --type f

Repository: requestly/requestly-desktop-app

Length of output: 117


🏁 Script executed:

# Search for schemas.ts specifically
find . -name "schemas.ts" -o -name "schemas.js"

Repository: requestly/requestly-desktop-app

Length of output: 119


🏁 Script executed:

# Look for where ApiRequest schema is defined
rg 'export.*ApiRequest' --type ts --type js

Repository: requestly/requestly-desktop-app

Length of output: 186


🏁 Script executed:

# Check if there's any type definition at all for sslVerificationDisabled
rg 'sslVerificationDisabled' --type ts -B 10 | head -50

Repository: requestly/requestly-desktop-app

Length of output: 3319


🏁 Script executed:

# Read the full schemas.ts file to see HttpRequest and GraphQLRequest definitions
cat src/renderer/actions/local-sync/schemas.ts

Repository: requestly/requestly-desktop-app

Length of output: 4839


🏁 Script executed:

# Check if sslVerificationDisabled is used anywhere else in the codebase
rg -n 'sslVerificationDisabled' --type ts --type js

Repository: requestly/requestly-desktop-app

Length of output: 569


🏁 Script executed:

# Look for any validation or enforcement of the ApiRequest schema
rg -n 'ApiRequest.*validate|validate.*ApiRequest' --type ts --type js

Repository: requestly/requestly-desktop-app

Length of output: 57


Use explicit boolean checks for sslVerificationDisabled in security-critical TLS decisions.

sslVerificationDisabled is not defined in the ApiRequest schema and is accessed without type safety on lines 96, 113, 136, and 149. The truthy/falsy checks on an any-typed requestConfig can mishandle non-boolean values or omitted properties, unintentionally disabling certificate validation. Use explicit === true comparison instead.

🔧 Proposed fix
    instance.interceptors.request.use((requestConfig: any) => {
+      const disableSslVerification = requestConfig.sslVerificationDisabled === true;
-      if (requestConfig.sslVerificationDisabled) {
+      if (disableSslVerification) {
         requestConfig.httpsAgent = new PatchedHttpsProxyAgent({
           host: config.ip,
           port: config.port,
           ca: readFileSync(config.rootCertPath),
           rejectUnauthorized: false,
         });
       }
       return requestConfig;
     });

     instance.interceptors.request.use(async (requestConfig: any) => {
-      const { url: requestUrl, sslVerificationDisabled } = requestConfig;
+      const { url: requestUrl } = requestConfig;
+      const disableSslVerification = requestConfig.sslVerificationDisabled === true;

       if (isLocalhost) {
         const lookup = await createLocalhostLookup(port);
         requestConfig.httpAgent = new http.Agent({ lookup });
         requestConfig.httpsAgent = new https.Agent({
           lookup,
-          rejectUnauthorized: !sslVerificationDisabled
+          rejectUnauthorized: !disableSslVerification
         });
-      } else if (sslVerificationDisabled) {
+      } else if (disableSslVerification) {
         requestConfig.httpsAgent = new https.Agent({ rejectUnauthorized: false });
       }

Also applies to: 136, 149

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/actions/getProxiedAxios.ts` around lines 95 - 97, The request
interceptor uses loose truthy checks on requestConfig.sslVerificationDisabled
(in instance.interceptors.request.use and the similar branches at the other
occurrences) which can accidentally disable TLS verification; change those
conditions to an explicit boolean comparison
(requestConfig.sslVerificationDisabled === true) and, where possible, narrow the
type of requestConfig (or cast to a known ApiRequest shape) before checking to
ensure type-safety for the properties used on lines referencing
sslVerificationDisabled (e.g., in the request interceptor and the blocks at the
other occurrences).

// Preserve SSL bypass flag alongside localhost lookup logic
requestConfig.httpsAgent = new https.Agent({
lookup,
rejectUnauthorized: !sslVerificationDisabled
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the documentation of this config and the nuances of using it in the PR description

Comment on lines +93 to +105

// Interceptor to disable SSL securely when Proxy is enabled
instance.interceptors.request.use((requestConfig: any) => {
if (requestConfig.sslVerificationDisabled) {
requestConfig.httpsAgent = new PatchedHttpsProxyAgent({
host: config.ip,
port: config.port,
ca: readFileSync(config.rootCertPath),
rejectUnauthorized: false,
});
}
return requestConfig;
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this scope is currently not triggered, so are these changes necessary? could you please confirm?

Comment on lines 112 to +151
@@ -115,7 +129,12 @@ function createAxiosInstance(

const lookup = await createLocalhostLookup(port);
requestConfig.httpAgent = new http.Agent({ lookup });
requestConfig.httpsAgent = new https.Agent({ lookup });

// Preserve SSL bypass flag alongside localhost lookup logic
requestConfig.httpsAgent = new https.Agent({
lookup,
rejectUnauthorized: !sslVerificationDisabled
});

// Node.js skips DNS lookup for raw IP literals, so the custom lookup
// above has no effect. Rewrite the URL to the concrete working IP.
@@ -127,6 +146,9 @@ function createAxiosInstance(
requestConfig.url = requestUrl.replace(hostname, targetIp);
}
}
} else if (sslVerificationDisabled) {
// Handle standard web requests where SSL is bypassed
requestConfig.httpsAgent = new https.Agent({ rejectUnauthorized: false });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that we have two things affecting the https agent config, can we structure this code better to be readable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed further on call

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a compatibility flag + a release plan

because even though the IPC call seems safe across version, we wouldn't want to show the feature on versions where the functionality isn't enforced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants