-
Notifications
You must be signed in to change notification settings - Fork 2
Prevent CSV formula injection in the usage export #52
Copy link
Copy link
Open
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:securitysecuritysecuritypriority:lowLow priorityLow prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:securitySecurity hardening / fixSecurity hardening / fix
Metadata
Metadata
Assignees
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:securitysecuritysecuritypriority:lowLow priorityLow prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:securitySecurity hardening / fixSecurity hardening / fix
Type
Fields
Give feedbackNo fields configured for Feature.
Harden the CSV export against formula injection
Description
GET /api/v1/usage/export.csvinsrc/index.tsescapes quotes, commas, and newlines, but does not guard against CSV/formula injection: anagentvalue beginning with=,+,-, or@is interpreted as a formula when the file is opened in a spreadsheet, enabling data exfiltration or command execution on the viewer's machine. This issue neutralises that vector.Requirements and context
Agentpay-Org/Agentpay-backendonly.=,+,-,@, tab, or carriage-return with a safe character (e.g. a leading apostrophe) so spreadsheets treat it as text.usage/export.json) is unaffected.Suggested execution
git checkout -b security/security-22-csv-formula-injectionescapehelper in the CSV export handler insrc/index.ts.src/csv-injection.test.ts— fields starting with=/+/-/@are neutralised; normal fields unchanged.docs/security.md.Test and commit
npm run build,npm test, andnpm run lint.=cmd,+1,-1,@ref, value with both quote and leading=.npm testoutput in the PR description.Example commit message
security: neutralise csv formula injection in usage exportGuidelines
Community & contribution rewards