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

feat(bridge): accept wrapped secrets as passwords #11896

Merged

Conversation

keynslug
Copy link
Contributor

@keynslug keynslug commented Nov 7, 2023

Fixes EMQX-10808.

Followup to #11809.

Documentation in emqx/emqx-docs#2215.

Progress

  1. Redis
  2. Postgres / Matrix
  3. MySQL
  4. MongoDB
  5. Clickhouse
  6. Oracle
  7. RabbitMQ
  8. Cassandra
  9. Kafka
  10. MQTT
  11. LDAP
  12. TDEngine
  13. SQL Server
  14. GreptimeDB
  15. InfluxDB
  16. IoTDB
  17. Azure EventHub
  18. AWS Dynamo
  19. AWS Kinesis
  20. Pulsar
  21. RocketMQ

Summary

🤖 Generated by Copilot at e215451

This pull request improves the password handling and authentication support for various bridge plugins, such as MongoDB, Kafka, ClickHouse, and PostgreSQL. It also enhances the test modules and docker-compose files for these plugins, and updates some version numbers and code formatting.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Added property-based tests for code which performs user input validation
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix|breaking)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • Created PR to emqx-docs if documentation update is required, or link to a follow-up jira ticket
  • Schema changes are backward compatible

@@ -142,7 +140,7 @@ on_start(
?SLOG(info, #{
msg => "starting_ldap_connector",
connector => InstId,
config => emqx_utils:redact(Config)
Copy link
Contributor

@thalesmg thalesmg Nov 7, 2023

Choose a reason for hiding this comment

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

In the particular case of LDAP schema, for example, there seems to be this bind_password field that could be lurking around in the config.

I haven't checked if it's really the case here, but I think it's safer to keep those redact calls wherever we log configurations, in general.

Copy link
Contributor

Choose a reason for hiding this comment

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

Besides, it'll format passwords as ****** rather than #Fun<mod.43.3316493>.

@keynslug keynslug force-pushed the ft/EMQX-10808/opt-file-secret-bridges branch 4 times, most recently from 62ab4ca to cb69604 Compare November 10, 2023 14:26
@keynslug keynslug marked this pull request as ready for review November 13, 2023 08:00
@keynslug keynslug requested review from JimMoen, lafirest and a team as code owners November 13, 2023 08:00
@@ -280,7 +280,7 @@ handle_backend_update_result({error, Reason}, _) ->

to_json(Data) ->
emqx_utils_maps:jsonable_map(
Data,
emqx_utils:redact(Data),
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: mb. rename the fun to to_redacted_json to avoid misuse 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -140,7 +140,7 @@ mongo_fields() ->
{srv_record, fun srv_record/1},
{pool_size, fun emqx_connector_schema_lib:pool_size/1},
{username, fun emqx_connector_schema_lib:username/1},
{password, fun emqx_connector_schema_lib:password/1},
{password, emqx_connector_schema_lib:password_field()},
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: may be a bit confusing lack of uniformness of API, mod:fun1() vs fun mod:fun2/1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree here, that's kinda unfortunate. I added a field suffix which follows a module-level convention of naming field schemas in literal map() form, but it's indeed suboptimal. I honestly currently have no idea what to do with this without making a lot of changes across a lot of apps, once more.

savonarola
savonarola previously approved these changes Nov 13, 2023
thalesmg
thalesmg previously approved these changes Nov 13, 2023
apps/emqx_postgresql/src/emqx_postgresql.erl Outdated Show resolved Hide resolved
"\n resource_opts {"
"\n health_check_interval = 10s"
"\n }"
"\n }".
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: previous version was easier to read. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly agree. One of the issues I had is that former formatting, in addition to requiring erlfmt pragmas, was messing my editor badly for some reason. Another one is that it was kinda misleading: it doesn't work the way people usually expect when they see """ (at least it won't work until Erlang/OTP 27).

@keynslug keynslug dismissed stale reviews from thalesmg and savonarola via c2b84fc November 14, 2023 09:03
@keynslug keynslug force-pushed the ft/EMQX-10808/opt-file-secret-bridges branch from c2b84fc to d1c3b1c Compare November 14, 2023 09:06
@keynslug keynslug merged commit e80600c into emqx:release-54 Nov 14, 2023
162 checks passed
@keynslug keynslug deleted the ft/EMQX-10808/opt-file-secret-bridges branch November 14, 2023 16:08
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.

None yet

3 participants