KRIOSA - API Security Documentation | Enterprise Protection
Enterprise-Grade Security

Documentation

Protect your applications from SQL injection, XSS, and 25+ attack vectors in 30 seconds. No complex setup. No dependencies.

Zero Config
Install & Protect
25+
Attack Vectors
30s
Setup Time
24/7
Support

Installation

Choose the method that fits your workflow β€” all take less than 60 seconds

Manual Installation

Perfect for shared hosting, cPanel, or when you prefer full control.

1 Download kriosa.php
2 Upload to your project root via FTP/cPanel
3 Add to your index.php or bootstrap file
Download kriosa.php

Quick Code Integration

Add these 2 lines to your entry point file.

php
<?php
// Add this to your index.php or front controller
require_once __DIR__ . '/kriosa.php';

$apiKey = getenv('KRIOSA_API_KEY') ?: 'YOUR_API_KEY_HERE';

try {
    $kriosa = new Kriosa($apiKey, [
        'timeout'     => 3,
        'debug'       => false,
        'fail_closed' => false,
        'show_badge'  => true,
    ]);

    if (!$kriosa->protect()) {
        header('X-Kriosa-Blocked: true');
        http_response_code(403);
        exit('Access Denied');
    }
} catch (Exception $e) {
    error_log('Kriosa Security Error: ' . $e->getMessage());
}

// Your application continues safely here...

Direct URL Include β€” Zero File Upload

Just one line of code β€” perfect for testing or quick prototypes.

php
 
<?php // Add this single line to your index.php
step 1:
require_once 'https://kriosa.com/kriosa.php';
step 2:
// Define your API key in .env or directly:
require_once __DIR__ . '/kriosa.php';
step 3:
$apiKey = getenv('KRIOSA_API_KEY') ?: 'YOUR_API_KEY_HERE'; try { $kriosa = new Kriosa($apiKey, [ 'timeout' => 3, 'debug' => false, 'fail_closed' => false, 'show_badge' => true, ]); if (!$kriosa->protect()) { header('X-Kriosa-Blocked: true'); http_response_code(403); exit('Access Denied'); } } catch (Exception $e) { error_log('Kriosa Security Error: ' . $e->getMessage()); }
The file caches itself locally after the first request for optimal performance.

Composer (PHP)

Best for modern PHP applications and dependency management.

bash
# Install via Composer 
composer require kriosa-ai/kriosa-php # Or add to your composer.json{ "require": { "kriosa-ai/kriosa-php": "v1.0.1" } }
php
 
<?php // After Composer installation
require_once 'vendor/autoload.php'; $apiKey = getenv('KRIOSA_API_KEY') ?: 'YOUR_API_KEY_HERE'; try { $kriosa = new Kriosa($apiKey, [ 'timeout' => 3, 'debug' => false, 'fail_closed' => false, 'show_badge' => true, ]); if (!$kriosa->protect()) { header('X-Kriosa-Blocked: true'); http_response_code(403); exit('Access Denied'); } } catch (Exception $e) { error_log('Kriosa Security Error: ' . $e->getMessage()); } // Your application continues safely...

One-Line Installer (CLI)

For VPS/SSH users who want the fastest setup.

bash
# One-line installer with curlcurl -sS https://kriosa.com/install.sh | bash

# Or with wgetwget -qO- https://kriosa.com/install.sh | bash

This automatically downloads and configures kriosa.php in your current directory.

For Developers

Framework Integrations

Kriosa works seamlessly with your favorite PHP framework

Laravel

Laravel Integration

Add Kriosa to your Laravel application as middleware for automatic protection on every request.

1
Step 1 β€” Install via Composer
bash
composer require kriosa-ai/kriosa-php
2
Step 2 β€” Add to your .env file

Add these environment variables to your .env file:

env
KRIOSA_API_KEY=sk_your_api_key_here
KRIOSA_TIMEOUT=5
KRIOSA_DEBUG=false
KRIOSA_BADGE=true
3
Step 3 β€” Create config/kriosa.php

Create the configuration file:

