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

Add banner for when resultant-acl check fails #23503

Merged
merged 12 commits into from
Oct 18, 2023

Conversation

hashishaw
Copy link
Collaborator

@hashishaw hashishaw commented Oct 4, 2023

The resultant-acl endpoint is an internal endpoint that is critical for the UI to deliver an interface that shows a given user only the navigation items they have access to. However, access to this endpoint is controlled via policies, so if a GUI user does not have the default policy (which includes read access to this endpoint) the user might see navigation items that they don't actually have access to.

To alleviate confusion we are adding an alert banner when this check fails:
Resultant ACL banner

This check will also fail if the given user doesn't have access to the namespace, so the log in CTA will have them sign in directly to the namespace with a different user.

@hashishaw hashishaw added this to the 1.15.1 milestone Oct 4, 2023
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Oct 4, 2023
@@ -4,56 +4,52 @@
~}}

{{#if (and this.licenseExpired (not this.expiredDismissed))}}
<div class="license-banner-wrapper">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed wrapping div and moved it to outside all the banners (in cluster.hbs)

@autoloaded={{eq this.activeCluster.licenseState "autoloaded"}}
/>
{{/if}}
<div class="cluster-banners-wrapper">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This class automatically adds margins to the child divs so that spacing is consistent

@hashishaw hashishaw marked this pull request as ready for review October 16, 2023 15:28
@github-actions
Copy link

Build Results:
All builds succeeded! ✅

Copy link
Contributor

@zofskeez zofskeez left a comment

Choose a reason for hiding this comment

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

LGTM thanks for the updates!

Comment on lines 86 to 104
test('shows error banner if resultant-acl check fails', async function (assert) {
const login_only = `
path "auth/token/lookup-self" {
capabilities = ["read"]
},
`;
await consoleComponent.runCommands([
`write sys/policies/acl/login-only policy=${btoa(login_only)}`,
`write -field=client_token auth/token/create no_default_policy=true policies="login-only"`,
]);
const noDefaultPolicyUser = consoleComponent.lastLogOutput;
assert.dom('[data-test-resultant-acl-banner]').doesNotExist('Resultant ACL banner does not show as root');
await logout.visit();
assert.dom('[data-test-resultant-acl-banner]').doesNotExist('Does not show on login page');
await authPage.login(noDefaultPolicyUser);
assert.dom('[data-test-resultant-acl-banner]').includesText('Resultant ACL check failed');
await click('[data-test-resultant-acl-reauthenticate]');
assert.strictEqual(currentRouteName(), 'vault.cluster.auth', 'Reauth link goes to login page');
});
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

@hashishaw hashishaw enabled auto-merge (squash) October 16, 2023 16:03
@hashishaw hashishaw enabled auto-merge (squash) October 18, 2023 21:34
@hashishaw hashishaw merged commit 199c04f into main Oct 18, 2023
70 checks passed
@hashishaw hashishaw deleted the ui/ui/VAULT-18684/banner-when-resultant-acl-fails branch October 18, 2023 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants