New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@defen.so/init

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@defen.so/init

One command to install a production Web Application Firewall in any framework. Detects Node / PHP / Python / Ruby / Go / Rust / Java / .NET, installs the right Defenso SDK, wires the middleware, writes DEFENSO_TOKEN to .env. Free forever tier. Fails open.

Source
npmnpm
Version
0.3.1
Version published
Weekly downloads
8
60%
Maintainers
1
Weekly downloads
 
Created
Source

@defen.so/init

The one-command way to install a production web application firewall in any language. No config files. No DevOps ticket. No credit card. npx @defen.so/init detects your framework, adds the right SDK, wires the middleware, and prints your next step — all in about 30 seconds.

npx @defen.so/init

Free forever tier. Pro $29/mo per site. Powered by Defenso — the security layer built for indie developers, vibe coders, AI-first shipping teams, and small startups shipping fast.

Website App MCP Playground License

Table of contents

Why this exists

Small teams ship without a Web Application Firewall in front of their app because the friction is real:

  • Enterprise WAFs (AWS WAF, Cloudflare Enterprise, Imperva, F5) are priced for enterprise teams and take days to onboard
  • Cloud provider defaults stop L3/L4 DDoS but not SQL injection, XSS, credential stuffing, exposed .env files, or the twenty other things that actually take down small sites
  • Every "install a WAF" backlog ticket rots for another quarter

Defenso removes the friction. @defen.so/init is the front door: one command, every framework, zero config.

What Defenso protects against

Every OWASP Top 10 category, plus the modern attacks that actually hit sites shipped fast:

CategoryAttacks blocked
InjectionSQL injection (classic + blind + time-based), NoSQL injection, LDAP filter injection, command injection, XPath, template injection
Cross-site scriptingReflected, stored, DOM-based, mXSS, SVG payloads, event-handler injection
Authentication attacksBrute force, credential stuffing (HIBP-backed), account takeover, session fixation
Broken access controlPath traversal (../, %2e%2e%2f, Unicode variants), IDOR probes, admin-panel enumeration
Security misconfigurationExposed .env, .git/config, wp-config.php, .aws/credentials, wide-open Firebase / Supabase rules, public S3 buckets
Server-side attacksSSRF, XXE (XML external entity), deserialization, log4shell-style JNDI
Cross-site + CSRFOrigin mismatch, missing-token detection, cookie flag misuse
File uploadsPolyglots, PHP-in-PNG, EXIF tampering, MIME sniffing tricks, optional ClamAV integration
Bots + scrapersTLS fingerprinting (JA4), headless browser detection, sqlmap / Nikto / Nuclei UA signatures, behavioral baselines
DDoS L3/L7Cloudflare wrap with one-click per-site Under-Attack toggle
API abusePer-endpoint rate limits, per-account velocity limits, ASN + country allowlists
Malicious ASNsTOR exit nodes, known-bad ASNs, spam infrastructure

Full threat-to-rule map with links to the CVEs / research behind each rule: defen.so/threats.

What @defen.so/init actually does

When you run npx @defen.so/init in a project directory:

StepAction
1Reads your package.json, composer.json, requirements.txt, Cargo.toml, go.mod, or Gemfile to detect language + framework
2Picks the right SDK — @defen.so/sdk-node (Node) and defenso/sdk-php (PHP) are published today; Python, Go, Ruby, Rust, Java, and .NET SDKs are in development
3Installs the SDK using your existing package manager (npm / pnpm / yarn / bun / composer / pip / poetry / bundle / cargo / go)
4Locates the correct wire-up file for your framework (middleware.ts, bootstrap/app.php, main.py, config.ru, Program.cs, etc.)
5Inserts the middleware call with process.env.DEFENSO_TOKEN — never a hardcoded secret
6Appends DEFENSO_TOKEN= to your .env or .env.local as a stub
7Prints a clear next-step checklist so you know exactly what remains

Idempotent. Re-running the command on an already-bootstrapped project just prints "already installed" and exits.

Quick start

# 1. Bootstrap
npx @defen.so/init

# 2. Sign up (or log in) at https://app.defen.so
#    Copy your DEFENSO_TOKEN from the Developer tab

# 3. Paste into .env
DEFENSO_TOKEN=df_live_...

# 4. Deploy. That's it.