php
// config/kriosa.php
return [
    'api_key' => env('KRIOSA_API_KEY'),
    'timeout' => env('KRIOSA_TIMEOUT', 5),
    'debug'   => env('KRIOSA_DEBUG', false),
];
4
Step 4 β€” Create the Middleware

Run the artisan command and replace the contents:

php
// app/Http/Middleware/KriosaSecurity.php

use Closure;
use Kriosa;
use Illuminate\Http\Request;

class KriosaSecurity
{
    public function handle(Request $request, Closure $next)
    {
        $apiKey = config('kriosa.api_key');

        // Skip if no API key configured
        if (!$apiKey) {
            return $next($request);
        }

        try {
            $kriosa = new Kriosa($apiKey, [
                'timeout' => config('kriosa.timeout', 5),
                'debug'   => config('kriosa.debug', false),
            ]);

            if (!$kriosa->protect()) {
                return response('Access denied', 403);
            }

        } catch (\Exception $e) {
            // Fail open β€” don't block users if Kriosa is unreachable
            report($e);
        }

        return $next($request);
    }
}
5
Step 5 β€” Register the Middleware

Register the middleware in app/Http/Kernel.php:

php
// app/Http/Kernel.php

protected $middleware = [
    // ... existing middleware
    \App\Http\Middleware\KriosaSecurity::class,
];

// OR apply to specific routes only:

// routes/web.php
Route::middleware(['kriosa'])->group(function () {
    Route::get('/dashboard', [DashboardController::class, 'index']);
});
Laravel 8+ Compatible

Also works with: Yii2, CakePHP, Phalcon, Slim, Lumen, Zend/Laminas, and any PHP framework

Simply include kriosa.php in your bootstrap/front controller β€” instant protection!

Code  Β·  Step 1 of 4

Why Choose KRIOSA?

Simple integration, powerful protection β€” built for developers by developers

30 Second Install

One file. One API key. One include. No configuration files, no database setup, no friction.

25+ Attack Vectors

SQL injection, XSS, command injection, path traversal, LDAP, NoSQL, SSRF, XXE, deserialization, CSRF, IDOR, and more.

AI-Powered Detection

Machine learning models trained on real threat intelligence detect zero-day attacks traditional WAFs miss.

Lightning Fast

Average response time under 10ms. Your users won't notice the protection, but attackers will.

Works Anywhere

Shared hosting, VPS, dedicated servers, even localhost. Anywhere PHP 5.6+ runs, Kriosa works.

24/7 Expert Support

Email, WhatsApp, and ticket system. Our security engineers are here when you need them.

Complete Protection

Every attack vector we detect and block in real-time

Injection Attacks

  • SQL Injection
  • NoSQL Injection
  • LDAP Injection
  • Command Injection
  • Code Injection

Cross-Site Attacks

  • XSS (Reflected/Stored/DOM)
  • CSRF
  • IDOR
  • Open Redirect

Server-Side Attacks

  • SSRF
  • XXE
  • Path Traversal
  • Deserialization

Additional Protections

  • Rate Limiting
  • Brute Force Protection
  • Malicious Bot Detection
  • Suspicious Pattern Matching
Machine learning models continuously improve detection accuracy with every request β€” learning from real attack patterns.

Handling API Timeouts & Fail Behavior

One of the most important configuration decisions in Kriosa. Understand exactly what happens when the API cannot be reached so you can configure it correctly for your use case.

The Default Behavior β€” fail_closed: false

By default, Kriosa is configured to fail open. If the API does not respond within the timeout window, the request is not automatically blocked.

This is intentional. A misconfigured timeout that locks out all traffic on a fresh install is a worse experience than a brief unprotected window during an API hiccup.

But it does not just wave requests through.

Before making any fallback decision, the SDK runs a local pattern matching layer directly on the raw request. This covers:

SQL Injection attempts
Cross-Site Scripting (XSS)
Path Traversal attacks
Command Injection patterns

If a request matches any of these patterns locally, it gets blocked immediately β€” no API call needed.

