Giter VIP home page Giter VIP logo

jadsonlucena / signedaccess.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 83 KB

Sign and verify URLs and cookies to add a layer of protection to publicly accessible routes

Home Page: https://www.npmjs.com/package/@jadsonlucena/signedaccess

License: MIT License

JavaScript 100.00%
access-control access-token signed-cookies signed-requests signed-url access-integrity session-security signed-access nodejs node-module

signedaccess.js's Introduction

SignedAccess

CodeQL Test Coverage JavaScript Style Guide Conventional Commits

Sign and verify URLs and cookies to add a layer of protection to publicly accessible routes

Which is?

A signed URL or signed cookie provides limited time and permission for non-credentialed origins to perform a number of specific actions on one resource or several based on a common prefix. The subscription ensures that the permissions for a particular resource are not modified or tampered with.

Features

  • Sign and verify URL and cookie
  • Freedom of choice in algorithm and encryption key
  • Access validity time
  • Possibility of using IP to prevent unauthorized access
  • Possibility to restrict which HTTP methods can be used in the request
  • Possibility to use nonce values to prevent replay attacks
  • Possibility to allow access to multiple URLs based on a common prefix

Interfaces

Although this is a javascript module, we use a typescript interface to maintain interoperability and better readability. See: src/SignedAccess.d.ts

It is recommended to end all pathnames with / unless you intentionally choose to end the pathname with a partial filename.
The pathname /data grants access to at least two of the following URLs:
example.com/database
example.com/data/file1

The signURL method needs to save the information in the searchParams, so the "expires, ip, method, nonce, prefix and signature" queries are reserved for this module's control. If your original url has one of these queries previously, it will be removed or overwritten to avoid conflicts in the signature verification.

The nonce is signed in the cookie or URL, but it's up to your application to save them and check if they've already been used.

Specifications

We strive to maintain complete code coverage in tests. With that, we provide all the necessary use cases for a good understanding of how this module works. See: test/SignedAccess.spec.js

signedaccess.js's People

Contributors

jadsonlucena avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.