Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@adobe/aio-lib-core-networking
Advanced tools
$ npm install @adobe/aio-lib-core-networking
const { HttpExponentialBackoff, createFetch } = require('@adobe/aio-lib-core-networking')
const fetchRetry = new HttpExponentialBackoff()
const proxyFetch = createFetch()
const { HttpExponentialBackoff, createFetch } = require('@adobe/aio-lib-core-networking')
const fetchRetry = new HttpExponentialBackoff()
async function sdkTest() {
return new Promise((resolve, reject) => {
fetchRetry.exponentialBackoff(url, requestOptions, retryOptions, retryOn, retryDelay)
.then((response) => {
if (!response.ok) {
throw Error(reduceError(response))
}
resolve(response.json())
})
.catch(err => {
reject(
new codes.ERROR_GET_SOMETHING({ sdkDetails, messageValues: err }))
})
})
}
let proxyFetch
// this will get the proxy settings from the the HTTP_PROXY or HTTPS_PROXY environment variables, if set
proxyFetch = createFetch()
// this will use the passed in proxy settings. Embed basic auth in the url, if required
proxyFetch = createFetch({ proxyUrl: 'http://my.proxy:8080' })
// if the proxy settings are not passed in, and not available in the HTTP_PROXY or HTTPS_PROXY environment variables, it falls back to a simple fetch
const simpleFetch = createFetch()
This class provides methods to implement fetch with retries. The retries use exponential backoff strategy with defaults set to max of 3 retries and initial Delay as 100ms
This provides a wrapper for fetch that facilitates proxy auth authorization.
function
Return the appropriate Fetch function depending on proxy settings.
number
Parse the Retry-After header Spec: https://tools.ietf.org/html/rfc7231#section-7.1.3
object
Fetch Retry Options
object
Proxy Auth Options
This class provides methods to implement fetch with retries. The retries use exponential backoff strategy with defaults set to max of 3 retries and initial Delay as 100ms
Promise.<Response>
This function will retry connecting to a url end-point, with exponential backoff. Returns a Promise.
Kind: instance method of HttpExponentialBackoff
Returns: Promise.<Response>
- Promise object representing the http response
Param | Type | Description |
---|---|---|
url | string | endpoint url |
requestOptions | object | Request | request options |
[retryOptions] | RetryOptions | (optional) retry options |
[retryOn] | function | Array | (optional) Function or Array. If provided, will be used instead of the default |
[retryDelay] | function | number | (optional) Function or number. If provided, will be used instead of the default |
This provides a wrapper for fetch that facilitates proxy auth authorization.
Kind: global class
Promise.<Response>
Initialize this class with Proxy auth options
Param | Type | Description |
---|---|---|
proxyAuthOptions | ProxyAuthOptions | the auth options to connect with |
Promise.<Response>
Fetch function, using the configured NTLM Auth options.
Kind: instance method of ProxyFetch
Returns: Promise.<Response>
- Promise object representing the http response
Param | Type | Description |
---|---|---|
resource | string | Request | the url or Request object to fetch from |
options | object | the fetch options |
function
Return the appropriate Fetch function depending on proxy settings.
Kind: global function
Returns: function
- the Fetch API function
Param | Type | Description |
---|---|---|
[proxyAuthOptions] | ProxyAuthOptions | the proxy auth options |
number
Parse the Retry-After header Spec: https://tools.ietf.org/html/rfc7231#section-7.1.3
Kind: global function
Returns: number
- Number of milliseconds to sleep until the next call to getEventsFromJournal
Param | Type | Description |
---|---|---|
header | string | Retry-After header value |
object
Fetch Retry Options
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
maxRetries | number | the maximum number of retries to try (default:3) |
initialDelayInMillis | number | the initial delay in milliseconds (default:100ms) |
proxy | ProxyAuthOptions | the (optional) proxy auth options |
object
Proxy Auth Options
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
proxyUrl | string | the proxy's url |
[username] | string | the username for basic auth |
[password] | string | the password for basic auth |
rejectUnauthorized | boolean | set to false to not reject unauthorized server certs |
LOG_LEVEL=debug <your_call_here>
Prepend the LOG_LEVEL
environment variable and debug
value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.
FAQs
Adobe I/O Lib Core Networking
The npm package @adobe/aio-lib-core-networking receives a total of 23,174 weekly downloads. As such, @adobe/aio-lib-core-networking popularity was classified as popular.
We found that @adobe/aio-lib-core-networking demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.