OWASP Web Shield Library ( OWL )

OWASP Web Shield Library (OWL)

OWL is a practical, open source security library for modern JavaScript applications. It provides reusable protection utilities aligned to OWASP Top 10 categories and ships with a React adapter for fast integration.

Use The Tabs Above

This project now uses a tabbed layout to keep the homepage focused and make content easier to navigate.

  • Overview: Architecture, A01-A10 module map, and React adapter highlights
  • Getting Started: Installation, commands, and first integration example
  • Contributing: Contributor workflow, pull request guidance, and conduct/security links

Quick Project Facts

  • Maturity: v1.0.0 release
  • Coverage: A01-A10 modules
  • Stack: Framework-agnostic core + React adapter
  • Quality: ESLint, Jest, CI workflows, and security gates

Project Leader


OWASP Logo

OWASP Web Shield Library (OWL)

Practical, reusable OWASP Top 10 security controls for modern JavaScript applications.

License   OWASP Lab Project   Node 20+   OWASP A01-A10


What OWL Delivers

OWL maps reusable security controls directly to OWASP categories so teams speak the same security language as their threat models.

Capability Approach
๐Ÿ›ก๏ธ Full A01โ€“A10 coverage One module per OWASP category, consistent naming
๐Ÿงฉ Framework-agnostic core Pure JavaScript, no runtime framework dependency
โš›๏ธ React adapter Category-aligned providers, hooks, and guard components
โœ… Secure defaults Deny-overrides, token expiry, redaction โ€” all on by default
๐Ÿงช Test-first delivery Positive, negative, and abuse-path test coverage
๐Ÿ”„ CI-ready Lint + test + build gate in a single npm run check

Core Module Map (A01โ€“A10)

OWASP # Category Key Exports
A01 Broken Access Control RBACManager, ACLManager, PermissionChecker
A02 Cryptographic Failures CryptoManager, PBKDF2Adapter, Argon2Adapter, SecretPolicy
A03 Injection InputSanitizer, InputValidator
A04 Insecure Design ThreatModelGuard, DesignChecklist
A05 Security Misconfiguration SecurityConfigManager, HardeningReporter
A06 Vulnerable & Outdated Components DependencyRiskScanner, ComponentPolicy
A07 Identification & Auth Failures AuthManager, TokenManager
A08 Software & Data Integrity Failures CSRFTokenManager, HTTPClient
A09 Security Logging & Monitoring Failures SecurityLogger, EventEmitter
A10 SSRF SSRFGuard, SafeFetcher

React Adapter Highlights

@owasp-webshield/react
 โ”œโ”€โ”€ A01  ACLProvider, RBACProvider, useACL, usePermission, PermissionGate
 โ”œโ”€โ”€ A02  useCryptoManager
 โ”œโ”€โ”€ A03  useInputSanitizer, SanitizedText
 โ”œโ”€โ”€ A04  useThreatModelGuard
 โ”œโ”€โ”€ A05  useHardeningReport
 โ”œโ”€โ”€ A06  useDependencyRiskScanner
 โ”œโ”€โ”€ A07  AuthProvider, useAuth, useAuthToken, AuthGate
 โ”œโ”€โ”€ A08  useSecureHttpClient, withSecurityHeaders
 โ”œโ”€โ”€ A09  SecurityProvider, useSecurityMonitoring, SecurityAlert
 โ””โ”€โ”€ A10  useSafeFetcher

OwlProvider composes the A01/A07/A09 providers above into one component; pair it with createOwlClient() from @owasp-webshield/core to build the managers it needs from one config object instead of wiring each by hand.


Resource Link
๐Ÿ“š API Reference docs/api-reference.md
๐Ÿ“ Source github.com/OWASP/www-project-webshield-library
๐Ÿš€ Examples examples/
๐Ÿ› Issues GitHub Issues

Getting Started

Node 20+   ESM + CJS   React 18+


Requirements

Requirement Version
Node.js >= 20
React (adapter only) >= 18
Package manager npm, pnpm, or yarn

Install

# Install dependencies
npm install

# Verify the quality gate passes
npm run check

Core Usage โ€” 5-minute example

