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

Fix anonymous login #3706

Merged
merged 3 commits into from
Jul 12, 2022
Merged

Fix anonymous login #3706

merged 3 commits into from
Jul 12, 2022

Conversation

chrzaszcz
Copy link
Member

This PR addresses issue #3703.
After covering the functionality with tests, another bug showed up.

The PR fixes both - see individual commits for details.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jul 11, 2022

small_tests_24 / small_tests / a1489df
Reports root / small


small_tests_25 / small_tests / a1489df
Reports root / small


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / a1489df
Reports root/ big
OK: 3121 / Failed: 1 / User-skipped: 88 / Auto-skipped: 1

anonymous_SUITE:anonymous:connection_is_registered_with_login
{error,{{badarity,{#Fun<anonymous_SUITE.1.88077589>,[]}},
    [{escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1292}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1224}]}]}}

Report log


ldap_mnesia_24 / ldap_mnesia / a1489df
Reports root/ big
OK: 1740 / Failed: 0 / User-skipped: 460 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / a1489df
Reports root/ big
OK: 3121 / Failed: 1 / User-skipped: 88 / Auto-skipped: 1

anonymous_SUITE:anonymous:connection_is_registered_with_login
{error,{{badarity,{#Fun<anonymous_SUITE.1.19843977>,[]}},
    [{escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log


dynamic_domains_mysql_redis_25 / mysql_redis / a1489df
Reports root/ big
OK: 3104 / Failed: 1 / User-skipped: 105 / Auto-skipped: 1

anonymous_SUITE:anonymous:connection_is_registered_with_login
{error,{{badarity,{#Fun<anonymous_SUITE.1.19843977>,[]}},
    [{escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / a1489df
Reports root/ big
OK: 3121 / Failed: 1 / User-skipped: 88 / Auto-skipped: 1

anonymous_SUITE:anonymous:connection_is_registered_with_login
{error,{{badarity,{#Fun<anonymous_SUITE.1.19843977>,[]}},
    [{escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log


ldap_mnesia_25 / ldap_mnesia / a1489df
Reports root/ big
OK: 1740 / Failed: 0 / User-skipped: 460 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / a1489df
Reports root/ big
OK: 1846 / Failed: 0 / User-skipped: 354 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / a1489df
Reports root/ big
OK: 3496 / Failed: 1 / User-skipped: 97 / Auto-skipped: 0

graphql_roster_SUITE:admin_roster:admin_invite_accept_and_cancel_subscription
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"bob_admin_invite_accept_and_cancel_subscription_874@localhost/res1">>,
          escalus_tcp,<0.22523.0>,
          [{event_manager,<0.22521.0>},
           {server,<<"localhost">>},
           {username,
             <<"bOb_admin_invite_accept_and_cancel_subscription_874">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.22521.0>},
            {server,<<"localhost">>},
            {username,
              <<"bOb_admin_invite_accept_and_cancel_subscription_874">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"bob_admin_invite_accept_and_cancel_subscription_874">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,
             <<"bOb_admin_invite_accept_and_cancel_subscription_874">>},
           {server,<<"localhost">>},
           {password,<<"makrolika">>},
           {stream_id,<<"6796df7dd95af488">>}]},
        1],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {graphql_roster_SUITE,
       admin_invite_accept_and_cancel_subscription_story,3,
       [{file,
          "/home/circleci/project/big_tests/tests/graphql_roster...

Report log


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / a1489df
Reports root/ big
OK: 2136 / Failed: 0 / User-skipped: 355 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / a1489df
Reports root/ big
OK: 3508 / Failed: 1 / User-skipped: 97 / Auto-skipped: 0

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2249@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2249@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"4Hkh5aG3OyMsaAkWMFsp+Q==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log


mysql_redis_25 / mysql_redis / a1489df
Reports root/ big
OK: 3492 / Failed: 0 / User-skipped: 102 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / a1489df
Reports root/ big
OK: 1995 / Failed: 0 / User-skipped: 350 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / a1489df
Reports root/ big
OK: 3521 / Failed: 2 / User-skipped: 97 / Auto-skipped: 0

muc_SUITE:hibernation:hibernated_room_can_be_queried_for_archive
{error,{{assertion_failed,assert,is_groupchat_message,
              [<<"Restorable message">>],
              undefined,"undefined"},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {muc_SUITE,wait_for_mam_result,3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4383}]},
     {muc_SUITE,'-hibernated_room_can_be_queried_for_archive/1-fun-0-',3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4124}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {muc_SUITE,hibernated_room_can_be_queried_for_archive,1,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4120}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

muc_SUITE:hibernation:hibernated_room_can_be_queried_for_archive
{error,{{assertion_failed,assert,is_groupchat_message,
              [<<"Restorable message">>],
              undefined,"undefined"},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {muc_SUITE,wait_for_mam_result,3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4383}]},
     {muc_SUITE,'-hibernated_room_can_be_queried_for_archive/1-fun-0-',3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4124}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {muc_SUITE,hibernated_room_can_be_queried_for_archive,1,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4120}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

@codecov
Copy link

codecov bot commented Jul 11, 2022

Codecov Report

Merging #3706 (3aba261) into master (bbdc781) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3706      +/-   ##
==========================================
+ Coverage   82.10%   82.17%   +0.06%     
==========================================
  Files         513      513              
  Lines       33644    33644              
==========================================
+ Hits        27624    27646      +22     
+ Misses       6020     5998      -22     
Impacted Files Coverage Δ
src/auth/ejabberd_auth_anonymous.erl 67.18% <ø> (+10.93%) ⬆️
src/auth/ejabberd_auth.erl 84.12% <100.00%> (ø)
src/elasticsearch/mongoose_elasticsearch.erl 76.92% <0.00%> (-7.70%) ⬇️
src/mam/mod_mam_elasticsearch_arch.erl 86.60% <0.00%> (-1.79%) ⬇️
src/mod_muc_log.erl 62.82% <0.00%> (ø)
src/pubsub/mod_pubsub.erl 73.42% <0.00%> (+0.06%) ⬆️
src/mod_roster.erl 78.94% <0.00%> (+0.23%) ⬆️
src/metrics/mongoose_metrics.erl 92.47% <0.00%> (+2.15%) ⬆️
src/cassandra/mongoose_cassandra_worker.erl 68.86% <0.00%> (+2.83%) ⬆️
src/cassandra/mongoose_cassandra.erl 81.48% <0.00%> (+3.70%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbdc781...3aba261. Read the comment docs.

Paweł Chrząszcz added 3 commits July 11, 2022 17:45
This was previously untested (and buggy).
It was failing with function_clause.
The new test confirmed that.
Previously onyl the users with the SASL ANONYMOUS method were
registered, which was wrong.
The new test revealed this bug.
@mongoose-im
Copy link
Collaborator

mongoose-im commented Jul 11, 2022

small_tests_24 / small_tests / 3aba261
Reports root / small


small_tests_25 / small_tests / 3aba261
Reports root / small


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 3aba261
Reports root/ big
OK: 3123 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 3aba261
Reports root/ big
OK: 1740 / Failed: 0 / User-skipped: 460 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 3aba261
Reports root/ big
OK: 3106 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 3aba261
Reports root/ big
OK: 1740 / Failed: 0 / User-skipped: 460 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / 3aba261
Reports root/ big
OK: 1846 / Failed: 0 / User-skipped: 354 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 3aba261
Reports root/ big
OK: 3497 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 3aba261
Reports root/ big
OK: 3123 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 3aba261
Reports root/ big
OK: 2136 / Failed: 0 / User-skipped: 355 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 3aba261
Reports root/ big
OK: 3492 / Failed: 0 / User-skipped: 102 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 3aba261
Reports root/ big
OK: 3497 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 3aba261
Reports root/ big
OK: 1995 / Failed: 0 / User-skipped: 350 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 3aba261
Reports root/ big
OK: 3497 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0

@chrzaszcz chrzaszcz marked this pull request as ready for review July 12, 2022 06:28
@JanuszJakubiec JanuszJakubiec merged commit 8093c20 into master Jul 12, 2022
@JanuszJakubiec JanuszJakubiec deleted the fix-anonymous-login branch July 12, 2022 14:00
@chrzaszcz chrzaszcz added this to the 6.0.0 milestone Dec 12, 2022
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.

3 participants