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.0release - Coverage: A01-A10 modules
- Stack: Framework-agnostic core + React adapter
- Quality: ESLint, Jest, CI workflows, and security gates
Project Links
Project Leader
- Sreejith Nair
- GitHub: @cybersreejith
OWASP Web Shield Library (OWL)
Practical, reusable OWASP Top 10 security controls for modern JavaScript applications.
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.
Project Links
| Resource | Link |
|---|---|
| ๐ API Reference | docs/api-reference.md |
| ๐ Source | github.com/OWASP/www-project-webshield-library |
| ๐ Examples | examples/ |
| ๐ Issues | GitHub Issues |
Getting Started
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
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 checkpasses (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
- Join OWASP Slack
- Channel:
#project-webshield-library - OWASP Code of Conduct
- CODE_OF_CONDUCT.md
Security Reporting
Do not open public issues for vulnerabilities.
Follow the private reporting process in SECURITY.md.