Skip to content

[Backport 1.3] Preserve URL Hash for SAML based login with Tests#1220

Closed
stephen-crawford wants to merge 13 commits intoopensearch-project:1.3from
stephen-crawford:SAMLBackport
Closed

[Backport 1.3] Preserve URL Hash for SAML based login with Tests#1220
stephen-crawford wants to merge 13 commits intoopensearch-project:1.3from
stephen-crawford:SAMLBackport

Conversation

@stephen-crawford
Copy link
Contributor

Signed-off-by: Stephen Crawford steecraw@amazon.com

Description

Manually backports SAML tests and updates from recent commits into 1.3.

Why these changes are required?

Resolves requests in #1219 discussion.

Check List

  • New functionality includes testing
  • New functionality has been documented
  • 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: Stephen Crawford <steecraw@amazon.com>
@stephen-crawford stephen-crawford requested a review from a team November 16, 2022 23:03
@peternied peternied changed the title Manual backport and transfer of tests from recent commits [Backport 1.3] Preserve URL Hash for SAML based login + Tests Nov 17, 2022
@peternied peternied changed the title [Backport 1.3] Preserve URL Hash for SAML based login + Tests [Backport 1.3] Preserve URL Hash for SAML based login with Tests Nov 17, 2022
@peternied
Copy link
Member

@scrawfor99 Could you look into the build/integration test failures?

Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
@stephen-crawford
Copy link
Contributor Author

stephen-crawford commented Nov 17, 2022

Update on the test failures: So looking at the errors, it seems that there is a versioning issue with the Cyprus tests that are called since the changes from the tests come from 2.4. I am looking through the different dependencies to try to find what needs to be switched. The error you get is


[2/4] Fetching packages...
error samlp@7.0.1: The engine "node" is incompatible with this module. Expected version ">=12". Got "10.24.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
ERROR [bootstrap] failed:
ERROR Error: Command failed with exit code 1: /opt/hostedtoolcache/node/10.24.1/x64/lib/node_modules/yarn/bin/yarn.js install --non-interactive
         at makeError (/home/runner/work/security-dashboards-plugin/security-dashboards-plugin/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:25139:11)
         at handlePromise (/home/runner/work/security-dashboards-plugin/security-dashboards-plugin/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:24074:26)
         at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 1.

During the run yarn step.

Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
@peternied
Copy link
Member

peternied commented Nov 17, 2022

@scrawfor99 One of the major changes in between major versions 1 and 2 was upgrading the version of node [1], Can you try an earlier version of samlp [2] that is compatible with node 10?

[1] opensearch-project/OpenSearch-Dashboards#1028
[2] https://www.npmjs.com/package/samlp/v/6.0.2?activeTab=versions

@stephen-crawford
Copy link
Contributor Author

stephen-crawford commented Nov 17, 2022

Right now there is not a direct dependency on samlp. It is only on the saml-idp library https://github.com/mcguinness/saml-idp/blob/master/package.json#L38 which is dependent on a forked version of samlp: https://github.com/mcguinness/node-samlp/commits/master. I think we could maybe fork the saml-idp library and then swap the dependencies of it to the normal samlp and move it back (it is referencing an almost identical fork of samlp) but want to check and see what you think first. @peternied

Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions.outputs.yarn_version }}
npm i -g yarn@${{ steps.versions.outputs.yarn_version }} --ignore-engines
Copy link
Member

Choose a reason for hiding this comment

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

Great idea! 🤞

Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
@stephen-crawford
Copy link
Contributor Author

Update: I am looking into this further. For whatever reason, the yarn command to skip the engine check is not working. I suspect that it is because there is a later check within OSD Bootstrap. There is also a problem in the unit tests where the navigation button test does not operate properly. I am not sure if we intend to backport the button from its introduction in 2.n (.4 I think?) but if so this will require a few more changes to get it introduced.

Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
Copy link
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

Left some review comments.

Also helpful to add .idea to .gitignore file so those changes are not pushed.

steps:
- name: Download OpenSearch Core
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.6/latest/linux/x64/tar/builds/opensearch/dist/opensearch-min-1.3.6-linux-x64.tar.gz
Copy link
Member

Choose a reason for hiding this comment

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

I believe these 2.4.0 version updates shouldn't be part of this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I am just trying to get anything to work at this point. So I just copied the entire file to make sure that it was not a missing line somewhere that was causing the issue. I will be going back through to pair down the changes to those necessary once I get anything working.

"lint:es": "node ../../scripts/eslint",
"lint:sass": "node ../../scripts/sasslint",
"lint": "yarn run lint:es && yarn run lint:sass",
"lint": "yarn run lint:es && yarn run lint:style",
Copy link
Member

Choose a reason for hiding this comment

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

Why remove the call to sasslint here?

username={userName}
tenant="tenant1"
config={config as any}
exports[`Account navigation button renders 1`] = `
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if you added this change. But this test file has been changed to a snapshot file. Do you know why is that?

path: OpenSearch-Dashboards
repository: opensearch-project/OpenSearch-Dashboards
ref: '1.x'
ref: 'main'
Copy link
Member

Choose a reason for hiding this comment

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

why point to main here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above about just copy+pasting the files with changes to try to get a working version of any sort. I am going to be fixing these once I get the yarn issue fixed.

@stephen-crawford
Copy link
Contributor Author

Closing in favor of #1226

@stephen-crawford stephen-crawford deleted the SAMLBackport branch December 12, 2022 15:19
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.

3 participants