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

Restrict chromium requests #425

Closed
wants to merge 7 commits into from

Conversation

joshuali925
Copy link
Member

Description

[Describe what this change achieves]

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
@joshuali925 joshuali925 marked this pull request as ready for review August 16, 2022 22:23
@joshuali925 joshuali925 requested a review from a team as a code owner August 16, 2022 22:23
Signed-off-by: Joshua Li <joshuali925@gmail.com>
ps48
ps48 previously approved these changes Aug 16, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2022

Codecov Report

Merging #425 (6968ccf) into main (51f6a6d) will decrease coverage by 0.14%.
The diff coverage is 55.55%.

@@             Coverage Diff              @@
##               main     #425      +/-   ##
============================================
- Coverage     74.27%   74.12%   -0.15%     
  Complexity      383      383              
============================================
  Files            94       94              
  Lines          3984     4008      +24     
  Branches        641      649       +8     
============================================
+ Hits           2959     2971      +12     
- Misses          891      903      +12     
  Partials        134      134              
Flag Coverage Δ
dashboards-reports 76.52% <55.55%> (-0.34%) ⬇️
reports-scheduler 71.85% <ø> (ø)

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

Impacted Files Coverage Δ
...r/routes/utils/visual_report/visualReportHelper.ts 79.81% <52.00%> (-8.56%) ⬇️
...ashboards-reports/server/routes/utils/constants.ts 100.00% <100.00%> (ø)
...ashboards-reports/server/utils/validationHelper.ts 92.15% <100.00%> (ø)

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

mengweieric
mengweieric previously approved these changes Aug 16, 2022
Signed-off-by: Joshua Li <joshuali925@gmail.com>
@joshuali925 joshuali925 dismissed stale reviews from mengweieric and ps48 via d76f4fb August 17, 2022 00:40
Signed-off-by: Joshua Li <joshuali925@gmail.com>
@@ -93,6 +93,8 @@ const ipv6Regex = /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:)
const localhostRegex = /localhost:([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])/g;
const iframeRegex = /iframe/g;

export const ALLOWED_HOSTS = /^(0|0.0.0.0|127.0.0.1|localhost|(.*\.)?(opensearch.org|aws.a2z.com))$/;
Copy link
Member

@dblock dblock Aug 24, 2022

Choose a reason for hiding this comment

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

This should not have an Amazon URL. And how is this used? Why would opensearch.org be in this list?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the allowed hosts for all requests and redirections in chromium. The two hosts listed are used by map tiles visualizations

Choose a reason for hiding this comment

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

Those 2 are not hosts, rather domains. Perhaps narrow the scope to the specific ones we need like maps.search-services.aws.a2z.com?

Copy link
Member

@dblock dblock Aug 24, 2022

Choose a reason for hiding this comment

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

I also think this needs to be configurable because some users will run in intranets. Is there a GH issue/feature request for this ask? I can open one otherwise.

Choose a reason for hiding this comment

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

Thansk @dblock for pointing this one out: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/899/files

It looks like we don't need the a2z one. Could you please confirm, @joshuali925 ? If we can also make the opensearch.org more specific that'd be even better.

Copy link
Member

Choose a reason for hiding this comment

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

I opened opensearch-project/documentation-website#983 to document what's going on with these URLs.

Copy link
Member

@dblock dblock Aug 24, 2022

Choose a reason for hiding this comment

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

Nit: is ALLOWED_HOSTS only used for maps? Maybe split it into ALLOWED_HOSTS and ALLOWED_MAPS_HOST to make it explicit?

Also this needs tests. I don't see anything that checks that ALLOWED_HOSTS is taken into consideration in tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

@davidlago yes, good idea to narrow down to maybe (.+\.)?maps.opensearch.org. Will remove the a2z one if someone is able to confirm in db.'s issue which dashboards versions use which endpoint.

@dblock ALLOWED_HOSTS is used for all requests and redirections happening inside chromium. Reporting plugin cannot tell if the request is coming from a map visualization, so I'm not sure if there are values to split them. Will add tests after the a2z issue is addressed

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Let's make sure all concerns are cleared from @davidlago before we merge this.

@joshuali925
Copy link
Member Author

closing since we no longer use chromium

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.

7 participants