-
Notifications
You must be signed in to change notification settings - Fork 2
agent: @U0AJM7X8FBR How can we give Recoup the ability to use a chartmetric API #104
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,11 +24,13 @@ export async function setupOpenClaw( | |||||
| } | ||||||
|
|
||||||
| const githubToken = process.env.GITHUB_TOKEN; | ||||||
| const chartmetricRefreshToken = process.env.CHARTMETRIC_REFRESH_TOKEN; | ||||||
|
|
||||||
| logger.log("Injecting env vars into openclaw.json", { | ||||||
| RECOUP_API_KEY: `${process.env.RECOUP_API_KEY.slice(0, 4)}...`, | ||||||
| RECOUP_ACCOUNT_ID: accountId, | ||||||
| GITHUB_TOKEN: githubToken ? "present" : "missing", | ||||||
| CHARTMETRIC_REFRESH_TOKEN: chartmetricRefreshToken ? "present" : "missing", | ||||||
| }); | ||||||
|
|
||||||
| const injectEnv = await sandbox.runCommand({ | ||||||
|
|
@@ -43,6 +45,7 @@ export async function setupOpenClaw( | |||||
| c.env.RECOUP_API_KEY = '${process.env.RECOUP_API_KEY}'; | ||||||
| c.env.RECOUP_ACCOUNT_ID = '${accountId}'; | ||||||
| ${githubToken ? `c.env.GITHUB_TOKEN = '${githubToken}';` : ""} | ||||||
| ${chartmetricRefreshToken ? `c.env.CHARTMETRIC_REFRESH_TOKEN = '${chartmetricRefreshToken}';` : ""} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Escape token values before embedding into the Line 48 interpolates a raw secret inside a quoted JS snippet. A token containing quote/escape characters can break command generation and opens an injection risk. Use Safer assignment serialization- ${chartmetricRefreshToken ? `c.env.CHARTMETRIC_REFRESH_TOKEN = '${chartmetricRefreshToken}';` : ""}
+ ${chartmetricRefreshToken ? `c.env.CHARTMETRIC_REFRESH_TOKEN = ${JSON.stringify(chartmetricRefreshToken)};` : ""}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| c.tools = c.tools || {}; | ||||||
| c.tools.profile = 'coding'; | ||||||
| c.agents = c.agents || {}; | ||||||
|
|
||||||
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.
Validate
CHARTMETRIC_REFRESH_TOKENthrough a Zod env schema before use.Line 23 reads from
process.envdirectly; this bypasses the repo’s schema-validation requirement for TS sources. Please parse env once (e.g., with a Zod schema) and buildenvfrom parsed output.Suggested refactor
As per coding guidelines, Use Zod for schema validation.
🤖 Prompt for AI Agents