Skip to content

[RQ-737]: Skip SSL Verification#308

Open
TejaChitturi wants to merge 3 commits intomasterfrom
RQ-737-desktop
Open

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

Conversation

@TejaChitturi
Copy link
Copy Markdown

@TejaChitturi TejaChitturi commented Mar 18, 2026

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

Summary by CodeRabbit

  • New Features
    • Added an option to disable SSL certificate verification for API requests.
    • Improved handling of connections when SSL verification is disabled, with special-case behavior for localhost addresses and adjusted handling for external hosts.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e87824e9-980e-44ef-8130-fdf0258b9a04

📥 Commits

Reviewing files that changed from the base of the PR and between d3af357 and aae9c99.

📒 Files selected for processing (1)
  • src/main/actions/getProxiedAxios.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/actions/getProxiedAxios.ts

Walkthrough

Threads an sslVerificationDisabled flag from makeApiClientRequest.js into proxied Axios requests. Updates the Axios request interceptor to: derive port from url or protocol when missing; for localhost targets continue using custom lookup-based http/https agents with httpsAgent.rejectUnauthorized set to (sslVerificationDisabled !== true); for non-localhost targets set httpsAgent to rejectUnauthorized: false when sslVerificationDisabled is truthy. Also includes minor formatting/comment tweaks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 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 title clearly summarizes the main change: implementing SSL verification skipping functionality across the request handling pipeline.

✏️ 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

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
Copy Markdown

@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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Copy link
Copy Markdown

@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.

♻️ Duplicate comments (1)
src/main/actions/getProxiedAxios.ts (1)

132-135: ⚠️ Potential issue | 🟠 Major

Inconsistent boolean check for sslVerificationDisabled.

Line 116 uses the strict check sslVerificationDisabled !== true, but line 132 uses a truthy check. This inconsistency means localhost and non-localhost paths have different thresholds for disabling SSL verification. For security-critical TLS decisions, use explicit === true consistently.

Additionally, the comment and code on lines 133-134 have extra indentation.

🔧 Proposed fix
-      } else if (sslVerificationDisabled) {
-          // Handle standard web requests where SSL is bypassed
-        requestConfig.httpsAgent = new https.Agent({ rejectUnauthorized: false });
+      } else if (sslVerificationDisabled === true) {
+        // Handle standard web requests where SSL is bypassed
+        requestConfig.httpsAgent = new https.Agent({ rejectUnauthorized: false });
       }
🤖 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 132 - 135, The boolean
check for sslVerificationDisabled is inconsistent — change the truthy check to
an explicit comparison (sslVerificationDisabled === true) when setting
requestConfig.httpsAgent so TLS behavior matches the earlier strict check
(sslVerificationDisabled !== true) and avoid accidental truthy values like
non-empty strings; also remove the extra indentation before the comment and the
requestConfig.httpsAgent assignment to align formatting. Locate the logic that
sets requestConfig.httpsAgent (uses https.Agent) and update the condition and
indentation accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/main/actions/getProxiedAxios.ts`:
- Around line 132-135: The boolean check for sslVerificationDisabled is
inconsistent — change the truthy check to an explicit comparison
(sslVerificationDisabled === true) when setting requestConfig.httpsAgent so TLS
behavior matches the earlier strict check (sslVerificationDisabled !== true) and
avoid accidental truthy values like non-empty strings; also remove the extra
indentation before the comment and the requestConfig.httpsAgent assignment to
align formatting. Locate the logic that sets requestConfig.httpsAgent (uses
https.Agent) and update the condition and indentation accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c9caaa35-c437-41ab-9e90-a6c102692dae

📥 Commits

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

📒 Files selected for processing (2)
  • src/main/actions/getProxiedAxios.ts
  • src/main/actions/makeApiClientRequest.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/actions/makeApiClientRequest.js

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