terrylinooo / shieldon

Web Application Firewall (WAF) for PHP.
https://shieldon.io
MIT License
838 stars 96 forks source link

Slim3 with PHP-DI container, having issues with SCRF #57

Closed sarelvdm closed 1 year ago

sarelvdm commented 1 year ago

Hi, Im using Slim3 with PHP-DI container and Twig.

The problem im having is with the csrf, the $request->getAttribute is returning null. In my routes im not returning or using $args, because I can return the actual attributes by name.

Managed to get is working by bypassing the SCRF, it's setup and im using it In Twig im also using SCRF but adding

public function fw101(Request $request, Response $response) {

        $firewall = new \Shieldon\Firewall\Firewall($request);
        $firewall->configure(__DIR__ . '/../cache/shieldon_firewall');
        $firewall->controlPanel('/firewall/panel/');
        $panel = new \Shieldon\Firewall\Panel();

// the   $request->getAttribute is returning null
//        $csrfName = $request->getAttribute('csrf_name');
//        $csrfVale = $request->getAttribute('csrf_value');

        $nameKey = $this->csrf->key();
        $valueKey = $this->csrf->token();

        $csrfName = $this->csrf->key();
        $csrfVale = $this->csrf->token();

        $panel->csrf(
                [$nameKey => $csrfVale],
                [$valueKey => $csrfVale]
        );

        $panel->entry();
    }
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 since being marked as stale.