- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 170
Comparing changes
Open a pull request
base repository: lestrrat-go/jwx
base: v2.0.13
head repository: lestrrat-go/jwx
compare: v2.0.14
Commits on Jun 14, 2023
-
Merge pull request from GHSA-rm8v-mxj3-5rmq
### Summary Decrypting AES-CBC encrypted JWE has Potential Padding Oracle Attack Vulnerability. ### Details On [v2.0.10](https://github.com/lestrrat-go/jwx/releases/tag/v2.0.10), decrypting AES-CBC encrypted JWE may return an error "failed to generate plaintext from decrypted blocks: invalid padding": https://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213 ```go plaintext, err := unpad(buf, c.blockCipher.BlockSize()) if err != nil { return nil, fmt.Errorf(`failed to generate plaintext from decrypted blocks: %w`, err) } ``` Reporting padding error causes [Padding Oracle Attack](https://en.wikipedia.org/wiki/Padding_oracle_attack) Vulnerability. RFC 7516 JSON Web Encryption (JWE) says that we MUST NOT do this. > 11.5. Timing Attacks > To mitigate the attacks described in RFC 3218 [RFC3218], the > recipient MUST NOT distinguish between format, padding, and length > errors of encrypted keys. It is strongly recommended, in the event > of receiving an improperly formatted key, that the recipient > substitute a randomly generated CEK and proceed to the next step, to > mitigate timing attacks. In addition, the time to remove padding depends on the length of the padding. It may leak the length of the padding by Timing Attacks. https://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66 ```go func unpad(buf []byte, n int) ([]byte, error) { lbuf := len(buf) rem := lbuf % n // First, `buf` must be a multiple of `n` if rem != 0 { return nil, fmt.Errorf("input buffer must be multiple of block size %d", n) } // Find the last byte, which is the encoded padding // i.e. 0x1 == 1 byte worth of padding last := buf[lbuf-1] // This is the number of padding bytes that we expect expected := int(last) if expected == 0 || /* we _have_ to have padding here. therefore, 0x0 is not an option */ expected > n || /* we also must make sure that we don't go over the block size (n) */ expected > lbuf /* finally, it can't be more than the buffer itself. unlikely, but could happen */ { return nil, fmt.Errorf(`invalid padding byte at the end of buffer`) } // start i = 1 because we have already established that expected == int(last) where // last = buf[lbuf-1]. // // we also don't check against lbuf-i in range, because we have established expected <= lbuf for i := 1; i < expected; i++ { if buf[lbuf-i] != last { return nil, fmt.Errorf(`invalid padding`) } } return buf[:lbuf-expected], nil } ``` To mitigate Timing Attacks, it MUST be done in constant time. ### Impact The authentication tag is verified, so it is not an immediate attack. Co-authored-by: ICHINOSE Shogo <shogo82148@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for c8b6bec - Browse repository at this point
Copy the full SHA c8b6becView commit details -
Configuration menu - View commit details
-
Copy full SHA for a86a658 - Browse repository at this point
Copy the full SHA a86a658View commit details
Commits on Jun 20, 2023
-
Bump golang.org/x/crypto from 0.9.0 to 0.10.0 (#938)
* Bump golang.org/x/crypto from 0.9.0 to 0.10.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.9.0 to 0.10.0. - [Commits](golang/crypto@v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * run gazelle-update-repos --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 5db9579 - Browse repository at this point
Copy the full SHA 5db9579View commit details -
Bump github.com/lestrrat-go/jwx/v2 from 2.0.8 to 2.0.11 in /cmd/jwx (#…
…942) Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.8 to 2.0.11. - [Release notes](https://github.com/lestrrat-go/jwx/releases) - [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes) - [Commits](v2.0.8...v2.0.11) --- updated-dependencies: - dependency-name: github.com/lestrrat-go/jwx/v2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 886c4a0 - Browse repository at this point
Copy the full SHA 886c4a0View commit details -
Bump github.com/lestrrat-go/jwx/v2 from 2.0.8 to 2.0.11 in /examples (#…
…943) Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.8 to 2.0.11. - [Release notes](https://github.com/lestrrat-go/jwx/releases) - [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes) - [Commits](v2.0.8...v2.0.11) --- updated-dependencies: - dependency-name: github.com/lestrrat-go/jwx/v2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 0283140 - Browse repository at this point
Copy the full SHA 0283140View commit details -
Bump github.com/lestrrat-go/jwx/v2 in /bench/performance (#944)
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.8 to 2.0.11. - [Release notes](https://github.com/lestrrat-go/jwx/releases) - [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes) - [Commits](v2.0.8...v2.0.11) --- updated-dependencies: - dependency-name: github.com/lestrrat-go/jwx/v2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 2fa2a3b - Browse repository at this point
Copy the full SHA 2fa2a3bView commit details
Commits on Jun 21, 2023
-
remove unnecessarily err checks (#948)
godoc says hash.Hash.Write never returns an error: https://pkg.go.dev/hash#Hash > Write (via the embedded io.Writer interface) adds more data to the running hash. > It never returns an error. So, we don't need to check errors of Write in Hmac.ComputeAuthTag.
Configuration menu - View commit details
-
Copy full SHA for 82f7d5c - Browse repository at this point
Copy the full SHA 82f7d5cView commit details
Commits on Jun 22, 2023
-
* fix panic from empty seed Signed-off-by: AdamKorcz <adam@adalogics.com> * Add test case --------- Signed-off-by: AdamKorcz <adam@adalogics.com> Co-authored-by: AdamKorcz <adam@adalogics.com>
Configuration menu - View commit details
-
Copy full SHA for 246dde8 - Browse repository at this point
Copy the full SHA 246dde8View commit details
Commits on Jun 30, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 8149455 - Browse repository at this point
Copy the full SHA 8149455View commit details
Commits on Jul 3, 2023
-
* Do not ignore custom encrypt and sign options in jwt package Fixes #951 * Add test case * Update Changes --------- Co-authored-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 2d138a3 - Browse repository at this point
Copy the full SHA 2d138a3View commit details
Commits on Jul 7, 2023
-
Bump golang.org/x/crypto from 0.10.0 to 0.11.0 (#956)
* Bump golang.org/x/crypto from 0.10.0 to 0.11.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.10.0 to 0.11.0. - [Commits](golang/crypto@v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update bazel repos --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 976a058 - Browse repository at this point
Copy the full SHA 976a058View commit details
Commits on Aug 8, 2023
-
Bump golang.org/x/crypto from 0.11.0 to 0.12.0 (#963)
* Bump golang.org/x/crypto from 0.11.0 to 0.12.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.11.0 to 0.12.0. - [Commits](golang/crypto@v0.11.0...v0.12.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Run gazelle-update-repos --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 907b093 - Browse repository at this point
Copy the full SHA 907b093View commit details
Commits on Aug 10, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 006a93c - Browse repository at this point
Copy the full SHA 006a93cView commit details -
Configuration menu - View commit details
-
Copy full SHA for d882071 - Browse repository at this point
Copy the full SHA d882071View commit details -
Configuration menu - View commit details
-
Copy full SHA for bc71a61 - Browse repository at this point
Copy the full SHA bc71a61View commit details
Commits on Aug 14, 2023
-
Add example for using raw JWT (#967)
* Add example for using raw JWT * typo
Configuration menu - View commit details
-
Copy full SHA for f592f32 - Browse repository at this point
Copy the full SHA f592f32View commit details -
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 883af1b - Browse repository at this point
Copy the full SHA 883af1bView commit details
Commits on Sep 1, 2023
-
Configuration menu - View commit details
-
Copy full SHA for a536a34 - Browse repository at this point
Copy the full SHA a536a34View commit details -
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 7037a55 - Browse repository at this point
Copy the full SHA 7037a55View commit details
Commits on Sep 7, 2023
-
Bump actions/checkout from 3 to 4 (#974)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 8f8a15d - Browse repository at this point
Copy the full SHA 8f8a15dView commit details
Commits on Sep 8, 2023
-
Update HWK option documentation (#979)
* Update option documentation * reinstance CacheOption
Configuration menu - View commit details
-
Copy full SHA for d45d8eb - Browse repository at this point
Copy the full SHA d45d8ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0afb828 - Browse repository at this point
Copy the full SHA 0afb828View commit details
Commits on Sep 11, 2023
-
Bump golang.org/x/crypto from 0.12.0 to 0.13.0 (#976)
* Bump golang.org/x/crypto from 0.12.0 to 0.13.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.12.0 to 0.13.0. - [Commits](golang/crypto@v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Run gazelle-update-repos & make tidy --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for f589fb8 - Browse repository at this point
Copy the full SHA f589fb8View commit details
Commits on Sep 24, 2023
-
Bump github.com/lestrrat-go/blackmagic from 1.0.1 to 1.0.2 (#983)
* Bump github.com/lestrrat-go/blackmagic from 1.0.1 to 1.0.2 Bumps [github.com/lestrrat-go/blackmagic](https://github.com/lestrrat-go/blackmagic) from 1.0.1 to 1.0.2. - [Commits](lestrrat-go/blackmagic@v1.0.1...v1.0.2) --- updated-dependencies: - dependency-name: github.com/lestrrat-go/blackmagic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Run gazelle-update-repos * Run make tidy --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 2cce330 - Browse repository at this point
Copy the full SHA 2cce330View commit details
Commits on Sep 25, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c41f2a8 - Browse repository at this point
Copy the full SHA c41f2a8View commit details
Commits on Sep 26, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c68c06c - Browse repository at this point
Copy the full SHA c68c06cView commit details -
Configuration menu - View commit details
-
Copy full SHA for d0e9b47 - Browse repository at this point
Copy the full SHA d0e9b47View commit details -
Configuration menu - View commit details
-
Copy full SHA for de6bd31 - Browse repository at this point
Copy the full SHA de6bd31View commit details
Commits on Oct 14, 2023
-
add jwk.IsPrivate to check if an asymmetric key is public or private (#…
…994) * update jwk codegen for new unexported asymmetricKey extension interface * run the updated jwk codegen * add jwk asym key type constraint option to options.yaml * go run tools/cmd/genoptions/main.go -objects jwk/options.yaml * add WithPrivate validation logic to jwk.ParseKey * Revert "add WithPrivate validation logic to jwk.ParseKey" This reverts commit a921b2a. * Revert "go run tools/cmd/genoptions/main.go -objects jwk/options.yaml" This reverts commit 52a6af0. * Revert "add jwk asym key type constraint option to options.yaml" This reverts commit e7e20a1. * add IsPrivate function * export jwk.AsymmetricKey interface & move unit tests out of jwk_internal_test.go * rename local variable per code review suggestion * rename IsPrivate to IsPrivateKey --------- Co-authored-by: Shang Ding <$USER@epic.com>
Configuration menu - View commit details
-
Copy full SHA for 7aa6fec - Browse repository at this point
Copy the full SHA 7aa6fecView commit details
Commits on Oct 16, 2023
-
Bump golang.org/x/crypto from 0.13.0 to 0.14.0 (#993)
* Bump golang.org/x/crypto from 0.13.0 to 0.14.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.13.0 to 0.14.0. - [Commits](golang/crypto@v0.13.0...v0.14.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Run make tidy / gazelle-update-repos --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 051a1c6 - Browse repository at this point
Copy the full SHA 051a1c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2c061ee - Browse repository at this point
Copy the full SHA 2c061eeView commit details
Commits on Oct 17, 2023
-
* Move location where AsymmetricKey is defined * Tweak docs * Update Changes
Configuration menu - View commit details
-
Copy full SHA for 2503747 - Browse repository at this point
Copy the full SHA 2503747View commit details -
Configuration menu - View commit details
-
Copy full SHA for 42d47a7 - Browse repository at this point
Copy the full SHA 42d47a7View commit details
There are no files selected for viewing