-
Notifications
You must be signed in to change notification settings - Fork 6k
Feature/quote message n8n #2238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,6 @@ | ||||||||||||||
| import { HttpsProxyAgent } from 'https-proxy-agent'; | ||||||||||||||
| import { SocksProxyAgent } from 'socks-proxy-agent'; | ||||||||||||||
|
|
||||||||||||||
| import { ProxyAgent } from 'undici' | ||||||||||||||
| import { ProxyAgent } from 'undici'; | ||||||||||||||
|
|
||||||||||||||
| type Proxy = { | ||||||||||||||
| host: string; | ||||||||||||||
|
|
@@ -46,38 +45,38 @@ | |||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| export function makeProxyAgentUndici(proxy: Proxy | string): ProxyAgent { | ||||||||||||||
| let proxyUrl: string | ||||||||||||||
| let protocol: string | ||||||||||||||
| let proxyUrl: string; | ||||||||||||||
| let protocol: string; | ||||||||||||||
|
|
||||||||||||||
| if (typeof proxy === 'string') { | ||||||||||||||
| const url = new URL(proxy) | ||||||||||||||
| protocol = url.protocol.replace(':', '') | ||||||||||||||
| proxyUrl = proxy | ||||||||||||||
| const url = new URL(proxy); | ||||||||||||||
| protocol = url.protocol.replace(':', ''); | ||||||||||||||
| proxyUrl = proxy; | ||||||||||||||
| } else { | ||||||||||||||
| const { host, password, port, protocol: proto, username } = proxy | ||||||||||||||
| protocol = (proto || 'http').replace(':', '') | ||||||||||||||
| const { host, password, port, protocol: proto, username } = proxy; | ||||||||||||||
Check failureCode scanning / CodeQL Insecure randomness High
This uses a cryptographically insecure random number generated at
Math.random() Error loading related location Loading Check failureCode scanning / CodeQL Insecure randomness High
This uses a cryptographically insecure random number generated at
Math.random() Error loading related location Loading Check failureCode scanning / CodeQL Insecure randomness High
This uses a cryptographically insecure random number generated at
Math.random() Error loading related location Loading Check failureCode scanning / CodeQL Insecure randomness High
This uses a cryptographically insecure random number generated at
Math.random() Error loading related location Loading |
||||||||||||||
| protocol = (proto || 'http').replace(':', ''); | ||||||||||||||
|
|
||||||||||||||
| if (protocol === 'socks') { | ||||||||||||||
| protocol = 'socks5' | ||||||||||||||
| protocol = 'socks5'; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| const auth = username && password ? `${username}:${password}@` : '' | ||||||||||||||
| proxyUrl = `${protocol}://${auth}${host}:${port}` | ||||||||||||||
| const auth = username && password ? `${username}:${password}@` : ''; | ||||||||||||||
| proxyUrl = `${protocol}://${auth}${host}:${port}`; | ||||||||||||||
|
Comment on lines
+75
to
+76
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Authentication string construction may not handle special characters in username or password. Encoding the username and password will prevent malformed URLs when special characters are present.
Suggested change
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| const PROXY_HTTP_PROTOCOL = 'http' | ||||||||||||||
| const PROXY_HTTPS_PROTOCOL = 'https' | ||||||||||||||
| const PROXY_SOCKS4_PROTOCOL = 'socks4' | ||||||||||||||
| const PROXY_SOCKS5_PROTOCOL = 'socks5' | ||||||||||||||
| const PROXY_HTTP_PROTOCOL = 'http'; | ||||||||||||||
| const PROXY_HTTPS_PROTOCOL = 'https'; | ||||||||||||||
| const PROXY_SOCKS4_PROTOCOL = 'socks4'; | ||||||||||||||
| const PROXY_SOCKS5_PROTOCOL = 'socks5'; | ||||||||||||||
|
|
||||||||||||||
| switch (protocol) { | ||||||||||||||
| case PROXY_HTTP_PROTOCOL: | ||||||||||||||
| case PROXY_HTTPS_PROTOCOL: | ||||||||||||||
| case PROXY_SOCKS4_PROTOCOL: | ||||||||||||||
| case PROXY_SOCKS5_PROTOCOL: | ||||||||||||||
| return new ProxyAgent(proxyUrl) | ||||||||||||||
| return new ProxyAgent(proxyUrl); | ||||||||||||||
|
|
||||||||||||||
| default: | ||||||||||||||
| throw new Error(`Unsupported proxy protocol: ${protocol}`) | ||||||||||||||
| throw new Error(`Unsupported proxy protocol: ${protocol}`); | ||||||||||||||
|
Comment on lines
105
to
+109
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Error message could include the original input for better debugging. Adding the full proxy input to the error message will make it easier to diagnose issues with malformed or unexpected input.
Suggested change
|
||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
Check failure
Code scanning / CodeQL
Insecure randomness High