From 65c1d1f03a1ba898fc6c7e809b0d5874a9e04dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dobranowski?= Date: Tue, 23 Jun 2026 11:42:35 +0200 Subject: [PATCH] Support Erlang/OTP 29 --- .github/workflows/ci.yml | 6 ++-- .github/workflows/release.yml | 2 +- .github/workflows/revert-release.yml | 2 +- rebar.config | 50 ++++++++++++++-------------- src/fast_scram.erl | 16 +++------ src/fast_scram_configuration.erl | 3 +- 6 files changed, 36 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d543ee9..2a7caba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: name: OTP ${{matrix.otp}} strategy: matrix: - otp: ['28', '27', '26'] + otp: ['29', '28', '27'] rebar3: ['3.27.0'] runs-on: 'ubuntu-24.04' env: @@ -28,10 +28,10 @@ jobs: - run: rebar3 do ct --cover - run: rebar3 as test codecov analyze - run: rebar3 dialyzer - if: ${{ matrix.otp == '28' }} + if: ${{ matrix.otp == '29' }} - name: Upload code coverage uses: codecov/codecov-action@v4 - if: ${{ matrix.otp == '28' }} + if: ${{ matrix.otp == '29' }} with: files: _build/test/covertool/fast_scram.covertool.xml token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ab30256..1463505 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v6 - uses: erlef/setup-beam@v1 with: - otp-version: "28" + otp-version: "29" rebar3-version: "3.27" - run: rebar3 compile - run: rebar3 hex publish -r hexpm --yes diff --git a/.github/workflows/revert-release.yml b/.github/workflows/revert-release.yml index 42f8770..165312d 100644 --- a/.github/workflows/revert-release.yml +++ b/.github/workflows/revert-release.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v6 - uses: erlef/setup-beam@v1 with: - otp-version: "28" + otp-version: "29" rebar3-version: "3.27" - run: rebar3 hex publish --revert ${{ inputs.version }} -r hexpm --yes env: diff --git a/rebar.config b/rebar.config index 266416f..d125777 100644 --- a/rebar.config +++ b/rebar.config @@ -7,16 +7,13 @@ {project_plugins, [ {rebar3_hex, "~> 7.0"}, {rebar3_ex_doc, "~> 0.2"}, - {rebar3_lint, "~> 3.2"}, + {rebar3_lint, "~> 5.0"}, {erlfmt, "~> 1.6"} ]}. {profiles, [ {test, [ {erl_opts, []}, - {deps, [ - {proper, "1.5.0"} - ]}, {plugins, [ {rebar3_codecov, "0.7.0"} ]}, @@ -38,27 +35,30 @@ ]}. {elvis, [ - #{ - dirs => ["src/**"], - filter => "*.erl", - ruleset => erl_files, - rules => [ - {elvis_style, private_data_types, disable}, - {elvis_style, atom_naming_convention, #{ - regex => "^([a-z][a-zA-Z0-9_]*_?)*$" - }} - ] - }, - #{ - dirs => ["."], - filter => "rebar.config", - ruleset => rebar_config - }, - #{ - dirs => ["src/**"], - filter => "*.hrl", - ruleset => hrl_files - } + {config, [ + #{ + files => ["src/**/*.erl"], + ruleset => erl_files, + rules => [ + {elvis_style, private_data_types, disable}, + {elvis_style, dont_repeat_yourself, disable}, + {elvis_style, atom_naming_convention, #{ + regex => "^([a-z][a-zA-Z0-9_]*_?)*$" + }} + ] + }, + #{ + files => ["rebar.config"], + ruleset => rebar_config + }, + #{ + files => ["src/**/*.hrl"], + ruleset => hrl_files, + rules => [ + {elvis_style, no_includes, disable} + ] + } + ]} ]}. {hex, [ diff --git a/src/fast_scram.erl b/src/fast_scram.erl index 6933517..06732f5 100644 --- a/src/fast_scram.erl +++ b/src/fast_scram.erl @@ -250,9 +250,7 @@ parse_client_first_message(ClientIn, State0) -> ], Chunks = binary:split(ClientIn, <<",">>, [global]), case match_rules(Chunks, Rules, State0) of - {UnusedRules, State1 = #fast_scram_state{}} when - is_list(UnusedRules), length(UnusedRules) == 1 - -> + {[_], State1 = #fast_scram_state{}} -> ClientFirstMsgBare = extract_client_first_msg_bare_from_first(Chunks, ClientIn), State2 = fast_scram_parse_rules:append_to_auth_message_in_state( State1, ClientFirstMsgBare @@ -276,9 +274,7 @@ parse_server_first_message(ServerIn, State0) -> ], ServerInChunks = binary:split(ServerIn, <<",">>, [global]), case match_rules(ServerInChunks, Rules, State0) of - {UnusedRules, State1 = #fast_scram_state{}} when - is_list(UnusedRules), length(UnusedRules) == 1 - -> + {[_], State1 = #fast_scram_state{}} -> State2 = fast_scram_parse_rules:append_to_auth_message_in_state( State1, <<",", ServerIn/binary>> ), @@ -299,9 +295,7 @@ parse_client_final_message(ClientIn, State0) -> ], ClientInList = binary:split(ClientIn, <<",">>, [global]), case match_rules(ClientInList, Rules, State0) of - {UnusedRules, State1 = #fast_scram_state{}} when - is_list(UnusedRules), length(UnusedRules) == 0 - -> + {[], State1 = #fast_scram_state{}} -> ClientFinalNoProof = extract_client_final_no_proof(ClientIn), State2 = fast_scram_parse_rules:append_to_auth_message_in_state( State1, <<",", ClientFinalNoProof/binary>> @@ -323,9 +317,7 @@ parse_server_final_message(ServerIn, State0) -> ], ServerInChunks = binary:split(ServerIn, <<",">>, [global]), case match_rules(ServerInChunks, Rules, State0) of - {UnusedRules, State1 = #fast_scram_state{}} when - is_list(UnusedRules), length(UnusedRules) == 1 - -> + {[_], State1 = #fast_scram_state{}} -> {ok, State1}; {error, Reason} -> {error, Reason} diff --git a/src/fast_scram_configuration.erl b/src/fast_scram_configuration.erl index 834bdef..204147f 100644 --- a/src/fast_scram_configuration.erl +++ b/src/fast_scram_configuration.erl @@ -130,7 +130,8 @@ set_val_in_state(it_count, Num, #fast_scram_state{challenge = Ch} = St) when set_val_in_state(salt, Bin, #fast_scram_state{challenge = Ch} = St) when is_binary(Bin) -> St#fast_scram_state{challenge = Ch#challenge{salt = Bin}}; set_val_in_state(channel_binding, {Type, Data}, #fast_scram_state{channel_binding = CB} = St) when - is_atom(Type) orelse is_binary(Type), is_binary(Data) + is_atom(Type), is_binary(Data); + is_binary(Type), is_binary(Data) -> St#fast_scram_state{channel_binding = CB#channel_binding{variant = Type, data = Data}}; set_val_in_state(hash_method, HM, #fast_scram_state{scram_definitions = SD} = St) when