puresec / FunctionShield

A Serverless Security Library for Developers. Regain Control Over Your AWS Lambda & Google Cloud Functions Runtimes.
Other
39 stars 12 forks source link

Couldn't switch the policy back to 'alert' mode #7

Closed aravindraj29 closed 5 years ago

aravindraj29 commented 5 years ago

I have added the function shield using Java in the static block of the handler. Configured the policy initially with 'block' mode and then changed it to 'alert' in a specific portion of code. But, it was not reflected. Still, seeing the 'block' mode error. Any idea about this issue?

0xh0b0 commented 5 years ago

In FunctionShield v2 we added additional parameter cookie to handle #3.

...
public class Handler implements RequestHandler<Map<String, Object>, String> {

    static final int cookie = FunctionShield.configure(new JSONObject()
            .put("policy", new JSONObject()
                .put("read_write_tmp", "block")
                .put("create_child_process", "block")
                .put("outbound_connectivity", "block")
                .put("read_handler", "block"))
            .put("token", System.getenv("FUNCTION_SHIELD_TOKEN"))
            .put("disable_analytics", true));

    @Override
    public String handleRequest(Map<String, Object> input, Context context) {
           FunctionShield.configure(new JSONObject()
              .put("policy", new JSONObject()
                 .put("outbound_connectivity", "alert")
              .put("cookie", cookie));
           ...