Skip to content

Security: hyperpolymath/rescript-evangeliser

SECURITY.md

Security Policy

πŸ›‘οΈ Security Philosophy

Security is a first-class concern in ReScript Evangeliser. We follow a 10+ dimensional security model:

  1. Input Validation - All user input is validated and sanitized
  2. Output Encoding - Code transformations are safe from injection
  3. Authentication - VS Code workspace trust model
  4. Authorization - File system access controls
  5. Session Management - No network sessions required (offline-first)
  6. Cryptography - No cryptographic operations (not needed)
  7. Error Handling - No sensitive data in error messages
  8. Logging - No PII in logs
  9. Privacy - Zero telemetry by default
  10. Supply Chain - Minimal dependencies, lockfile verification

🚨 Reporting Vulnerabilities

Responsible Disclosure

If you discover a security vulnerability, please report it responsibly:

DO:

  • βœ… Email security details to the maintainers (see MAINTAINERS.md)
  • βœ… Use encrypted email if possible (PGP key in .well-known/security.txt)
  • βœ… Wait for response before public disclosure (max 90 days)
  • βœ… Provide detailed reproduction steps

DON'T:

  • ❌ Open public GitHub issues for vulnerabilities
  • ❌ Disclose before maintainers have responded
  • ❌ Exploit vulnerabilities for malicious purposes

What to Report

Security issues include:

  • Code injection vulnerabilities
  • Path traversal attacks
  • Arbitrary code execution
  • Information disclosure
  • Denial of service
  • Supply chain attacks

Response Timeline

  • 24 hours: Initial acknowledgment
  • 7 days: Preliminary assessment
  • 30 days: Fix developed and tested
  • 90 days: Public disclosure (coordinated)

πŸ”’ Security Architecture

Threat Model

In Scope:

  • Malicious JavaScript/TypeScript files opened in VS Code
  • Crafted pattern definitions
  • File system traversal attempts
  • Resource exhaustion (DoS)

Out of Scope:

  • Physical access to developer machine
  • OS-level vulnerabilities
  • VS Code API vulnerabilities
  • Network-based attacks (extension is offline-first)

Security Boundaries

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ VS Code Workspace (Untrusted)           β”‚
β”‚  β”œβ”€ User JavaScript files               β”‚
β”‚  └─ Custom pattern definitions          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           ↓ (sandboxed parsing)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ReScript Evangeliser Extension          β”‚
β”‚  β”œβ”€ AST Parser (Babel, sandboxed)       β”‚
β”‚  β”œβ”€ Pattern Matcher (validated)         β”‚
β”‚  β”œβ”€ Webview (Content Security Policy)   β”‚
β”‚  └─ File System (read-only by default)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Defense Mechanisms

  1. Input Sanitization

    • All JavaScript/TypeScript parsed via Babel AST (not eval)
    • Pattern regexes validated for ReDoS attacks
    • File paths validated against traversal
  2. Content Security Policy

    • Webview UI runs with strict CSP
    • No inline scripts or styles
    • No external resource loading
  3. Resource Limits

    • Maximum file size: 10MB
    • Parser timeout: 5 seconds
    • Memory limit: 100MB per analysis
  4. Least Privilege

    • Read-only file access by default
    • No network access (offline-first)
    • No external process execution

πŸ” Privacy Guarantees

Zero Telemetry by Default

  • NO data sent to external servers
  • NO user-identifying information collected
  • NO code snippets transmitted
  • NO analytics without explicit opt-in

Optional Privacy-Preserving Telemetry

If enabled (opt-in only):

  • Aggregated, anonymous usage counts
  • Pattern category usage (no code snippets)
  • Performance metrics (timing only)
  • Crash reports (no PII)

All telemetry is:

  • Local-first (stored in VS Code settings)
  • User-controlled (can be deleted anytime)
  • Transparent (see docs/TELEMETRY.md)

πŸ§ͺ Security Testing

Automated Testing

# Run security tests
npm run test:security

# Check dependencies for vulnerabilities
npm audit

# Run linter with security rules
npm run lint

Manual Security Reviews

Before each release:

  • Dependency audit (npm audit)
  • Code review for injection risks
  • CSP header validation
  • File path sanitization check
  • Resource limit testing
  • Fuzz testing (pattern matching)

πŸ“¦ Supply Chain Security

Dependency Management

Current Dependencies:

  • @babel/parser - AST parsing (well-maintained, widely used)
  • @babel/traverse - AST traversal
  • @babel/types - AST type definitions

Security Measures:

  • Package lock file committed (package-lock.json)
  • Regular dependency updates
  • Automated vulnerability scanning
  • Minimal dependency tree (<10 packages)

Build Integrity

  • Reproducible builds via Nix flake
  • Checksum verification
  • Signed commits (when available)

🌐 Offline-First Security

No Network Dependencies

This extension:

  • Never makes network requests
  • Never loads external resources
  • Works in air-gapped environments
  • No CDN dependencies

Benefits

  • Zero network-based attack surface
  • No data exfiltration risks
  • No man-in-the-middle vulnerabilities
  • Works in high-security environments

🎯 VS Code Workspace Trust

This extension respects VS Code's workspace trust model:

  • Untrusted Workspaces: Limited functionality (read-only)
  • Trusted Workspaces: Full pattern detection and transformation

See: https://code.visualstudio.com/docs/editor/workspace-trust

πŸ“‹ Security Checklist for Contributors

When contributing code:

  • No eval() or Function() constructors
  • All file paths sanitized
  • Regex patterns checked for ReDoS
  • No hardcoded secrets or credentials
  • Error messages don't leak sensitive info
  • No external network requests
  • Input validation for all user data
  • Resource limits respected

See CONTRIBUTING.md for full guidelines.

πŸ† Security Compliance

Standards Followed

  • OWASP Top 10 - Protection against common web vulnerabilities
  • CWE Top 25 - Mitigation of common software weaknesses
  • RFC 9116 - security.txt for vulnerability disclosure
  • NIST Cybersecurity Framework - Security best practices
  • Software-Defined Perimeter - Zero trust architecture

Certifications

  • RSR Bronze-level security requirements βœ…
  • Offline-first architecture βœ…
  • Privacy-preserving design βœ…

πŸ“š Additional Resources

πŸ”„ Security Updates

Security updates are released as soon as possible:

  • Critical: Within 24-48 hours
  • High: Within 7 days
  • Medium: Within 30 days
  • Low: Next regular release

Subscribe to releases to stay informed: https://github.com/Hyperpolymath/rescript-evangeliser/releases

πŸ“ž Contact

For security concerns:


Last Updated: 2024-11-22 Policy Version: 1.0

There aren’t any published security advisories