Skip to content

Security: DariuszJustynski/ChatExtractor-Versions

Security

SECURITY.md

Security

Known Security Concerns

API Key Exposure (ALL VERSIONS)

All four versions store the OpenAI API key in a .env file inside the project folder. The .gitignore files list .env, but some versions had keys committed before the ignore rule was in place.

Mitigation:

  • Never commit .env files.
  • Rotate any exposed API keys immediately.
  • Consider using OS-level credential stores (e.g., keytar for Electron) instead of .env files.

File Path Injection (v1-v4)

The OpenAI API returns file paths as part of its JSON response. These paths are used directly to write files to disk. A malicious or crafted chat input could cause the LLM to return paths containing .. sequences, potentially writing files outside the intended output directory.

Affected files:

  • v1-v2: modules/fileWriter.js
  • v3: main/fileWriter.js
  • v4: app/backend/file-system.js

Mitigation:

  • Validate that all resolved output paths are within the expected output directory.
  • Reject paths containing .., absolute paths, or paths starting with /.

Untrusted Input Handling

Chat text is sent directly to the OpenAI API without sanitization. While this is the intended behavior (the LLM parses the chat), there is no validation of:

  • Input size (could cause excessive API costs)
  • Output size (could fill disk)
  • File count (could create thousands of files)

Mitigation:

  • Set maximum input length.
  • Set maximum output file count and individual file size.
  • Monitor API usage costs.

Electron Security

  • v1-v3: Context isolation is enabled via preload scripts. Node integration is disabled in renderer by default (Electron defaults).
  • v4: Same pattern. Additionally uses contextBridge properly.
  • No versions enable nodeIntegration in renderer, which is correct.

Synchronous File I/O

v1-v2 use fs.writeFileSync which blocks the Electron main process. This is not a security issue per se, but could cause the app to become unresponsive with large outputs, which could be exploited for denial-of-service in shared environments.

Reporting

If you discover a security issue, contact the repository owner directly. Do not open a public issue.

There aren't any published security advisories