npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@owasp-webshield/vue

v2.0.0

Published

Vue 3 adapter for OWL (OWASP Webshield Library): a plugin, category-aligned composables, guard components, a sanitizing v-safe-html directive and a Vue Router guard for @owasp-webshield/core

Readme

@owasp-webshield/vue

Vue 3 adapter for OWL (OWASP Webshield Library). It provides a plugin, category-aligned composables and guard components for @owasp-webshield/core, covering every OWASP Top 10 category (A01–A10). It also adds a sanitizing v-safe-html directive and a Vue Router guard.

Installation

npm install @owasp-webshield/core @owasp-webshield/vue

Requires vue 3.3 or later. vue-router 4 or later is needed only for createOwlRouterGuard().

Quick start

// main.js
import { createApp } from "vue";
import { createOwlClient } from "@owasp-webshield/core";
import { createOwl, vSafeHtml } from "@owasp-webshield/vue";
import App from "./App.vue";

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

createApp(App).use(owl).directive("safe-html", vSafeHtml).mount("#app");
<!-- Reports.vue -->
<script setup>
import { AuthGate, PermissionGate, useAuth } from "@owasp-webshield/vue";
const { session } = useAuth();
defineProps({ report: Object });
</script>

<template>
  <AuthGate>
    <PermissionGate action="read" resource="reports">
      <h1>Reports for {{ session.userId }}</h1>
      <div v-safe-html="report.summary"></div>
      <template #fallback>You can't view reports.</template>
    </PermissionGate>
    <template #fallback>Please sign in.</template>
  </AuthGate>
</template>

Auth state is reactive. Logging in, logging out, a token refresh or a token expiring updates useAuth(), usePermission() and the gates without a reload.

Module map

| Category | Exports | |---|---| | A01 Access Control | usePermission, useACL, PermissionGate | | A02 Crypto Integrity | useCryptoManager (Node-only for real encryption: safe to import in a browser build, but its methods throw there) | | A03 Injection Defense | useInputSanitizer, SanitizedText, vSafeHtml | | A04 Insecure Design Guard | useThreatModelGuard | | A05 Security Misconfiguration | useHardeningReport | | A06 Vulnerable Components | useDependencyRiskScanner | | A07 Auth Session | useAuth, useAuthToken, AuthGate | | A08 Data Integrity | useSecureHttpClient, withSecurityHeaders | | A09 Logging Monitoring | useSecurityMonitoring, SecurityAlert | | A10 SSRF Defense | useSafeFetcher | | Setup | createOwl, provideOwl, useOwl | | Routing | installOwlRouterGuard, createOwlRouterGuard |

Composable arguments can be plain values, refs or getters. Composables that build a core object (useSecureHttpClient, useSafeFetcher, useInputSanitizer, ...) return a ComputedRef that is rebuilt when a reactive argument changes.

v-safe-html

A drop-in replacement for v-html, which is Vue's most common XSS sink. The value goes through InputSanitizer before it is inserted:

<div v-safe-html="comment.body"></div>                 <!-- strict: text only -->
<div v-safe-html:moderate="post.body"></div>           <!-- formatting tags, safe links and images -->
<div v-safe-html="{ html: post.body, profile: 'moderate', allowedClasses: ['note'] }"></div>

Turn on eslint-plugin-vue's vue/no-v-html rule so that new v-html uses get flagged. During server-side rendering, the directive needs Vue 3.4.36 or later; older versions render an empty element on the server and fill it in on the client.

Router guard

import { installOwlRouterGuard } from "@owasp-webshield/vue";

const routes = [
  { path: "/account", component: Account, meta: { requiresAuth: true } },
  { path: "/reports/:id", component: Report,
    meta: { permission: { action: "read", resource: (to) => `report:${to.params.id}` } } }
];

installOwlRouterGuard(router, owl, { loginRoute: "/login", forbiddenRoute: "/403" });

installOwlRouterGuard() checks every navigation, and also re-checks the open page when the session changes: a logout or an expired token redirects to the login page, and losing the permission redirects to the forbidden route. Use router.beforeEach(createOwlRouterGuard(owl, options)) if you only want the navigation check.

Security notes

  • AuthGate, PermissionGate and the router guard only decide what the UI shows. The server must still authorize every request; see @owasp-webshield/express.
  • With server-side rendering (Nuxt, createSSRApp), call createOwl() inside the app factory so every request gets its own managers. A module-level instance would share one user's session with every other request.
  • useSecureHttpClient() sends the server's XSRF-TOKEN cookie as X-CSRF-Token, which matches @owasp-webshield/express's defaults. It never makes up a CSRF token in the browser.

Documentation

License

Apache-2.0. See the main repository for the full license text and contribution guidelines.