Permission Guard
A zero-dependency, minimal permission guard for Deno to prevent overly permissive execution of your applications.
Table of Contents
Getting Started
import { guard } from "https://deno.land/x/permissionGuard@2.0.0/mod.ts";
await guard();
console.log("Execute my code...!");
Installation
This is a Deno module available to import direct from this repo and via the Deno Registry.
Before importing, download and install Deno.
You can then import Permission Guard straight into your project:
import { guard } from "https://deno.land/x/permissionGuard@2.0.0/mod.ts";
Permission Guard is also available on nest.land, a package registry for Deno on the Blockchain.
import { guard } from "https://x.nest.land/permissionGuard@2.0.0/mod.ts";
Note: Permission Guard makes use of the unstable Deno Permissions API which requires
--unstable
to be passed in the Denorun
command. You can use Permission Guard in applications and not provide the--unstable
flag, Permission Guard will simply return as a no-op and not provide any defenses.
Features
- Protection against unnecessary top-level permissions.
- Protection against missing required permissions.
- Recommendations where permissions could be better scoped (if
log: true
provided). - Useful logs detailing the missing or insecure permissions (if
log: true
provided).
Documentation
- Permission Guard Docs - usually the best place when getting started ✨
- Permission Guard Deno Docs
- License
- Changelog
Examples
To run the examples, you have two choices:
Clone the Permission Guard repo locally:
git clone git://github.com/asos-craigmorten/permission-guard.git --depth 1 cd permission-guard
Then run the example you want:
deno run --unstable ./examples/defaults/index.ts
All the examples contain example commands in their READMEs to help get you started.
Contributing
License
Permission Guard is licensed under the MIT License.