[BUG]: Security: CSV Formula Injection (CWE-1236) in repository and contributor export files

Open Beginner friendly
#370 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #405 by @kul-91 — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
data, security

Research direction

Start with src/services/analytics.js and inspect exportReposCSV, exportContributorsCSV, and exportTrendsCSV to see how their values are assembled into CSV rows. Add tests in the analytics test file named in the issue, covering formula-triggering prefixes and ordinary values. Done means all three exports neutralize formula cells and correctly escape CSV delimiters, with the tests passing.

Written by the indexing model from the issue text.

Description

bug
Bug Description

The CSV export utilities in src/services/analytics.js (exportReposCSV, exportContributorsCSV, exportTrendsCSV) do not sanitize cell values against Formula Injection (Spreadsheet Injection / CWE-1236).

When repository names, organization logins, or contributor usernames on GitHub start with formula execution trigger characters (=, +, -, @, \t, \r), OrgExplorer exports them directly into the generated .csv files without neutralization.

If a user downloads the CSV and opens it in spreadsheet applications (Microsoft Excel, LibreOffice Calc, Google Sheets), the application interprets the text as an executable formula. This enables Dynamic Data Exchange (DDE) formula execution, malicious external link opening, or data exfiltration.

Vulnerable code (src/services/analytics.js):

export function exportReposCSV(repos) {
  const header = ['Repository', 'Org', 'Stars', 'Forks', 'Open Issues', 'Health Score', 'Activity Classification', 'Language', 'Last Active']
  const rows = repos.map(r => [r.name, r.orgLogin, r.stargazers_count, r.forks_count, r.open_issues_count, r.healthScore, r.activityClassification, r.language || 'N/A', r.pushed_at?.slice(0, 10)])
  download([header, ...rows].map(r => r.join(',')).join('\n'), 'orgexplorer-repos.csv')
}

Steps to Reproduce
  1. On GitHub, a repository, organization, or contributor profile has a name starting with formula characters, e.g.:
    =cmd|' /C calc'!A0 or @SUM(1+1)*cmd|... or +http://attacker.com/leak
  2. Explore that organization or repository in OrgExplorer.
  3. Click "Export CSV" on the Repositories or Contributors page.
  4. Open the downloaded .csv file in Microsoft Excel or LibreOffice.
  5. Notice that the spreadsheet software evaluates the cell as a dynamic formula command instead of literal plain text.

Demonstration / Payload Sample

Generated CSV content without neutralization:

Repository,Org,Stars,Forks,Open Issues,Health Score,Activity Classification,Language,Last Active
=cmd|' /C calc'!A0,AOSSIE-Org,120,45,2,95,Active,JavaScript,2026-10-18
@SUM(1+1)*cmd|' /C calc'!A0,test-org,50,10,0,88,Active,TypeScript,2026-10-18

When opened in Excel / Calc:

  • The cell executes as a formula or throws a formula syntax error (#NAME? / DDE security warning) because the leading = or @ instructs the spreadsheet parser to treat it as executable logic.

Environment Details
  • Applicable across all operating systems (Windows, macOS, Linux) and spreadsheet applications (Excel, LibreOffice, Google Sheets).
  • Code location: src/services/analytics.js

Impact

High - Major security & data export risk (CWE-1236)


Proposed Fix

Implement cell sanitization adhering to OWASP CSV Injection guidelines:

  1. If a string cell starts with any formula operator (=, +, -, @, \t, \r), prefix the value with a single quote ' so the spreadsheet engine forces it to render strictly as literal text.
  2. Combine this with RFC 4180 delimiter escaping (wrapping fields containing commas, quotes, or newlines in double quotes).
  3. Add unit test coverage in src/services/analytics.*.test.js verifying that formula characters are neutralized without corrupting standard alphanumeric values.
Dominant language
JavaScript
Stars
53
Forks
187
Avg merge
18m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AOSSIE-Org/OrgExplorer

All issues in AOSSIE-Org/OrgExplorer

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.