Giter Site home page Giter Site logo

rrrodzilla / rusty_paseto Goto Github PK

View Code? Open in Web Editor NEW
56.0 56.0 5.0 655 KB

A type-driven, ergonomic RUST implementation of the PASETO protocol for secure stateless tokens.

Home Page: https://crates.io/crates/rusty_paseto

License: MIT License

Rust 100.00%
auth authentication cryptography ed25519 encryption encryption-algorithms jwt jwt-auth jwt-authorization jwt-bearer-tokens jwt-token paseto paseto-tokens privacy rust rust-crate rust-lang rust-library security xchacha20-poly1305

rusty_paseto's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @rrrodzilla. I live on a sailboat with my family. Most of my code is created off-grid with solar power on the Pacific Ocean.
  • ๐Ÿ‘€ Iโ€™m interested in open source software and solutions that make the world a better place.
  • ๐ŸŒฑ Iโ€™ve been architecting technology solutions, leading software delivery teams and hacking code for over 25 years.
  • โ˜๏ธ Former Principal @ AWS focused on the Rust programming language and now owner and founder of Govcraft.

I've helped ship a few mainstream products and a bunch of large service delivery platforms for very large governments/telcos/retail/airlines/etc

Some notable projects Role Shipped
Microsoft LiveMeeting (breakout rooms feature) Architect 2004
Turkcell Service Delivery Platform (Turkey) SOA and Solution Architect 2005
Telstra Service Delivery Platform (Australia) SOA and Solution Architect 2006
Microsoft Dynamics 2008 Dev lead (SRM component) 2008
Microsoft Azure v1 TAP Architect 2009

rusty_paseto's People

Contributors

ebbdrop avatar rrrodzilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rusty_paseto's Issues

Wrong pasteo token cause runtime panic

Describe the bug
While testing i discovered a case where the library will panic instead of throwing an error. Explicitly while attempting a wrong token "v4.local.1234".

The error is

rusty_paseto-0.6.0/src/core/paseto.rs:766:47:
range end index 32 out of range for slice of length 3

To Reproduce
just try to decrypt "v4.local.1234"

Expected behavior
i was expecting to catch the error same as other errors.

Additional context
I think this problem could be solved by checking the length of the third part. I am interested to create a PR for this as first contribution.

Implement Paseto Token Parser

The generic parser handles decrypting the paseto structure (claims, etc) but does not enforce paseto logic such as validating expiration claim and other time related claims. The Paseto Token Parser should wrap the generic parser with the custom paseto logic.

Implement Paseto Token Builder

The generic builder handles building and enforcing paseto structure (claims, etc) but does not enforce paseto logic such as providing a default expiration claim and issue claim while allowing for overrides and non-expiring tokens. The Paseto Token Builder should wrap the generic builder with the custom paseto logic.

Project still active?

There aren't updates, commits or activity in 6 months.
Is the project still active and/or mantained?

De-dupe claim keys in builder

Claim keys should only appear once in the top-level JSON payload of the builder to prevent the user from accidentally overwriting claim data in a single build session which would cause confusion. Users should groups of duplicate keys in a child struct with a unique claim key to enable that scenario.

Docs PasetoParser::<V4, Local>

Hello, could you please add additional information to the docs that if token is expired, then PasetoParser::<V4, Local> will throw an error? That would be cool, because I was trying to find a way to verify token itself. It's a good design choice, but that was not mentioned in docs, or I'm simply blind (sorry ๐Ÿ˜ข)

Add closure to claim validation API

Currently, claim validation is a simple check that the claim exists in the decrypted token and the decrypted value matches the provided value. The API needs to be extended to allow the user to provide their own validation closure in order to support more complex validation scenarios.

Beginner question

Hey hey,

really nice implementation and an amazing documentation!

I'm new to rust and my problem might just stem from the fact that I do not know how to archive this the rust-way.

I'm trying to set a subject claim from a non-static reference/dynamic value in a trait implementation.

let token = PasetoBuilder::<V4, Local>::default()
  .set_claim(SubjectClaim::from(&id))
  .build(&key)
  .unwrap();

From what I understand the signature of set_claim required the argument to have a 'static lifetime which will not be possible for a dynamic value (I could be wrong).

How could this be archived?

plans for v3.public

What is your plans re v3.public will you be supporting it? If so do you have an ETA?

Implement Non-Expiring Token

The user needs to be able to explicitly specify when a token should NOT have an expiration date when building a claim.

Stray eprintln! in `GenericBuilder::set_implicit_assertion`

Describe the bug
Every time set_implicit_assertion on GenericBuilder is used, the assertion is printed to stdout.

To Reproduce

PasetoBuilder::<V4, Local>::default().set_implicit_assertion(ImplicitAssertion::from("example"));

Expected behavior
For a library to not write to stdout.

ed25519-dalek vulnerability

Describe the bug
Found vulnerability when ruining cargo audit.

To Reproduce
Steps to reproduce the behavior:

  1. just run cargo audit.

Expected behavior
the vulnerability can be resolved by bumping up the ed25519-dalek crate version.

Screenshots
Screenshot from 2023-11-05 23-04-20

Desktop (please complete the following information):

  • OS: Fedora
  • Browser chrome

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.