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 sslConfig for multiple datasource to handle when certificateAuthorities is unset #6282

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Mar 27, 2024

Description

Fixes the logic in TLS configuration for multiple datasources to match the behavior of opensearch_client_config.ts which sets the ca portion of the ssl config to undefined (instead of empty list) when the datasource.ssl.certificateAuthorities setting is not set in opensearch_dashboards.yml.

Issues Resolved

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.46%. Comparing base (91a0530) to head (d1ed005).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6282   +/-   ##
=======================================
  Coverage   67.45%   67.46%           
=======================================
  Files        3368     3368           
  Lines       65423    65422    -1     
  Branches    10559    10557    -2     
=======================================
+ Hits        44134    44136    +2     
  Misses      18716    18716           
+ Partials     2573     2570    -3     
Flag Coverage Δ
Linux_1 32.14% <ø> (ø)
Linux_2 55.58% <ø> (ø)
Linux_3 44.92% <100.00%> (+<0.01%) ⬆️
Linux_4 34.98% <ø> (ø)
Windows_1 32.16% <ø> (ø)
Windows_2 55.54% <ø> (ø)
Windows_3 44.92% <100.00%> (+<0.01%) ⬆️
Windows_4 34.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Signed-off-by: Craig Perkins <[email protected]>
@@ -55,7 +55,7 @@ export function parseClientOptions(
config.ssl?.certificateAuthorities
);

sslConfig.ca = certificateAuthorities || [];
sslConfig.ca = certificateAuthorities;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we also need to fix the interface to make ca as optional I think, at line 16

Copy link
Member Author

Choose a reason for hiding this comment

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

That should already be covered because DataSourceSSLConfigOptions is a Partial

@@ -56,7 +56,7 @@ export function parseClientOptions(
config.ssl?.certificateAuthorities
);

sslConfig.ca = certificateAuthorities || [];
sslConfig.ca = certificateAuthorities;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we also need to fix the interface to make ca as optional I think, at line 16

Copy link
Member Author

Choose a reason for hiding this comment

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

That should already be covered because DataSourceSSLConfigOptions is a Partial

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I see, thanks!

BionIT
BionIT previously approved these changes Mar 28, 2024
ZilongX
ZilongX previously approved these changes Mar 28, 2024
@BionIT
Copy link
Collaborator

BionIT commented Mar 28, 2024

@cwperks
Copy link
Member Author

cwperks commented Mar 28, 2024

@cwperks Can you fix the test which is failing https://github.com/opensearch-project/OpenSearch-Dashboards/actions/runs/8459709350/job/23211770139?pr=6282

@BionIT Pushed a fix for the tests.

@ZilongX ZilongX self-requested a review March 28, 2024 23:19
@ZilongX ZilongX merged commit 40da92c into opensearch-project:main Mar 28, 2024
70 checks passed
@cwperks
Copy link
Member Author

cwperks commented Mar 29, 2024

Creating a manual backport. The backport bot still has not run after the label was added.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 29, 2024
…rities is unset (#6282)

* Fix sslConfig for multiple datasource to handle when certificateAuthorities is unset

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Adjust test in tls_settings_provider.test.ts

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit 40da92c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
cwperks added a commit to cwperks/OpenSearch-Dashboards that referenced this pull request Mar 29, 2024
…rities is unset (opensearch-project#6282)

* Fix sslConfig for multiple datasource to handle when certificateAuthorities is unset

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Adjust test in tls_settings_provider.test.ts

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit 40da92c)
@kavilla kavilla linked an issue Apr 2, 2024 that may be closed by this pull request
@kavilla kavilla added the v2.14.0 label Apr 2, 2024
BionIT pushed a commit that referenced this pull request Apr 2, 2024
…rities is unset (#6282) (#6296)

* Fix sslConfig for multiple datasource to handle when certificateAuthorities is unset

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Adjust test in tls_settings_provider.test.ts

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit 40da92c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Add datasource with test connect failed
4 participants