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

Check push form fields #3916

Merged
merged 2 commits into from
Jan 4, 2023
Merged

Check push form fields #3916

merged 2 commits into from
Jan 4, 2023

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Jan 3, 2023

When the push notification node is enabled with an invalid form (especially with missing keys or values), it could still be saved to the DB. Afterwards, sending a push notification either resulted in undefined values being sent (RDBMS) or the a crash (Mnesia). This PR fixes this issue by more strict checking of the form values and rejecting invalid forms.

This PR resolves the most likely cause of #3806

@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Base: 83.13% // Head: 83.13% // No change to project coverage 👍

Coverage data is based on head (13c4ae9) compared to base (13c4ae9).
Patch has no changes to coverable lines.

❗ Current head 13c4ae9 differs from pull request most recent head 9e15599. Consider uploading reports for the commit 9e15599 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3916   +/-   ##
=======================================
  Coverage   83.13%   83.13%           
=======================================
  Files         535      535           
  Lines       34109    34109           
=======================================
  Hits        28358    28358           
  Misses       5751     5751           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

Previously missing keys or values would be reported as 'undefined',
which could result in a crash (Mnesia) or would be silently converted
to binaries (RDBMS).
@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 3, 2023

small_tests_24 / small_tests / 9e15599
Reports root / small


small_tests_25 / small_tests / 9e15599
Reports root / small


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 9e15599
Reports root/ big
OK: 4177 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 9e15599
Reports root/ big
OK: 2223 / Failed: 0 / User-skipped: 823 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 9e15599
Reports root/ big
OK: 2223 / Failed: 0 / User-skipped: 823 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 9e15599
Reports root/ big
OK: 4151 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 9e15599
Reports root/ big
OK: 4177 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 9e15599
Reports root/ big
OK: 4551 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / 9e15599
Reports root/ big
OK: 2365 / Failed: 0 / User-skipped: 681 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 9e15599
Reports root/ big
OK: 4177 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 9e15599
Reports root/ big
OK: 2723 / Failed: 0 / User-skipped: 662 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 9e15599
Reports root/ big
OK: 2561 / Failed: 0 / User-skipped: 654 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 9e15599
Reports root/ big
OK: 4551 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 9e15599
Reports root/ big
OK: 4537 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 9e15599
Reports root/ big
OK: 4562 / 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_2710@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2710@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"n2LTTr68n9gNBCtpiY3WlA==">>}],
            [{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

@chrzaszcz chrzaszcz marked this pull request as ready for review January 3, 2023 15:12
Copy link
Contributor

@JanuszJakubiec JanuszJakubiec left a comment

Choose a reason for hiding this comment

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

Looks good

@JanuszJakubiec JanuszJakubiec merged commit 459c5ea into master Jan 4, 2023
@JanuszJakubiec JanuszJakubiec deleted the check-push-form-fields branch January 4, 2023 08:45
@jacekwegr jacekwegr added this to the 6.1.0 milestone Apr 26, 2023
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