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

Extend ACL conditions with match = "any_hosted_domain" #3504

Merged
merged 2 commits into from
Jan 17, 2022

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Jan 17, 2022

This condition makes it possible to allow access for all locally hosted domains and deny access for all external domains.

This was possible before #3501, but undocumented and very implicit, e.g. it was used when checking if a user could send data to an external component, but only if user(regexp) was set in the pattern.

Now it is back, but this time is fully controllable by the user in a predicatable way.

The 'any_hosted_domain' option could be used e.g. to preventing users
from external servers to access srvices like external components.
@chrzaszcz chrzaszcz changed the base branch from master to acl-spec-map January 17, 2022 11:45
@codecov
Copy link

codecov bot commented Jan 17, 2022

Codecov Report

Merging #3504 (1488d26) into acl-spec-map (85bb20b) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff                @@
##           acl-spec-map    #3504      +/-   ##
================================================
- Coverage         80.94%   80.94%   -0.01%     
================================================
  Files               418      418              
  Lines             32318    32320       +2     
================================================
  Hits              26160    26160              
- Misses             6158     6160       +2     
Impacted Files Coverage Δ
src/acl.erl 94.00% <100.00%> (+0.12%) ⬆️
src/config/mongoose_config_spec.erl 99.20% <100.00%> (+<0.01%) ⬆️
src/rdbms/mongoose_rdbms.erl 62.17% <0.00%> (-1.13%) ⬇️
src/mam/mod_mam_rdbms_arch_async.erl 96.80% <0.00%> (-1.07%) ⬇️
src/pubsub/mod_pubsub.erl 73.13% <0.00%> (-0.06%) ⬇️
src/mod_muc_log.erl 78.11% <0.00%> (ø)
src/mod_muc_room.erl 77.26% <0.00%> (+0.17%) ⬆️

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 85bb20b...1488d26. Read the comment docs.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 17, 2022

small_tests_24 / small_tests / 1488d26
Reports root / small


small_tests_23 / small_tests / 1488d26
Reports root / small


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 1488d26
Reports root/ big
OK: 2690 / Failed: 0 / User-skipped: 231 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 1488d26
Reports root/ big
OK: 2673 / Failed: 0 / User-skipped: 248 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 1488d26
Reports root/ big
OK: 2690 / Failed: 0 / User-skipped: 231 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 1488d26
Reports root/ big
OK: 2690 / Failed: 0 / User-skipped: 231 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 1488d26
Reports root/ big
OK: 1500 / Failed: 0 / User-skipped: 390 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 1488d26
Reports root/ big
OK: 1500 / Failed: 0 / User-skipped: 390 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 1488d26
Reports root/ big
OK: 1541 / Failed: 0 / User-skipped: 349 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 1488d26
Reports root/ big
OK: 1834 / Failed: 0 / User-skipped: 361 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 1488d26
Reports root/ big
OK: 3077 / Failed: 0 / User-skipped: 240 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 1488d26
Reports root/ big
OK: 3072 / Failed: 0 / User-skipped: 245 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 1488d26
Reports root/ big
OK: 3077 / Failed: 0 / User-skipped: 240 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 1488d26
Reports root/ big
OK: 3077 / Failed: 0 / User-skipped: 240 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 1488d26
Reports root/ big
OK: 1680 / Failed: 0 / User-skipped: 362 / Auto-skipped: 0

@chrzaszcz chrzaszcz marked this pull request as ready for review January 17, 2022 12:11
Copy link
Collaborator

@NelsonVides NelsonVides left a comment

Choose a reason for hiding this comment

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

👍🏽

@@ -131,6 +131,8 @@ match_step(none, _Domain, _JID) ->
-spec check(acl_spec_key(), binary(), jid:lserver(), jid:jid()) -> boolean().
check(match, all, _, _) -> true;
check(match, none, _, _) -> false;
check(match, any_hosted_domain, _, JID) ->
mongoose_domain_api:get_host_type(JID#jid.lserver) =/= {error, not_found};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This has just made me realise of how used I got to the C habit of putting the static value to the left of the comparison, just so that if you accidentally miss-type the comparison as an assignment, the compiler would already complain 😳

Copy link
Contributor

@arcusfelis arcusfelis left a comment

Choose a reason for hiding this comment

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

ok

Base automatically changed from acl-spec-map to master January 17, 2022 17:42
@arcusfelis arcusfelis merged commit 25ef827 into master Jan 17, 2022
@arcusfelis arcusfelis deleted the acl-spec-map-extended branch January 17, 2022 17:45
@Premwoik Premwoik added this to the 5.1.0 milestone May 25, 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.

5 participants