Full Decision Flow
1
API responds in time Full ML analysis runs β†’ decision returned
Allow / Block
API timeout or error
2
Local pattern matching runs Instant analysis on the raw request, no network needed
Match found
Request blocked
No match
fail_closed: false Request passes through
fail_closed: true Request blocked

Authenticated Traffic

User dashboards, admin panels, API endpoints

Strict

Any request that cannot be fully evaluated gets blocked rather than passed through. The tradeoff is availability β€” if Kriosa API goes down, protected routes go down with it. For sensitive authenticated traffic, that is the correct tradeoff.

php
$kriosa = new Kriosa('your-key', [
    'fail_closed' => true,   // block all unverified requests    'timeout'     => 5,      // give API up to 5s to respond]);

Public Pages

Marketing pages, landing pages, public content

Open

Availability matters more than strict security. The local fallback layer still catches obvious attack patterns. Full ML analysis resumes as soon as the API is reachable again.

php
$kriosa = new Kriosa('your-key', [
    'fail_closed' => false,  // local patterns only on API failure    'timeout'     => 3,      // shorter timeout for public pages]);
Quick Reference
Setting Best For Behavior on API Failure
fail_closed: false Public pages Local patterns only β€” clean requests pass through
fail_closed: true Authenticated routes Block all unverified requests
Rule of thumb

Fail open for public traffic, fail closed for anything a logged-in user touches.

Simple, Transparent Pricing

Start Free, Scale as You Grow

No hidden fees, no surprise bills. Pay only for what you need β€” upgrade or downgrade anytime.

Free 10k requests/month
Developer 100k + priority support
Startup 200k + 24/7 chat support
Compare Plans Click anywhere for details

API Reference

Simple, RESTful API for seamless integration

POST
/v1/protect

Request

json
{
  "user_id":     123,
  "tenant_id":   "tenant_abc",
  "ip_address":  "192.168.1.100",
  "user_agent":  "Mozilla/5.0...",
  "method":      "POST",
  "resource":    "/api/users",
  "payload":     { "username": "john" },
  "query_params":{ "page": 1 }
}

Allowed Response

json
{
  "allowed":            true,
  "request_id":         "req_abc123xyz",
  "processing_time_ms": 45,
  "score":              12
}

Blocked Response

json
{
  "allowed":     false,
  "attack_type": "sql_injection",
  "threat_score": 95,
  "request_id":  "req_def456uvw",
  "details":     "Malicious pattern detected in 'username' field"
}

Frequently Asked Questions

Everything you need to know about KRIOSA

Do I need Composer or any dependencies?

No! Just download <code>kriosa.php</code> and include it in your project. That's it. No Composer, no npm, no external libraries β€” pure PHP that works everywhere.

Will it slow down my website?

No. Our average response time is under 10ms, and all processing happens asynchronously. Your users won't notice any difference, but attackers will be blocked instantly.

Does it work on shared hosting?

Absolutely! Kriosa works anywhere PHP runs (5.6+). No special extensions, no root access required β€” perfect for shared hosting, cPanel, and managed WordPress hosting.

How accurate is the AI detection?

Our ML models achieve 99.9% detection rate with less than 0.01% false positives. Models are continuously retrained on real attack data from CISA KEV, OWASP, and our global threat intelligence network.

Can I use Kriosa with WordPress/Laravel/Symfony?

Yes! We have dedicated plugins and integration guides for WordPress, Laravel, Symfony, CodeIgniter, Yii2, CakePHP, and any PHP framework. Check the Installation section for framework-specific instructions.

What if a legitimate request is blocked (false positive)?

Every block includes an <code>attack_type</code> and <code>request_id</code> for debugging. You can whitelist specific patterns from your dashboard, adjust security sensitivity, or report false positives to our team for model improvement.

Is there a free tier?

Yes! The free tier includes 10,000 requests per month β€” perfect for small projects, testing, or development environments. No credit card required to start.

Need Help? We're Here 24/7

Our security engineers are ready to assist you with integration, configuration, or any questions.

Protected by Kriosa