Token format: df_live_ prefix + 40 random characters. Get it at app.defen.so/developer.

Framework support

Node.js / TypeScript

FrameworkVersionDetected by
Express4.x, 5.xpackage.json dep
Fastify3.x, 4.x, 5.xpackage.json dep
Koa2.xpackage.json dep
Hapi21.xpackage.json dep
Next.js (App + Pages router)12+, 13+, 14+, 15+next dep + next.config.*
Nuxt3.xnuxt dep
SvelteKitany@sveltejs/kit dep
Astro3.x, 4.x, 5.xastro dep
Remix2.x@remix-run/* dep
NestJS10.x, 11.x@nestjs/core dep
Bun (native Bun.serve)anybun runtime
Deno (native Deno.serve)anydeno.json or deno.jsonc
Honoanyhono dep
ElysiaJSanyelysia dep
t3-stackanycreate-t3-app detected

PHP (8.2+, tested against 8.4)

FrameworkVersionWire-up point
Laravel10, 11, 12bootstrap/app.php middleware group
Symfony6, 7Kernel event listener via services.yaml
Slim4Middleware pipe
Lumen9, 10bootstrap/app.php
Plain PHPany 8.2+Direct \Defenso\Client::inspect() call

Python (3.10+)

FrameworkVersionWire-up point
FastAPI0.100+app.add_middleware(Defenso, token=...)
Starlette0.30+Same middleware call
Django3.x, 4.x, 5.xMIDDLEWARE in settings.py
Flask2.x, 3.xbefore_request hook
Quart0.19+Same as Flask
aiohttp3.xMiddleware coroutine

Ruby / Go / Rust / Java / .NET

LanguagePackageWire-up
Ruby (Rails 6, 7, 8)defensoconfig/application.rb middleware.use
Ruby (Sinatra)defensouse Defenso::Middleware
Go (chi / gin / echo / fiber / net/http)github.com/defenso/sdk-gor.Use(defenso.Middleware(...))
Rust (axum / actix-web / warp / tower)defenso.layer(DefensoLayer::new(...))
Java (Spring Boot 2, 3)io.defenso:sdk@Bean DefensoFilter
.NET (ASP.NET Core)Defensoapp.UseDefenso()

If your framework isn't listed: npx @defen.so/init --sdk-only installs the SDK and prints the snippet to paste yourself.

How the underlying SDK works

Every Defenso SDK — regardless of language — follows the same three-part contract:

  • Fetches WAF policy — pulls your rules from https://app.defen.so/api/policy every 5 minutes and caches them in-process. Zero per-request network calls.
  • Inspects the request — in-process, against the cached policy. Latency: ~0.1 ms per request. If a rule matches, the SDK returns { action: 'allow' | 'block' | 'challenge', rule, reason, category }.
  • Logs attacks async — hits get queued in-memory and batch-flushed to https://app.defen.so/api/attacks/ingest every 10 seconds (or when the batch hits 50 events). Your request never blocks on log I/O.

Fails open. If Defenso's API is unreachable — degraded network, our incident, whatever — the SDK returns allow for every request. Your app keeps serving traffic. You lose protection during the outage, not availability. This is a deliberate design choice: a WAF that takes your site down when it has a bad day is worse than no WAF.

Comparison with other tools

Different tools solve different parts of the problem. Here's how Defenso fits with what you probably already have:

FeatureDefensoCloudflare WAFAWS WAFModSecurityVercel Firewall
Install commandnpx @defen.so/initChange nameserversTerraform + rule wiringRecompile nginx/apacheVercel-only
Setup time~30 secondsHoursDaysDaysMinutes
Language coverage10 SDKs, same APIAny (edge)Any (edge)Any (server)Node only
Custom rules from your IDE✅ via MCPDashboard onlyTerraformConfig filesDashboard only
Attack log per site✅ 7-90 day retentionEnterprise plan✅ (CloudWatch)Log filesBasic
Public status page✅ built-inExtra planExtra service❌❌
Uptime monitoring included✅ 30s-15min❌❌❌❌
Pentest scanner included✅❌❌❌❌
Vibe-coder / secret scanner✅❌❌❌❌
Free tier for real projects✅ foreverFree plan basicPay per requestFree (self-host)Included
Fails open on our incident✅ by designN/A (edge)N/A (edge)Config-dependentYes
MCP for AI IDEs✅❌❌❌❌
Price for one site$0 or $29/mo$0 or $20+/mo$5-20/mo + $ per ruleFree (you host)Included with Vercel

Defenso complements Cloudflare — most Defenso customers run both. Cloudflare handles L3/L4 DDoS + TLS termination at the edge. Defenso runs in your app process (or optionally at our edge via CNAME) doing L7 rule matching, deception, custom rules, and detailed logging.

Pricing

Per-site, transparent, no sales calls:

PlanPriceSitesMonitorsIntervalPentests / moVibe scans / moCustom WAF rulesLog retention
Free$0 forever1115 min1087 days
Pro$29/mo5101 min100202530 days
Business$69/mo255030 sec∞∞∞90 days
Agency / Enterprisecustom∞∞custom∞∞∞365 days

Yearly billing: −25%. AppSumo lifetime redemption supported. Full pricing: defen.so/pricing.

Everything else you get

@defen.so/init gets you the WAF SDK. Your Defenso account also gets you, automatically, per site added:

Uptime monitoring

  • Auto-created when you add a site — no forms
  • Check interval scales with plan: 15 min free, 1 min Pro, 30 sec Business
  • Latency tier per check: Fast (< 300 ms), OK (< 900 ms), Slow (< 2 s), Bad (≥ 2 s)
  • Only 2xx/3xx counts as up — no "warning" state on a 500 for two hours
  • Public status page every site gets, embeddable
  • Alerts to email (1 primary + up to 3 CCs), Slack, Telegram, or generic webhook
  • Down/up + slow-response notifications with a probable-cause paragraph tailored to the HTTP status seen ("HTTP 522 → Cloudflare could not reach origin — usually origin down or firewall")
  • Anti-spam send policy: max 2 emails per outage (initial + still-down-24h), then silent until recovery

Quick pentest scanner

  • Grade A-F on TLS, headers, cookies, exposed .env / .git, WordPress probes, common misconfigurations
  • One-click from your dashboard, or auto-run weekly (Sunday 3 AM)
  • Free tier gets 1/month; Pro 100/month; Business unlimited

Vibe-coder scan

  • Catches mistakes AI-generated projects tend to ship: hardcoded secrets, open S3 buckets, Supabase RLS off, wide-open Firebase rules, committed .env
  • Auto-run weekly (Monday 4 AM)
  • Free tier gets 0; Pro 20/month; Business unlimited

Live CVE feed

  • Pulled from NVD every 6 hours
  • Each CVE tagged with which Defenso WAF rule covers it

MCP server for AI IDEs

Defenso ships an official Model Context Protocol server that plugs into Claude Code, Cursor, Windsurf, and VS Code Copilot. Once installed, your AI coding tool gets six new tools:

ToolWhat it does
scan_domain(url)Quick pentest surface scan of any public URL
check_headers(url)TLS grade, HSTS, CSP, cookie flags, common exposures
list_sites()Every site under your Defenso account with plan + status
list_monitors()Uptime monitors + latest status
list_recent_attacks(hours=24)Attacks blocked / deceived / allowed in a window
explain_verdict(rule_id)Plain-English explanation of what a WAF rule catches

Install via ~/.claude/mcp.json:

{
  "mcpServers": {
    "defenso": {
      "command": "npx",
      "args": ["-y", "@defen.so/mcp"],
      "env": { "DEFENSO_TOKEN": "df_live_..." }
    }
  }
}

Now Claude can say "hey, this endpoint you just wrote has an SQL injection surface — want me to add a WAF rule for it?" and actually do it against your real Defenso account, in your IDE, no context switch.

Live SDK playground

playground.defen.so is a hosted attack sandbox running the PHP SDK in front of a real Defenso Business-tier account. Fire SQL injection, XSS, path traversal, XXE, NoSQL, brute force, or bot-UA attacks at it — the response tells you exactly what the WAF blocked, deceived, or missed. Every attack is logged in the dashboard as a real event. Rate-limited so you can't abuse it.

Perfect for evaluating whether Defenso would catch the specific attack pattern you're worried about before you install it.

Frequently asked questions

Does this replace Cloudflare?

No — it complements it. Cloudflare handles L3/L4 DDoS + TLS termination at the edge. Defenso runs in your app process (or optionally at our edge via CNAME) doing L7 rule matching, custom rules, deception, and detailed logging. Most Defenso customers run both.

Does it work on Vercel / Netlify / Cloudflare Pages / Deno Deploy?

Yes. The Node SDK ships an Edge-compatible build. @defen.so/init detects the platform and installs the right variant.

Will it slow down my app?

~0.1 ms per request in-process. Rule evaluation is local — no network call on the hot path. Policy is refreshed every 5 minutes in the background. Attack logs are batched and flushed asynchronously.

What happens if Defenso goes down?

Every request is allowed. You lose protection until we recover. Your site keeps serving traffic. This is deliberate — a WAF that takes your site down when it has a bad day is worse than no WAF.

How does the token get to production?

Same way you handle any secret. Add DEFENSO_TOKEN in Vercel/Netlify/Fly/Railway/Heroku dashboard, or your infra's env-var mechanism. Never commit it. The @defen.so/init CLI writes the variable name to .env but leaves the value blank.

Can I self-host Defenso?

The SDK accepts a custom api URL. Point it at your own policy + ingest endpoints. Self-host guide is in the docs.

What framework was Defenso built with?

The app is Laravel 12 + PHP 8.4 + MariaDB, deployed on our own infrastructure. The SDKs are hand-written per language — no framework bloat, no runtime dependencies beyond the language's standard HTTP client.

Is the source public?

Every SDK is MIT-licensed and public: github.com/1fancy/defen.so. The core Defenso app (WAF engine, dashboard, billing) is closed-source but the SDKs, MCP server, docs, and this CLI are all open.

Do you sell my data?

No. Attack logs stay in your account, tied to your plan's retention window. We do not sell, share, or aggregate for third parties. The privacy policy lists every third party we touch (Stripe for billing, Cloudflare for DDoS wrap on Pro+, N0C for email delivery).

How do I remove Defenso?

Delete the middleware line the CLI added, uninstall the SDK. Your app keeps working. @defen.so/init --uninstall will also do it automatically.

If you already have a Defenso account

@defen.so/init doesn't require you to sign up first — you can install the SDK and grab a token later. But if you already have an account:

  • Bootstrap runs the same way: npx @defen.so/init
  • When prompted, paste your existing df_live_... token
  • The site auto-registers in your dashboard on the first request
  • You get real-time attack logs immediately

If you have multiple sites, the token you use determines which account the traffic gets attributed to. One token per account; sites are distinguished by the Host header of each request.

If you're on Pro or Business, unlock:

  • Custom WAF rules editor at app.defen.so
  • CNAME edge proxying (put Defenso in front of your origin at the DNS level)
  • Slack Connect for direct alerts to a shared channel
  • 30/90-day log retention
  • MCP integration for Claude Code / Cursor / Windsurf / VS Code

Companion packages

PackageRegistryLanguageStatus
@defen.so/sdk-nodenpmNode / Bun / Deno✅ published
defenso/sdk-phpPackagistPHP 8.2+✅ published
@defen.so/mcpnpmMCP server (any client)✅ published
defensoPyPIPython 3.10+🚧 in development
github.com/defenso/sdk-goGo modulesGo 1.21+🚧 in development
defensoRubyGemsRuby 3.0+🚧 in development
defensocrates.ioRust 1.75+🚧 in development
io.defenso:sdkMaven CentralJava 17+🚧 in development
DefensoNuGet.NET 8+🚧 in development

License

MIT. Free for commercial use. See LICENSE.

Keywords for npm and search engines

security WAF web application firewall DDoS protection bot detection uptime monitoring pentest security SaaS OWASP OWASP Top 10 SQL injection XSS brute force credential stuffing account takeover CSRF SSRF XXE NoSQL injection path traversal deception honeypot upload scanning file upload security Cloudflare wrap edge security vibe coder security AI-first security Claude Code security Cursor security Windsurf security MCP Model Context Protocol indie developer security small team security Next.js security Laravel security Symfony security Django security FastAPI security Rails security Express security Fastify security Nuxt security SvelteKit security Astro security Vercel security Netlify security Bun security Deno security Node security PHP security Python security Go security Ruby security Rust security Java security .NET security

Keywords

defenso

FAQs

Package last updated on 23 Jul 2026

Related posts