motikan2010 / gpt-waf
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 1
Open Issues: 1
pkg:composer/motikan2010/gpt-waf
Requires
- php: >=8.0
Requires (Dev)
- orchestra/testbench: 4.*
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2025-10-05 16:57:30 UTC
README
This is a WAF (Web Application Firewall) using GPT-4. (Laravel only)
Requirement : OpenAI API key for GPT-4.
Install
composer require motikan2010/gpt-waf
Performance
Detect
Speed
| Status | Response Speed | 
|---|---|
| Disable GPT WAF | 00.68 Sec 🚗 | 
| Enable GPT WAF | 19.04 Sec 🐢 | 
Using
Edit routing & ".env" file
Set "gpt-waf" as the middleware for routing.
Route::group(['middleware' => 'gpt-waf'], function () { // Protect area });
The following changes will be enabled.
https://github.com/motikan2010/GPT-WAF-Test-App/commit/5a021e632488a585fc17d6360e2a89cd99a00eb6
Setting of ".env"
Required
| Param | Description | 
|---|---|
| GPT_WAF_ENABLED | GPT-WAF enabled or disabled. | 
| GPT_WAF_OPEN_AI_API_KEY | OpenAI API key for GPT-4. | 
ex.
GPT_WAF_ENABLED=true
GPT_WAF_OPEN_AI_API_KEY=st-tGC**********
Option
| Param | Description | 
|---|---|
| GPT_WAF_BLOCK_STATUS_CODE | Status code at block. (default: 403) | 
| GPT_WAF_DEBUG_MODE | Output "question" and "answer" to log. (default: false) | 
| GPT_WAF_QUESTION_TEXT | Beginning of message when asking a question to GPT. By default, the question is asked with the following text. Begin your answer with 'Yes' or 'No'.\nIs the following HTTP request a cyber attack?(Beware of false positives.)\n----- | 
| GPT_WAF_SYSTEM_ROLE | GPT role(system). (default: You are Security engineer.) | 
ex.
GPT_WAF_BLOCK_STATUS_CODE=403
GPT_WAF_DEBUG_MODE=true
GPT_WAF_SYSTEM_ROLE=
GPT_WAF_QUESTION_TEXT=
