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

feat(jmx): re-implement enhanced transient JMX credentials #524

Merged
merged 22 commits into from
Sep 29, 2022

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Sep 27, 2022

Fixes #523 . See there for a description of why this change is useful/necessary and the historical context.

TODO later, maybe: implement a client-side keyring. ie store the JMX credentials in local storage with a user-provided encryption key.

@andrewazores andrewazores added security Pull requests that address a security vulnerability feat New feature or request labels Sep 27, 2022
@cryostatio cryostatio deleted a comment from github-actions bot Sep 27, 2022
Copy link
Member

@maxcao13 maxcao13 left a comment

Choose a reason for hiding this comment

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

Everything else looks good, the ability to choose whether credentials are stored in backend or per session works well, there is something somewhat unrelated but there seems to be a memory-leak with the JMXAuthForm (but is a component in AuthModal) even though it wasn't touched in this PR.

This gets printed to the console

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
JmxAuthForm@webpack-internal:///./src/app/AppLayout/JmxAuthForm.tsx:53:54
// etc... etc...

I think it's just that this subscription on line 61 isn't closed.

  const handleSave = React.useCallback(() => {
    props.onSave(username, password).then(() => {
      clear();
      context.target.setAuthRetry(); // <--------------
    });
  }, [context, context.target, clear, props.onSave, username, password]);

src/app/Settings/CredentialsStorage.tsx Outdated Show resolved Hide resolved
src/app/Settings/CredentialsStorage.tsx Outdated Show resolved Hide resolved
@andrewazores
Copy link
Member Author

I think it's just that this subscription on line 61 isn't closed.

Hmm, I don't think there's a subscription there... that method just returns void.

@tthvo has seen and investigated these "state update on an unmounted component" messages lately. Any insights here?

@maxcao13
Copy link
Member

Oh, whoops my bad, then it's something else internal then I guess, hm...

@tthvo
Copy link
Member

tthvo commented Sep 28, 2022

I think it's just that this subscription on line 61 isn't closed.

Hmm, I don't think there's a subscription there... that method just returns void.

@tthvo has seen and investigated these "state update on an unmounted component" messages lately. Any insights here?

Ohh yesss, here:

There is a call to setState in JMXAuthForm to clear input. However, when saving, the modal is already closed (perhaps unmount its body and remove from tree internally ), this call will be invalid since calling on unmounted components.

To fix, just remove it as it is not needed as the form is mounted fresh anyway.

Copy link
Member

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple comments. Also, it seems there are no current unit tests for this Setting view. I think we should add them :D

Copy link
Member

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@andrewazores andrewazores merged commit 19f353f into cryostatio:main Sep 29, 2022
@andrewazores andrewazores deleted the transient-credentials branch September 29, 2022 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request needs-documentation security Pull requests that address a security vulnerability
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Task] Re-implement transient JMX credentials
3 participants