FunctionShield icon indicating copy to clipboard operation
FunctionShield copied to clipboard

What prevents Malicious code from disabling Function Shield?

Open nat-e opened this issue 7 years ago • 1 comments

As it seems you're allowed to call FunctionShield.configure multiple times, what prevents Malicious code from re-allowing accesses before trying to make outbound network calls?

nat-e avatar Mar 16 '19 10:03 nat-e

In FunctionShield v2.0.0 you need to add an additional parameter cookie to any subsequent call to FunctionShield.configure

const FunctionShield = require("@puresec/function-shield");
const got = require("got");
const cookie = FunctionShield.configure({
    policy: {
        outbound_connectivity: "block",
        read_write_tmp: "block",
        create_child_process: "block",
        read_handler: "block"
    },
    token: process.env.FUNCTION_SHIELD_TOKEN
});

exports.hello = async (event) => {
    ...
    FunctionShield.configure({
        cookie: cookie,
        policy: {
            outbound_connectivity: "allow"
        }
    });

    const response = await got("https://api.company.com/users");

    FunctionShield.configure({
        cookie: cookie,
        policy: {
            outbound_connectivity: "block"
        }
    });
    ...
};

0xh0b0 avatar Jun 20 '19 06:06 0xh0b0