jwx

Implementation of various JWx (Javascript Object Signing and Encryption/JOSE) technologies

MIT License

Stars
1.9K
Committers
62

Bot releases are hidden (Show)

jwx - v1.2.17

Published by lestrrat almost 3 years ago

v1.2.17 12 Jan 2022
[Miscellaneous]
  * Re-release v1.2.16 as v1.2.17 because of an error in the release process.
    The code is exactly the same as what v1.2.16 intended to release.
    v1.2.16 has been retracted in go.mod.

The content for v1.2.16 is left below for reference:

v1.2.16 12 Jan 2022

  THIS VERSION HAS BEEN RETRACTED. PLEASE USE v1.2.17

[Bug Fixes]
  * Peviously, `jws.Sign()` could not create a signed payload with
    detached and unencoded payload, even when the documentation said it could.
    Now you may use the `jws.Sign()` in the following way to create
    a JWS message with detached, unencoded state:

       hdrs := jws.NewHeaders()
       hdrs.Set("b64", false)
       hdrs.Set("crit", "b64")
       jws.Sign(nil, alg, key, jws.WithDetachedPayload(payload), jws.WithHeaders(hdrs))

    Notice the use of `nil` for the first parameter, and the use of
    `jws.WithDetachedPayload()`.

    We realize this is not exactly a clean API, but this is currently the
    only way to implement this in a backward-compatible fashion. Most likely
    this will change in a future major version.
[Miscellaneous]
  * `jws.WithDetachedPayload()` is now of type `jws.SignVerifyOption`, which
    satisfies both `jws.SignOption` and `jws.VerifyOption`
jwx - v1.2.16

Published by lestrrat almost 3 years ago

v1.2.16 12 Jan 2022
[Bug Fixes]
  * Peviously, `jws.Sign()` could not create a signed payload with
    detached and unencoded payload, even when the documentation said it could.
    Now you may use the `jws.Sign()` in the following way to create
    a JWS message with detached, unencoded state:

       hdrs := jws.NewHeaders()
       hdrs.Set("b64", false)
       hdrs.Set("crit", "b64")
       jws.Sign(nil, alg, key, jws.WithDetachedPayload(payload), jws.WithHeaders(hdrs))

    Notice the use of `nil` for the first parameter, and the use of
    `jws.WithDetachedPayload()`.

    We realize this is not exactly a clean API, but this is currently the
    only way to implement this in a backward-compatible fashion. Most likely
    this will change in a future major version.
