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

fix(credentials): ensure deletion occurs within transaction context #755

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Dec 23, 2024

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Fixes: #753

Description of the change:

Ensures transaction context is active when processing credential deletions in particular situations.

Motivation for the change:

This change is helpful because users may want to...

How to manually test:

  1. Check out PR
  2. Apply this patch:
diff --git a/src/main/java/io/cryostat/discovery/Discovery.java b/src/main/java/io/cryostat/discovery/Discovery.java
index 508dbd55..0279cc46 100644
--- a/src/main/java/io/cryostat/discovery/Discovery.java
+++ b/src/main/java/io/cryostat/discovery/Discovery.java
@@ -215,6 +215,9 @@ public class Discovery {
                             remoteURI));
         }
 
+        if (true) {
+            throw new BadRequestException();
+        }
         if (agentTlsRequired && !callbackUri.getScheme().equals("https")) {
             throw new BadRequestException(
                     String.format(
  1. Build PR
  2. ./smoketest.bash -O -t quarkus-cryostat-agent
  3. Because of the patch above, the Agent instance should fail to register itself with Cryostat. Check Cryostat's logs when this happens. Before this PR, exceptions like in [Bug] Credential deletion happens outside of a transaction context #753 will be seen. With this PR the logs should be clean when the Agent instance fails to register and tries to clean up its own credentials.
  4. Alternatively, simply open the web UI and go to Security, then define a credential. Then try to delete it, and check the Cryostat logs immediately after. The same kind of stack trace should appear if this PR is not applied. Requires fix(storedcredentials): define target match array to avoid undefined reference error cryostat-web#1513

@andrewazores
Copy link
Member Author

/build_test

@andrewazores andrewazores requested a review from a team December 23, 2024 16:53
Copy link

Workflow started at 12/23/2024, 11:53:17 AM. View Actions Run.

Copy link

No OpenAPI schema changes detected.

Copy link

No GraphQL schema changes detected.

Copy link

CI build and push: All tests pass ✅
https://github.com/cryostatio/cryostat/actions/runs/12470186351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Credential deletion happens outside of a transaction context
1 participant