Skip to content

Commit 01beab5

Browse files
Fixed PR comments
1 parent 4abb2b7 commit 01beab5

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/contentstack-utilities/src/contentstack-management-sdk.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class ManagementSDKInitiator {
4343
proxyConfig = parsedProxy;
4444
} catch (error) {
4545
// If URL parsing fails, ignore proxy config
46+
if (process.env.DEBUG_PROXY === 'true') {
47+
console.log('[PROXY] Failed to parse proxy URL:', error instanceof Error ? error.message : String(error));
48+
}
4649
proxyConfig = undefined;
4750
}
4851
}
@@ -118,13 +121,18 @@ class ManagementSDKInitiator {
118121
option.proxy = proxyConfig;
119122
// Log proxy configuration for debugging (enable with DEBUG_PROXY=true)
120123
if (process.env.DEBUG_PROXY === 'true') {
121-
const safeProxyConfig = { ...proxyConfig };
122-
if (safeProxyConfig.auth) {
123-
safeProxyConfig.auth = {
124-
username: safeProxyConfig.auth.username ? 'REDACTED' : undefined,
125-
password: safeProxyConfig.auth.password ? 'REDACTED' : undefined,
126-
};
127-
}
124+
// Only log non-sensitive proxy information
125+
const safeProxyConfig: any = {
126+
protocol: proxyConfig.protocol,
127+
port: proxyConfig.port,
128+
// Host is redacted as it may contain sensitive internal network information
129+
host: proxyConfig.host ? 'REDACTED' : undefined,
130+
// Auth information is always redacted
131+
auth: proxyConfig.auth ? {
132+
username: proxyConfig.auth.username ? 'REDACTED' : undefined,
133+
password: proxyConfig.auth.password ? 'REDACTED' : undefined,
134+
} : undefined,
135+
};
128136
console.log('[PROXY] Using proxy:', JSON.stringify(safeProxyConfig));
129137
}
130138
} else if (typeof proxyConfig === 'string') {

0 commit comments

Comments
 (0)