[Miscellaneous]
  * `jws.WithDetachedPayload()` is now of type `jws.SignVerifyOption`, which
    satisfies both `jws.SignOption` and `jws.VerifyOption
jwx - v1.2.15

Published by lestrrat almost 3 years ago

v1.2.15 07 Jan 2022
[New Features]
  * `(jwk.AutoRefresh).Remove()` has been implemented.
[Bug Fixes]
  * ES256K is now included in the list of JWS inferred algorithms, if it's
    enabled via -tags jwx_es256k
[Miscellaneous]
  * `jwt.Parse` has been improved for efficiency and has more tests to
    cover corner cases.
  * Documentation fixes
jwx - v1.2.14

Published by lestrrat almost 3 years ago

v1.2.14 22 Dec 2021
[New Features]
  * `jwk.Fetch()` and `(*jwk.AutoRefresh).Configure()` can now take `jwk.Whitelist`
    object to check for the validity of a url to be fetched
  * `jws.VerifyAuto()` has been added to verify payloads that can be verified
    using the JWK set provided in the "jku" field. This function is purposely
    separated from the `jws.Verify()` function because 1) the required parameters
    are different, and 2) Users MUST be aware that they are doing a totally
    different operation than a regular `jws.Verify()`
  * `(jwk.AutoRefresh).IsRegistered()` has been added.

[Bug fixes]
  * `jws.SignMulti()` has been fixed to assign the "kid" field of the key used
    for signing the payload
  * `jws.SignMulti()` has been fixed to respect the "kid" field of the protected
    header, not the public header
jwx - v1.2.13

Published by lestrrat almost 3 years ago

v1.2.13 07 Dec 2021
[New Features]
  * `jwt` package now has a `Builder` that may make it easier to programmatically
    create a JWT for some users.
  * `jwt` errors now can be distinguished between validation errors and others.
    Use `jwt.IsValidationError()` to check if it's a validation error, and then
    use `errors.Is()` to check if it's one of the known (oft-used) errors
jwx - v1.2.12

Published by lestrrat almost 3 years ago

v1.2.12 01 Dec 2021
[New Features]
  * `jwk.Set` can now parse private parameters. For example, after parsing
    a JWKS serialized as `{"foo": "bar", "keys": [...]}`, users can get to
    the value of `"foo"` by calling `set.Field("foo")`
  * `jwk.Set` now has `Set()` method to set field values.
jwx - v1.2.11

Published by lestrrat almost 3 years ago

v1.2.11 14 Nov 2021
[Security Fix]
  * It was reported that since v1.2.6, it was possible to craft
    a special JSON object to bypass JWT verification via `jwt.Parse`.
    If you relied on this module to perform all the verification,
    upgrade is strongly recommended.
jwx - v1.2.10

Published by lestrrat almost 3 years ago

v1.2.10 09 Nov 2021
[Bug fixes]
  * Parsing OpenID claims were not working for some fields.
    This was caused by the same problem as the problem fixed in v1.2.9.
    Proper tests have been added.
jwx - v1.2.9

Published by lestrrat almost 3 years ago

v1.2.9 26 Oct 2021
[Bug fixes]
  * Parsing `key_ops` for JWKs which was broken in v1.2.8 has been fixed.
jwx - v1.2.8

Published by lestrrat almost 3 years ago

v1.2.8 21 Oct 2021
[Miscellaneous]
  * `jws.Message`, `jws.Signature`, `jws.Headers` have been reworked
    to allow JSON messages to be verified correctly. The problem can
    be caused when protected headers are serialized one way (perhaps
    `{"c":3","a":1,"b":2}` was used before being base64-encoded) but
    the Go serialization differed from it (Go serializes in alphabetical
    order: `{"a":1,"b":2,"c":3}`)

    Messages serialized in compact form do NOT suffer from the
    same problem.

    This is close to fixes that went in v1.2.2. It boils down to the
    fact that once deserialized, the JWS messages lose part of its
    information (namely, the raw, original protected header value),
    and neither users nor the developers of this library should
    rely on it.

  * Code generation has be refactored. The main go.mod should now
    have slightly less dependencies.
jwx - v1.2.7

Published by lestrrat about 3 years ago

Lots of usability improvements around jwt.Parse() and jwt.Validate() !

v1.2.7 26 Sep 2021
[New features]
  * `jwt.InferAlgorithmFromKey()` option is now available to "guess"
    the algorithm used to verify the JWS signature on a JWT using
    a JWKS (key set). This allows you to match JWKs that do not have
    the `alg` field populated.

    We understand that some providers do not provide the `alg` field,
    which is a nuisance to users. But from a purely security minded PoV,
    we don't think that this "try until something works" approach is a
    good one, even if there are no known exploits. This is why the
    default `jwt.Parse` mechanism is unchanged, and an explicit option
    has been added.

  * Types `jwt.KeySetProvider` and `jwk.KeySetProviderFunc` have been
    added. Along with `jwt.WithKeySetProvider()` option, `jwt.Parse`
    can now choose the `jwk.Set` to use for signature verification
    dynamically using the UNVERFIEID token as a clue.

    You should NOT trust the token information too much. For example,
    DO NOT directly use values from the token as verificatin parameters
    (such as the signature algorithm)

  * `jwt.WithValidator()` has been added to allow users pass in aribtrary
    validation code to the `jwt.Validate()` method.

    It is also now possible to pass in a `context.Context` object to
    `jwt.Validate()` using `jwt.WithContext()` option.
jwx - v1.2.6

Published by lestrrat about 3 years ago

v1.2.6 24 Aug 2021
[New features]
  * Support `crypto.Signer` keys for RSA, ECDSA, and EdDSA family
    of signatures in `jws.Sign`
[Miscellaneous]
  * `jwx.GuessFormat()` now requires the presense of both `payload` and
    `signatures` keys for it to guess that a JSON object is a JWS message.
  * Slightly enhance `jwt.Parse()` performance.
jwx - v1.2.5

Published by lestrrat about 3 years ago

v1.2.5 04 Aug 2021
[New features]
  * Implement RFC7797. The value of the header field `b64` changes
    how the payload is treated in JWS
  * Implement detached payloads for JWS
  * Implement (jwk.AutoRefresh).ErrorSink() to register a channel
    where you can receive errors from fetches and parses that occur during
    JWK(s) retrieval.
jwx - v1.2.4

Published by lestrrat over 3 years ago

v1.2.4 15 Jul 2021
[Bug fixes]
  * We had the same off-by-one in another place and jumped the gun on
    releasing a new version. At least we were making mistakes uniformally :/
    `(jwk.Set).Remove` should finally be fixed.

[New features]
  * `(jwk.Set).Clone()` has been added.
jwx - v1.2.3

Published by lestrrat over 3 years ago

v1.2.3 15 Jul 2021
[Buf fixes]
  * jwk.Set incorrectly removed 2 elements instead of one.

[Miscellaneous]
  * github.com/goccy/go-json has been upgraded to v0.7.4
jwx -

Published by lestrrat over 3 years ago

v1.2.2 13 Jul 2021
[Deprecation notice]
  * `(jwe.Message).Decrypt()` will be removed from the API upon the next
    major release.

[Bug Fixes]
  * `jwe.Decrypt` and `(jwe.Message).Decrypt()` failed to decrypt even
    with the correct message contents when used along with `jwe.RegisterCustomField`

[New features]
  JWX
  * Add GuessFormat() function to guess what the payload is.

  JWT
  * Options `jwt.WithMinDelta()`, `jwt.WithMaxDelta()` have been added.
    These can be used to compare time-based fields in the JWT object.
  * Option `jwt.WithRequiredClaim()` has been added. This can be used
    to check that JWT contains the given claim.
  * `jwt.Parse` now understands payloads that have been encrypted _and_ signed.
    This is more in line with the RFC than the previous implementation, but
    due to the fact that it requires a couple of extra unmarshaling, it may
    add some amount of overhead.
  * `jwt.Serializer` has been added as an easy wrapper to perform multiple
     levels of serializations (e.g. apply JWS, then JWE)

  JWE
  * Option `jwe.WithMessage()` has been added. This allows the user to
    obtain both the decrypted payload _and_ the raw `*jwe.Message` in one
    go when `jwe.Decrypt()` is called
  * Option `jwe.WithPostParser()`, along with `jwe.PostParser` and `jwe.PostParseFunc`
    has been added. This allows advanced users to hook into the `jwe.Decrypt()`
    process. The hook is called right after the JWE message has been parsed,
    but before the actual decryption has taken place.
  * `(jwe.Message).Decrypt()` has been marked for deprecation in a next major release.

  JWS
  * Option `jwe.WithMessage()` has been added. This allows the user to
    obtain both the verified payload _and_ the raw `*jws.Message` in one
    go when `jws.Verify()` is called
  * Options to `jws.Sign()` are not of type `jws.SignOption`. There should be
    no user-visible effects unless you were storing these somewhere.
jwx - v1.2.1

Published by lestrrat over 3 years ago

v1.2.1 02 Jun 2021
[New features]
  * Option `jwt.WithTypedClaim()` and `jwk.WithTypedField()` have been added.
    They allow a per-object custom conversion from their JSON representation
    to a Go object, much like `RegisterCustomField`.

    The difference is that whereas `RegisterCustomField` has global effect,
    these typed fields only take effect in the call where the option was
    explicitly passed.

    `jws` and `jwe` does not have these options because
    (1) JWS and JWE messages don't generally carry much in terms of custom data
    (2) This requires changes in function signatures.

    Only use these options when you absolutely need to. While it is a powerful
    tool, they do have many caveats, and abusing these features will have
    negative effects. See the documentation for details
jwx - v1.2.0

Published by lestrrat over 3 years ago

This is a security fix release with minor incompatibilities from earlier version
with regards to the behavior of `jwt.Verify()` function

[Security Fix]
  * `jwt.Verify()` had improperly used the `"alg"` header from the JWS message
    when `jwt.WithKeySet()` option was used (potentially allowing exploits
    described in https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/.
    This has been fixed by ONLY trusting the keys that you provide and
    using the `"alg"` header from the keys themselves. (#375, #381)

    As a side effect, `jwt.WithKeySet()` requires that all applicable keys
    to contain a valid `"alg"` header. Without this we cannot safely choose a key to use,
    and hence verification will fail.

    The requirement for the `"alg"` header on keys is an INCOMPATIBLE behavior.
    This may break existing code, if the key does not already have an `"alg"` header.

[New features]
  * `jwt.Settings()` and `jwt.WithFlattenAudience(bool)` has been added
    to control how the "aud" claim is serialized into JSON. When this
    is enabled, all JWTs with a single "aud" claim will serialize
    the field as a single string, instead of an array of strings with
    a single element, i.e.:

    // jwt.WithFlattenAudience(true)
    {"aud": "foo"}

    // jwt.WithFlattenAudience(false)
    {"aud": ["foo"]}

    This setting has a global effect.

[Bug fixes]
  * jwt.Validate now returns true if the value in `nbf` field is exactly
    the same as what the clock returns (e.g. token.nbf == time.Now())
jwx - v1.1.7

Published by lestrrat over 3 years ago

v1.1.7 2 Apr 2021
[New features]
  * `jwk.New` `jwk.Parse`, `jwk.ParseKey` can now take a Certificate in
    ASN.1 DER format in PEM encoding to create a JWK.

[Bug fixes]
  * Protect `jwk.New()` from invalid RSA/ECDSA keys (#360, #361)

[Miscellaneous]
  * Removed "internal/blackmagic" and separated it to its own repository.
  * Removed unused "marshal proxy" objects in jwt
  * Added FAQ in `jwt` package
jwx - v1.1.6

Published by lestrrat over 3 years ago

v1.1.6 28 Mar 2021
[Bug fixes]
  * When an object (e.g. JWT) has a null value and `AsMap()` is called,
    `github.com/lestrrat-go/iter` would panic.
    This should be fixed in `github.com/lestrrat-go/[email protected]` and
    the dependency has been updated accordingly

[Miscellaneous]
  * Added How-to style docs under `docs/`
  * github.com/goccy/go-json dependency has been updated to v0.4.8