Skip to content

[WIP] How To Create Secret In Synthetic Monitoring#103

Open
TheComeUpCode wants to merge 9 commits intomainfrom
ba-path-how-to-secret-management
Open

[WIP] How To Create Secret In Synthetic Monitoring#103
TheComeUpCode wants to merge 9 commits intomainfrom
ba-path-how-to-secret-management

Conversation

@TheComeUpCode
Copy link
Contributor

@TheComeUpCode TheComeUpCode commented Feb 6, 2026

Note

Low Risk
Content-only addition (tutorial JSON) with no code-path, security, or data-handling changes; main risk is selectors/steps drifting from the UI and causing the guide to break.

Overview
Adds a new how-to-setup-secrets-tutorial/content.json interactive guide for Grafana Cloud Synthetic Monitoring secrets management.

The tutorial covers navigating to the Secrets config UI, creating username/password secrets via multistep form interactions, using secrets in a Browser check script (including k6/secrets examples), and basic edit/delete flows, with intro/outro markdown content.

Written by Cursor Bugbot for commit 96b74ad. This will update automatically on new commits. Configure here.

@TheComeUpCode
Copy link
Contributor Author

This is still work a progress please do not review

]
}
],
"id": "performace-multistep-guided",
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate section IDs will cause reference conflicts

Medium Severity

Two different sections share the same id value "performace-multistep-guided". The section titled "Create A Secret" at line 58 and the section titled "Create A Check With A Synthetic Monitoring Secret" at line 147 both use this duplicate ID. This will cause issues with navigation, anchoring, or any system that references sections by their unique identifier.

Additional Locations (1)

Fix in Cursor Fix in Web

@cursor

This comment has been minimized.

@cursor

This comment has been minimized.

@cursor

This comment has been minimized.

"type": "interactive",
"action": "formfill",
"reftarget": "div[data-testid='data-testid Code editor container']",
"content": "In the script editor:\n\nImport the secrets module at the top:\n\n`import secrets from 'k6/secrets';`\n\nReference your secrets in the script:\n\n`const username = secrets.get('QuickPizza Username');`\n`const password = secrets.get('QuickPizza Password');`\n\n(Optional) Add a log to see how secrets are redacted:\n\n`console.log(`Trying to log secret: ${username}`);`\nNotice that the example script already includes secret placeholders as comments. Uncomment these lines to use them.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Secret names mismatch between creation and usage

High Severity

The tutorial creates secrets named quickpizza-username and quickpizza-password, but the script example references them as QuickPizza Username and QuickPizza Password via secrets.get(). These names don't match, so following the tutorial as written would result in the secrets not being found at runtime.

Additional Locations (2)

Fix in Cursor Fix in Web

@cursor

This comment has been minimized.

@cursor

This comment has been minimized.

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

"reftarget": "div[data-testid='data-testid Code editor container']",
"content": "In the script editor:\n\nImport the secrets module at the top:\n\n`import secrets from 'k6/secrets';`\n\nReference your secrets in the script:\n\n`const username = secrets.get('QuickPizza Username');`\n`const password = secrets.get('QuickPizza Password');`\n\n(Optional) Add a log to see how secrets are redacted:\n\n`console.log(`Trying to log secret: ${username}`);`\nNotice that the example script already includes secret placeholders as comments. Uncomment these lines to use them.",
"targetvalue": "@@CLEAR@@"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Formfill clears code editor without providing replacement script

High Severity

The targetvalue is @@CLEAR@@ which only clears the code editor without filling in any script content. The existing usage in shared/snippets/query-textarea-formfill.json shows @@clear@@ is a prefix directive followed by the actual content to insert (e.g., @@clear@@your_query_here). Here, the "Do It" action would wipe the editor and leave it empty, despite the content instructing users to add import statements and secrets.get() calls. The casing (@@CLEAR@@ vs. @@clear@@) may also prevent the directive from being recognized.

Fix in Cursor Fix in Web

@cursor
Copy link
Contributor

cursor bot commented Feb 11, 2026

Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.

  • ✅ Fixed: Formfill clears code editor without providing replacement script
    • Changed @@clear@@ to @@clear@@ (correct casing) and added complete k6 browser script with secrets usage after the directive, ensuring the editor is populated with functional code instead of being left empty.

Create PR

Or push these changes by commenting:

@cursor push 081d4046f0
Preview (081d4046f0)
diff --git a/how-to-setup-secrets-tutorial/content.json b/how-to-setup-secrets-tutorial/content.json
--- a/how-to-setup-secrets-tutorial/content.json
+++ b/how-to-setup-secrets-tutorial/content.json
@@ -187,7 +187,7 @@
           "action": "formfill",
           "reftarget": "div[data-testid='data-testid Code editor container']",
           "content": "In the script editor:\n\nImport the secrets module at the top:\n\n`import secrets from 'k6/secrets';`\n\nReference your secrets in the script:\n\n`const username = secrets.get('QuickPizza Username');`\n`const password = secrets.get('QuickPizza Password');`\n\n(Optional) Add a log to see how secrets are redacted:\n\n`console.log(`Trying to log secret: ${username}`);`\nNotice that the example script already includes secret placeholders as comments. Uncomment these lines to use them.",
-          "targetvalue": "@@CLEAR@@"
+          "targetvalue": "@@clear@@import secrets from 'k6/secrets';\nimport { browser } from 'k6/browser';\n\nexport default async function () {\n  const username = secrets.get('quickpizza-username');\n  const password = secrets.get('quickpizza-password');\n  \n  console.log(`Trying to log secret: ${username}`);\n  \n  const page = await browser.newPage();\n  await page.goto('https://quickpizza.grafana.com/admin');\n  \n  // Add your test logic here\n  \n  await page.close();\n}"
         },
         {
           "type": "multistep",

updating guide
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.

1 participant

Comments