Skip to content

Agent

Goal

Prevent certain agents

Enabled

Enable or disable this wire

Methods

The methods specifies which methods should be inspected

Options:

  • 'post'
  • 'put'
  • 'patch'
  • 'get'
  • 'all' or '*'

The 'all' or '*' is a alias to inspect all methods

php
    ->methods(['post', 'put']) // only post and put method
php
    ->methods(['*']) // all methods

Attack score

This is this wire severity, the higher the number the more severe. All attackScores will be summarized and if it exceeds the PunishScore the block will be activated. Set this to a number that reflects the severity.

  • A very high number will immediately block the user/ip
  • A low number will only block if there are many requests

TIP

sqli and xss are very common attack vectors with high confidence detection. You should set those to a very high number

Tripwires

Specify the list of agents that should be allowed or forbidden https://github.com/jenssegers/agent

Filters

Filters

This specifies what to allow and what to block

php
    ->filters(AllowBlockFilterConfig::make()->allow(['allow-this'])->block(['block-this']));

Example: Exception

allow must be at least ['*'] to allow all

php
    ->allow([])->block([])

Example: Allowed

firefox is allowed

php
    ->allow(['firefox'])->block([])

Example: Blocked

brave is blocked

php
    ->allow(['*'])->block(['brave'])

Example: Not Blocked

firebrave is not blocked, so allowed

php
    ->allow(['*'])->block([])

Example: Not Blocked

Chrome is not blocked, so allowed

php
    ->allow(['*'])->block(['brave'])

Example: Allowed and Blocked

firebrave is both allowed and blocked, so allowed

php
    ->allow(['firebrave'])->block(['firebrave'])

Example: Unspecified

firebrave is both not as allowed and not as blocked The return depends on where it is used.

php
    ->allow(['firebrave'])->block(['firebrave'])

Example

php
WireDetailsConfig::make()
    ->enabled(true)
    ->methods(['*'])
    ->attackScore(10)
    ->tripwires([
        'browsers' => [
            'allow' => [],
            'block' => [], // i.e. 'IE', 'CHROME', 'FIREFOX'
        ],

        'platforms' => [
            'allow' => [],
            'block' => [], // i.e. 'OS X', 'UBUNTU', 'WINDOWS
        ],

        'devices' => [
            'allow' => [],
            'block' => [], // ie DESTOP, TABLET, MOBILE, PHONE
        ],

        'properties' => [
            'allow' => [], // i.e. 'Gecko', 'Version/5.1.7'
            'block' => [], // i.e. 'AppleWebKit'
        ],
    ]);
    
    //... optional overrides

optional global overriders

Released under the MIT License.