Git Product home page Git Product logo

branca-spec's People

Contributors

brycx avatar hako avatar return avatar scottbrady91 avatar thadeu avatar tuupola 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

branca-spec's Issues

Go implementation

Go implementation is missing. Something similar as fernet-go by @kr. Anyone interested in implementing it write me a note here and I will add it to the docs.

Feedback

General feedback welcome here. Ie. Am I doing something wrong?

Typo in Ciphertext paragraph of README

Note that this is Authenticated Encryption with Additional Data (AEAD) where the he header part of the token is the additional data.

The word ‘he’ should be removed.

Missing License file

The README refers to a non-existing License file. This should probably be added.

Timestamp is not protected against tampering

If I understood the Branca specs correctly, the timestamp field seems to be unprotected.

Let's say a website uses Branca tokens as session cookies and relies on the timestamp field in order to check if the token is still valid. An attacker might get access to a valid or expired token and manipulate the timestamp field whenever needed in order to make the expired token valid again.
This applies not only to the context of websites and session cookies but to every possibly untrusted environment in which Branca tokens could be used.

As far as I can tell, the timestamp field doesn't provide any reliable information in an untrusted environment.

I'm writing this because not everyone using Branca tokens might be aware of that. I suggest to either make this very clear in the documentation or to change the spec so that tampering with the timestamp field can be detected.

branca.io Website is down

The branca.io website, linked in the about section of GitHub repositories and readme’s is down.

Base62 is actually Base61

The character set provided in the spec:

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy

Only contains 61 characters, and is thus a base61 encoding. Looking at the implementations listed on the document, it seems that most of them (if not all) include a z to the character set as I would expect.

Is this the intended behaviour? Or should the character set not include the character z?

Suggestion to expiration check

I think it would make sense to specifically state, that the expiration check for a token using a ttl should happen after authenticating and decrypting. If it happens before, a user would never know if an expired token they received was tampered into expiring, or actually did expire.

Python implementation

Python implementation is badly needed. Something similar as pyjwt by @jpadilla. Anyone interested in implementing it write me a note here and I will add it to the docs.

Suggestion to optional nonce protection

$size = CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES;
$random = random_bytes($size);
$nonce = sodium_crypto_generichash($payload, $random, $size);

I think it would be good to concretize this a bit to make it clearer, by specifically stating the algorithm this example uses (BLAKE2b IIRC). Also, what if sodium_crypto_generichash changes at some point? If we specifically state the algorithm tied to hashing for the nonce, we can tie that to the version and change it in the far future if need be. The last part is not too important, I'm more into specifying it to make it clear what algorithm is considered secure. In case a user might try to use something else, if libsodium is not accessible to them.

Is timestamp a security risk?

Is timestamp a security risk? Ie. should there be another version without timestamp in header?Currently it is possible to opt out by passing a 0 or false as timestamp. This still wastes a few bytes per request.

Current feeling is making another version just to save 4 bytes is not worth the hassle.

README and test vectors should reflect new 32 byte hex key expectations from branca-js

The Javascript reference implementation has recently changed to enforce the use of more secure 32 byte hex keys, or a 32 byte Buffer. This change is to require the use of cryptographic keys of the proper length and construction as expected by the underlying encryption algorithm.

https://github.com/tuupola/branca-js

The spec should be modified to:

  • add additional context to the spec README about why this change was made
  • note that it is likely a breaking change and thus might require version bumping the spec
  • modify the test vectors so they will work with the new key mechanism

Other downstream implementations should also be encouraged to adopt the new spec to maintain cross library interoperability.

Typo on branca.io

In the “What is Branca” opening section the word encrypted is spelled incorrectly as ‘ enrypted ’.

Ruby implementation

Ruby implementation is missing. Something similar as fernet-rb by @hgmnz. Anyone interested in implementing it write me a note here and I will add it to the docs.

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.