Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the old WithMaxBufferSize option as previously warned #1218

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jwe/jwe.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Settings(options ...GlobalOption) {
maxPBES2Count = option.Value().(int)
case identMaxDecompressBufferSize{}:
maxDecompressBufferSize = option.Value().(int64)
case identMaxBufferSize{}:
case identCBCBufferSize{}:
aescbc.SetMaxBufferSize(option.Value().(int64))
}
}
Expand Down
6 changes: 3 additions & 3 deletions jwe/jwe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,10 @@ func TestGHSA_7f9x_gw85_8grf(t *testing.T) {
}
}

func TestMaxBufferSize(t *testing.T) {
func TestCBCBufferSize(t *testing.T) {
// NOTE: This has GLOBAL EFFECT
jwe.Settings(jwe.WithMaxBufferSize(1))
defer jwe.Settings(jwe.WithMaxBufferSize(0))
jwe.Settings(jwe.WithCBCBufferSize(1))
defer jwe.Settings(jwe.WithCBCBufferSize(0))

key, err := jwxtest.GenerateRsaJwk()
require.NoError(t, err, `jwxtest.GenerateRsaJwk should succeed`)
Expand Down
8 changes: 3 additions & 5 deletions jwe/options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,13 @@ options:
This option can be used for `jwe.Settings()`, which changes the behavior
globally, or for `jwe.Decrypt()`, which changes the behavior for that
specific call.
- ident: MaxBufferSize
- ident: CBCBufferSize
interface: GlobalOption
argument_type: int64
comment: |
WithMaxBufferSize specifies the maximum buffer size for internal
WithCBCBufferSize specifies the maximum buffer size for internal
calculations, such as when AES-CBC is performed. The default value is 256MB.
If set to an invalid value, the default value is used.
In v2, this option was called MaxBufferSize.

This option has a global effect.

Due to historical reasons this option has a vague name, but in future versions
it will be appropriately renamed.
32 changes: 15 additions & 17 deletions jwe/options_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jwe/options_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading