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

Allow unknown query parameter for ui settings route #8152

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

Hailong-am
Copy link
Collaborator

@Hailong-am Hailong-am commented Sep 12, 2024

Description

  1. Allow unknown query parameter for ui settings route

Issues Resolved

functional test set ui settings with tenant specified

https://github.com/opensearch-project/opensearch-dashboards-functional-test/blob/c9884bf615b9ab50c013abda4f878f7899a9d1d8/cypress/utils/commands.js#L483-L506

Screenshot

Testing the changes

calling api/opensearch-dashboards/settings with query parameter

curl --request POST \
  --url 'http://localhost:5601/api/opensearch-dashboards/settings?security_tenant=global&scope=global' \
  --header 'Authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'Content-Type: application/json' \
  --header 'osd-xsrf: osd-fetch' \
  --data '{
 "changes": {
  "defaultIndex": "logstash-*"
 }
}' -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Host localhost:5601 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:5601...
* Connected to localhost (::1) port 5601
> POST /api/opensearch-dashboards/settings?security_tenant=global&scope=global HTTP/1.1
> Host: localhost:5601
> User-Agent: curl/8.7.1
> Accept: */*
> Authorization: Basic YWRtaW46YWRtaW4=
> Content-Type: application/json
> osd-xsrf: osd-fetch
> Content-Length: 51
>
* upload completely sent off: 51 bytes
< HTTP/1.1 200 OK
< osd-name: bcd07463160c
< content-type: application/json; charset=utf-8
< cache-control: private, no-cache, no-store, must-revalidate
< set-cookie: security_authentication=Fe26.2**a26b8853b4084cc1bb2e7cc413d6fbf0ef0ad2b48d44fac8d237f2e5bd43e8d0*bBmO5QGqIstYOVS5uRbL2g*uh4Sb1t2xprEzZ5SM1PKR2-VPUmyU6Kox8OpnyyYPFf1NHEXQDsBKtBNl1xkpytYkKaJ2c1FstobPeLJ1e5cypXpWGCkgNmezW27V4IRB16Bozs1IWdwY78ZNnqRVp1RM5MAOyWYH7b7b5UAjQYphkLbpLRy3kOT0ZJgsrOmE7Sv6xil3bsL0-5s8ZyCtd_u**94958446b535f884e268e463e5c17595b639322327c26b1c0e43882f5b5f3e33*cpNv4dIlj9ohII5JN6HALMYWU5Sb3rqVzNizsRnt7rk; HttpOnly; Path=/
< content-length: 306
< Date: Thu, 12 Sep 2024 03:34:25 GMT
< Connection: keep-alive
< Keep-Alive: timeout=120
<
* Connection #0 to host localhost left intact
{"settings":{"buildNum":{"userValue":9007199254740991},"theme:version":{"userValue":"v7"},"defaultIndex":{"userValue":"logstash-*"},"defaultDataSource":{"userValue":"5827a650-709b-11ef-bee4-cb96037aeecd"},"defaultWorkspace":{"userValue":"123"},"home:useNewHomePage":{"isOverridden":true,"userValue":true}}}%

Changelog

  • skip

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 Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.89%. Comparing base (84b3cf0) to head (55cc11f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8152      +/-   ##
==========================================
- Coverage   63.89%   63.89%   -0.01%     
==========================================
  Files        3739     3739              
  Lines       88752    88752              
  Branches    13810    13810              
==========================================
- Hits        56712    56710       -2     
- Misses      31444    31446       +2     
  Partials      596      596              
Flag Coverage Δ
Linux_1 29.95% <ø> (ø)
Linux_2 58.79% <ø> (ø)
Linux_3 40.25% <ø> (ø)
Linux_4 31.36% <ø> (ø)
Windows_1 29.97% <ø> (ø)
Windows_2 58.74% <ø> (ø)
Windows_3 40.25% <ø> (ø)
Windows_4 31.36% <ø> (-0.01%) ⬇️

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.

@@ -43,6 +43,7 @@ const validate = {
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
security_tenant: schema.maybe(schema.any()),
Copy link
Member

Choose a reason for hiding this comment

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

Just feel having security tenant in core is a bit weird.

Copy link
Collaborator Author

@Hailong-am Hailong-am Sep 12, 2024

Choose a reason for hiding this comment

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

right, remove whole query validation part

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

found a new option to allow unknown parameters

@Hailong-am Hailong-am changed the title Fix missing security_tenant in ui settings route Remove query parameter validation for ui settings route Sep 12, 2024
@Hailong-am Hailong-am changed the title Remove query parameter validation for ui settings route Allow unknown query parameter for ui settings route Sep 12, 2024
@ruanyl ruanyl merged commit ba8c50b into opensearch-project:main Sep 12, 2024
76 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 12, 2024
Signed-off-by: Hailong Cui <[email protected]>
(cherry picked from commit ba8c50b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 12, 2024
Signed-off-by: Hailong Cui <[email protected]>
(cherry picked from commit ba8c50b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Sep 12, 2024
(cherry picked from commit ba8c50b)

Signed-off-by: Hailong Cui <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Sep 12, 2024
(cherry picked from commit ba8c50b)

Signed-off-by: Hailong Cui <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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
Labels
all-star-contributor backport 2.x backport 2.17 Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v2.17.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants