Skip to content

Support common name prefix/suffix for SASL External - #4580

Merged
telezynski merged 5 commits into
masterfrom
sasl-external-prefix
Nov 27, 2025
Merged

telezynski merged 5 commits into
masterfrom
sasl-external-prefix

Conversation

@chrzaszcz

@chrzaszcz chrzaszcz commented Nov 25, 2025 •

Copy link
Copy Markdown
Member

As suggested by @niecore, it might be useful to allow add prefix/suffix while converting a common_name to a user name (JID localpart) in the context of the SASL External authentication mechanism.

This PR includes the following changes:

  • Add a sasl_external_common_name subsection to auth configuration with two options: prefix and suffix.
  • Test the configuration options.
  • Test that the user name has the prefix/suffix when configured and used in SASL External.
  • Document the new options.

Other changes:

  • As also suggested by @niecore, a note is added about the possibility of using a custom verification module for SASL External.

More details in commit messages.

@mongoose-im

This comment was marked as outdated.

@codecov

codecov Bot commented Nov 25, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.01%. Comparing base (11a7424) to head (7b6fd70).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4580      +/-   ##
==========================================
+ Coverage   86.00%   86.01%   +0.01%     
==========================================
  Files         565      565              
  Lines       33905    33913       +8     
==========================================
+ Hits        29159    29170      +11     
+ Misses       4746     4743       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mongoose-im

This comment was marked as outdated.

@chrzaszcz
chrzaszcz force-pushed the sasl-external-prefix branch from 467caaa to 6036b19 Compare November 25, 2025 17:14
@chrzaszcz chrzaszcz changed the title Refactor sasl_external_SUITE Support common name prefix/suffix for SASL External Nov 25, 2025
@mongoose-im

This comment was marked as outdated.

@chrzaszcz
chrzaszcz changed the base branch from master to refactor-sasl-external-suite November 26, 2025 07:49
@chrzaszcz
chrzaszcz force-pushed the sasl-external-prefix branch from 6036b19 to c6217e2 Compare November 26, 2025 08:06
@mongoose-im

This comment was marked as outdated.

@chrzaszcz
chrzaszcz force-pushed the refactor-sasl-external-suite branch from 7aef188 to d80f0c5 Compare November 26, 2025 10:14
@chrzaszcz
chrzaszcz force-pushed the sasl-external-prefix branch from c6217e2 to 38f2f60 Compare November 26, 2025 10:16
@mongoose-im

This comment was marked as outdated.

@chrzaszcz
chrzaszcz force-pushed the refactor-sasl-external-suite branch from d80f0c5 to 11a7424 Compare November 26, 2025 16:14
@chrzaszcz
chrzaszcz force-pushed the sasl-external-prefix branch from 38f2f60 to c95f49c Compare November 26, 2025 16:22
@mongoose-im

This comment was marked as outdated.

The prefix/suffix are added to the common name in order to obtain
the user name.

The validator is 'jid_localpart', because a part of localpart needs
to be a valid localpart itself.
Early validation is easier to debug than subsequent auth failures.

Note that the section is not present by default.
Also: move default_auth() implementation to default_config/1
  to make it more consistent, and to make it usable with config/2
Check that the username is:
- Unchanged without prefix or suffix
- Changed with prefix and suffix
- Describe sasl_external_common_name.prefix/suffix
- Document the (previously undocumented) possibility of implementing
  your own verification module.
@chrzaszcz
chrzaszcz force-pushed the sasl-external-prefix branch from c95f49c to 7b6fd70 Compare November 26, 2025 16:52
@mongoose-im

mongoose-im commented Nov 26, 2025 •

Copy link
Copy Markdown
Collaborator

elasticsearch_and_cassandra_28 / elasticsearch_and_cassandra_mnesia / 7b6fd70
Reports root/ big
OK: 683 / Failed: 0 / User-skipped: 72 / Auto-skipped: 0


small_tests_28 / small_tests / 7b6fd70
Reports root / small


small_tests_27 / small_tests / 7b6fd70
Reports root / small


small_tests_28_arm64 / small_tests / 7b6fd70
Reports root / small


dynamic_domains_mysql_redis_28 / mysql_redis / 7b6fd70
Reports root/ big
OK: 5185 / Failed: 0 / User-skipped: 157 / Auto-skipped: 0


ldap_mnesia_27 / ldap_mnesia / 7b6fd70
Reports root/ big
OK: 2357 / Failed: 0 / User-skipped: 1359 / Auto-skipped: 0


ldap_mnesia_28 / ldap_mnesia / 7b6fd70
Reports root/ big
OK: 2357 / Failed: 0 / User-skipped: 1359 / Auto-skipped: 0


internal_mnesia_28 / internal_mnesia / 7b6fd70
Reports root/ big
OK: 2498 / Failed: 0 / User-skipped: 1218 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 7b6fd70
Reports root/ big
OK: 5220 / Failed: 0 / User-skipped: 122 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_28 / pgsql_mnesia / 7b6fd70
Reports root/ big
OK: 5220 / Failed: 0 / User-skipped: 122 / Auto-skipped: 0


pgsql_cets_28 / pgsql_cets / 7b6fd70
Reports root/ big
OK: 5310 / Failed: 0 / User-skipped: 195 / Auto-skipped: 0


cockroachdb_cets_28 / cockroachdb_cets / 7b6fd70
Reports root/ big
OK: 5312 / Failed: 1 / User-skipped: 195 / Auto-skipped: 0

pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3714@localhost/res1">>,
          escalus_tcp,<0.115269.0>,
          [{event_manager,<0.115257.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3714">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.115257.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3714">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3714">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3714">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"a8cf88ff55386880">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,444}]},
     {pubsub_tools,receive_and_c...

Report log


dynamic_domains_mssql_mnesia_28 / odbc_mssql_mnesia / 7b6fd70
Reports root/ big
OK: 5215 / Failed: 0 / User-skipped: 127 / Auto-skipped: 0


mysql_redis_28 / mysql_redis / 7b6fd70
Reports root/ big
OK: 5599 / Failed: 0 / User-skipped: 149 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 7b6fd70
Reports root/ big
OK: 5613 / Failed: 0 / User-skipped: 135 / Auto-skipped: 0


pgsql_mnesia_28 / pgsql_mnesia / 7b6fd70
Reports root/ big
OK: 5613 / Failed: 0 / User-skipped: 135 / Auto-skipped: 0


mssql_mnesia_28 / odbc_mssql_mnesia / 7b6fd70
Reports root/ big
OK: 5608 / Failed: 0 / User-skipped: 140 / Auto-skipped: 0

@chrzaszcz
chrzaszcz marked this pull request as ready for review November 27, 2025 07:30
Base automatically changed from refactor-sasl-external-suite to master November 27, 2025 08:31

@telezynski telezynski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@telezynski
telezynski merged commit 55eb8a3 into master Nov 27, 2025
4 checks passed
@telezynski
telezynski deleted the sasl-external-prefix branch November 27, 2025 08:48
@pawlooss1 pawlooss1 added this to the 6.5.0 milestone Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants