cryostatio / cryostat

Secure JDK Flight Recorder management for containerized JVMs
https://cryostat.io
Other
11 stars 9 forks source link

feat(credentials): add missing credentials test endpoint #479

Closed andrewazores closed 4 months ago

andrewazores commented 4 months ago

Welcome to Cryostat3! 👋

Before contributing, make sure you have:

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


Fixes: #478 Related to #2

Description of the change:

Reimplements the /api/beta/credentials/{connectUrl} endpoint. This is used on the Security > Store Credentials > List view for testing credentials against targets before actually storing the credential.

How to manually test:

  1. Check out and build PR
  2. ./smoktest.bash -Ot
  3. Go to Security > Store Credentials
  4. Enter a test credential with the match expression true and credentials admin:adminpass123
  5. Click the List tab and click Test for each target
  6. Verify that the credential is Valid for vertx-fib-demo targets with ports 9094 and 9095, Invalid for cryostat3:9091, and Not Applicable for all others

image

Before this PR, all of the results would come back with Invalid responses for everything since the endpoint would always return a 404.

andrewazores commented 4 months ago

/build_test

github-actions[bot] commented 4 months ago

Workflow started at 5/28/2024, 11:04:14 AM. View Actions Run.

github-actions[bot] commented 4 months ago

OpenAPI schema change detected:

diff --git a/schema/openapi.yaml b/schema/openapi.yaml
index 87a077f..9156e21 100644
--- a/schema/openapi.yaml
+++ b/schema/openapi.yaml
@@ -358,20 +358,53 @@ info:
     name: Cryostat Community
     url: https://cryostat.io
   description: Cloud-Native JDK Flight Recorder
   license:
     name: Apache 2.0
     url: https://github.com/cryostatio/cryostat3/blob/main/LICENSE
   title: Cryostat API
   version: 3.0.0-snapshot
 openapi: 3.0.3
 paths:
+  /api/beta/credentials/{connectUrl}:
+    post:
+      parameters:
+        - in: path
+          name: connectUrl
+          required: true
+          schema:
+            type: string
+      requestBody:
+        content:
+          application/x-www-form-urlencoded:
+            schema:
+              properties:
+                password:
+                  type: string
+                username:
+                  type: string
+              type: object
+      responses:
+        "200":
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/V2Response'
+          description: OK
+        "401":
+          description: Not Authorized
+        "403":
+          description: Not Allowed
+      security:
+        - SecurityScheme: []
+      tags:
+        - Credentials Test
   /api/beta/fs/recordings:
     get:
       responses:
         "200":
           content:
             application/json:
               schema:
                 items:
                   $ref: '#/components/schemas/ArchivedRecordingDirectory'
                 type: array
github-actions[bot] commented 4 months ago

No GraphQL schema changes detected.

github-actions[bot] commented 4 months ago

CI build and push: At least one test failed ❌ (JDK17) https://github.com/cryostatio/cryostat3/actions/runs/9271784778

andrewazores commented 4 months ago

/build_test

github-actions[bot] commented 4 months ago

Workflow started at 5/28/2024, 11:16:29 AM. View Actions Run.

github-actions[bot] commented 4 months ago

OpenAPI schema change detected:

diff --git a/schema/openapi.yaml b/schema/openapi.yaml
index 9156e21..96e94aa 100644
--- a/schema/openapi.yaml
+++ b/schema/openapi.yaml
@@ -390,21 +390,21 @@ paths:
               schema:
                 $ref: '#/components/schemas/V2Response'
           description: OK
         "401":
           description: Not Authorized
         "403":
           description: Not Allowed
       security:
         - SecurityScheme: []
       tags:
-        - Credentials Test
+        - Credential Check
   /api/beta/fs/recordings:
     get:
       responses:
         "200":
           content:
             application/json:
               schema:
                 items:
                   $ref: '#/components/schemas/ArchivedRecordingDirectory'
                 type: array
github-actions[bot] commented 4 months ago

No GraphQL schema changes detected.

github-actions[bot] commented 4 months ago

CI build and push: All tests pass ✅ (JDK17) https://github.com/cryostatio/cryostat3/actions/runs/9271991192

andrewazores commented 4 months ago

/build_test

github-actions[bot] commented 4 months ago

Workflow started at 5/28/2024, 12:07:53 PM. View Actions Run.

github-actions[bot] commented 4 months ago

No GraphQL schema changes detected.

github-actions[bot] commented 4 months ago

No OpenAPI schema changes detected.

github-actions[bot] commented 4 months ago

CI build and push: All tests pass ✅ (JDK17) https://github.com/cryostatio/cryostat3/actions/runs/9272735330