🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@codefresh-io/ssrf-safe

Package Overview
Dependencies
Maintainers
24
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codefresh-io/ssrf-safe

Ssrf check for requests

latest
npmnpm
Version
0.1.0
Version published
Maintainers
24
Created
Source

ssrf-safe

nodejs lib for SSRF safe request and filter

Example for GET

Modify code:

    try {
        return await request({
            method: 'GET',
            uri,
        });
    } catch (cause) {
    throw new NotFoundError({ cause });
}

By adding options

    const { requestSsrfOptions } = require('@codefresh-io/ssrf-safe');
    const options = requestSsrfOptions({ url: uri });
    try {
        return await request({
            method: 'GET',
            ...options
        });
    } catch (cause) {
        throw new NotFoundError({ cause });
    }

Example generic

add filter agent to the options

const options = { uri };
        try {
            return await request(
              requestSsrfOptions({ options })
            );
        } catch (cause) {
            throw new NotFoundError({ cause });
        }

Using logs

const options = { uri };
        try {
            return await request(
              requestSsrfOptions({ options })
            );
        } catch (cause) {
            logSsrfError(err, logger.warning);
            throw new NotFoundError({ cause });
        }

FAQs

Package last updated on 16 Feb 2022

Did you know?

Socket

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.

Install

Related posts