Repository navigation
fix(web): keep the private ingest key out of onboarding snippets and the agent prompt #1182
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| // Installs the whole skills folder: maple-onboard reads its per-language companion skills. | ||
| export const ONBOARD_SKILL_COMMAND = "bunx skills add MapleTechLabs/maple/skills --skill '*'" | ||
|
|
||
| // The endpoint carries the org's region; the skill uses it verbatim. | ||
| export function onboardSkillPrompt(ingestUrl: string, ingestKey: string): string { | ||
| // The endpoint carries the org's region; the skill uses it verbatim. The prompt is pasted into an | ||
| // AI tool, so it carries only the public key: the user sets the private key in their own env. | ||
| // Without a public key (still loading, or no access) the skill inlines MAPLE_TEST for the user to swap. | ||
| export function onboardSkillPrompt(ingestUrl: string, publicKey: string): string { | ||
| return [ | ||
| "Install Maple in this repo using the maple-onboard skill.", | ||
| `My ingest endpoint is ${ingestUrl}.`, | ||
| `My ingest key is ${ingestKey || "<your-ingest-key>"}.`, | ||
| ...(publicKey ? [`My public ingest key for browser and mobile code is ${publicKey}.`] : []), | ||
| "Server code reads my private key from MAPLE_INGEST_KEY, which I set in my environment or .env myself.", | ||
| ].join("\n") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { describe, expect, it } from "vitest" | ||
|
|
||
| import { sdkSnippets } from "./sdk-snippets" | ||
|
|
||
| describe("sdkSnippets", () => { | ||
| it.each(sdkSnippets.map((s) => [s.language, s.instrument]))( | ||
| "%s reads the private key from MAPLE_INGEST_KEY instead of inlining a key", | ||
| (_, instrument) => { | ||
| expect(instrument).toContain("MAPLE_INGEST_KEY") | ||
| expect(instrument).not.toMatch(/\{\{API_KEY\}\}|maple_[ps]k_[a-z0-9]/) | ||
| }, | ||
| ) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning
Prompt sends servers to
MAPLE_INGEST_KEY, but the shipped skill says inline the keyF1 · Warning · convention
The prompt tells the agent server code reads the private key from
MAPLE_INGEST_KEYset by the user, and all six instrument snippets assertMAPLE_INGEST_KEYis set, warn and skip the exporter. The shipped rule the prompt invokes,skills/maple-onboard/SKILL.md:34and:185, still says the ingest key is inlined in the bootstrap source and lists env-var indirection as a failure mode ("env-var indirection just adds deploy-time failure modes for no gain"), and its public-key path (:43) inlines it in every bootstrap file, servers included. Until #1115 lands with these snippets, the agent gets one instruction from the prompt and the opposite from the skill it must read, so a user who pastes the prompt can still end up with the key inlined in server source.🤖 Prompt to fix with an AI agent