import {
  ACLManager,
  AuthManager,
  PermissionChecker,
  RBACManager,
  TokenManager
} from "@owasp-webshield/core";

// 1. Set up auth and token management
const tokenManager = new TokenManager();
tokenManager.setTokens({ accessToken: "jwt", expiresAt: Date.now() + 3_600_000 });

const authManager = new AuthManager({ tokenManager });
authManager.setSession({ userId: "u1", roles: ["admin"] });

// 2. Define role permissions
const rbac = new RBACManager();
rbac.defineRole("admin", ["read:invoice", "update:invoice"]);

// 3. Add ACL policy overrides
const acl = new ACLManager();
acl.setPolicy("invoice", "delete", "deny");

// 4. Check combined permission (deny-overrides)
const checker = new PermissionChecker({ rbacManager: rbac, aclManager: acl });
console.log(checker.check({ role: "admin", action: "read", resource: "invoice" }));
// โ†’ { allowed: true, reason: "allowed", metadata: { ... } }

React Adapter โ€” Provider Composition

import { createOwlClient } from "@owasp-webshield/core";
import { AuthGate, OwlProvider, PermissionGate } from "@owasp-webshield/react";

const owl = createOwlClient({ roles: { viewer: { permissions: ["read:reports"] } } });

export function AppShell({ children }) {
  return (
    <OwlProvider client={owl}>
      <AuthGate fallback={<div>Sign in required</div>}>
        <PermissionGate action="read" resource="reports"
          fallback={<div>Access denied</div>}>
          {children}
        </PermissionGate>
      </AuthGate>
    </OwlProvider>
  );
}

OwlProvider composes SecurityProvider/AuthProvider/ACLProvider/RBACProvider for you; wire them individually if you need managers built up separately.


Run the Examples

Node secrets-vault app (every OWASP category, no build required)

cd examples/owl-enabled-node-secrets-app
npm install && npm start

Full-featured React Todo app (every OWASP category, one product)

cd examples/owl-enabled-react-todo-app
npm install && npm run dev

Live demo: guileless-basbousa-a2bd63.netlify.app


Available Scripts

npm run check    # lint + test (full quality gate)
npm run test     # Jest unit tests only
npm run lint     # ESLint only
npm run build    # Build ESM + CJS outputs

CI/CD Baseline

- name: Install
  run: npm ci

- name: Quality gate
  run: npm run check

- name: Build
  run: npm run build

Further Reading

Resource Description
docs/api-reference.md Complete API with copyable examples
docs/architecture.md Architecture, module layout, and adoption guide
docs/troubleshooting.md Common issues and resolutions

Contributing to OWL

Contributors   OWASP Slack


Project Leader

Name Role Contact
Sreejith Sreekandan Nair OWL Project Leader cybersreejith@gmail.com

Ways to Contribute

Type How
๐Ÿ› Bug fix Open an issue first, then a focused PR
โœจ New security control Discuss on Slack or open a feature issue first
๐Ÿ“– Docs improvement Direct PR welcome
๐Ÿงช Additional tests Always welcome โ€” especially failure paths
๐Ÿ” Security review Review open PRs for security impact

Quickstart

# 1. Fork and clone
git clone https://github.com/<you>/www-project-webshield-library.git
cd www-project-webshield-library

# 2. Install dependencies
npm install

# 3. Verify gate passes before any changes
npm run check

# 4. Create a branch
git checkout -b feature/your-change

# 5. Keep gate green throughout development
npm run check

# 6. Open a pull request against main

Pull Request Checklist

Before submitting, confirm all of the following:

  • npm run check passes (lint + tests)
  • Changes align with OWASP principles and project goals
  • Existing behavior is not silently broken
  • Tests cover new code including failure and abuse paths
  • PR description includes: what, why, and how to verify
  • Docs updated if the public API or any security default changes

Testing Requirements

OWL enforces security-first testing. All contributions to core modules or adapter hooks must include:

Scenario Required?
Successful operation โœ…
Invalid input or boundary conditions โœ…
Security rejection path (deny, block, throw) โœ…
Error code and metadata shape โœ… for SecurityError throws
npm run test

Community


Security Reporting

Do not open public issues for vulnerabilities.

Follow the private reporting process in SECURITY.md.