context7 icon indicating copy to clipboard operation
context7 copied to clipboard

Security: Add SECURITY.md, TLS 1.3 Enforcement, SCA & RBAC Support

Open Francescolatorre opened this issue 1 year ago • 3 comments

📋 Summary

Add first-class security hardening to Context7 by providing:

  1. A SECURITY.md with clear disclosure guidelines
  2. Out-of-the-box TLS 1.3 enforcement
  3. Continuous dependency-scanning (npm audit, Snyk, Dependabot)
  4. Container-image scanning (Trivy)
  5. Optional RBAC middleware and structured logging

🛠 Background

Context7 powers LLM-based tooling, often in developer and corporate environments. At present:

  • No published security policy or responsible-disclosure process
  • HTTP/SSE endpoints default to unencrypted transport unless manually configured
  • No built-in supply-chain or container image scanning workflows
  • No role-based access control or centralized logging support

This leaves adopters to roll their own security measures, slowing integration and risking misconfiguration.

🎯 Goals

  • Governance: Provide a standard SECURITY.md so users know how to report issues and which versions are supported.
  • Transport Security: Enforce TLS 1.3 by default in both Docker and local runs.
  • Supply-Chain Protection: Integrate automated dependency-scanning in GitHub Actions (npm audit, Snyk or Dependabot) and container scanning via Trivy.
  • Access Control & Auditing: Offer optional RBAC middleware (JWT or API-key based) and structured request logging for SIEM ingestion.

💡 Proposed Implementation

  1. Add SECURITY.md

  2. TLS 1.3 Enforcement

    • Update startup script to detect certs in /certs and launch HTTPS server with minVersion: 'TLSv1.3'.
    • Provide Dockerfile adjustments and sample docker-compose.yml.
  3. GitHub Actions Workflows

    • Create .github/workflows/security.yml that runs:

      • npm audit --audit-level=high
      • snyk test (if Snyk token present)
      • Dependabot config in .github/dependabot.yml
    • Add .github/workflows/container-scan.yml using aquasecurity/trivy-action.

  4. RBAC & Logging

    • New optional middleware package in @modelcontextprotocol/security that reads ADMIN_ROLES from env, enforces on protected endpoints.
    • Hook into existing request pipeline to emit JSON logs (timestamp, route, principal) to stdout for collectors.

🚀 Benefits

  • Faster, safer adoption in corporate environments
  • Standardized process for vulnerability reporting and handling
  • Reduced risk of supply-chain & MITM attacks out of the box
  • Clear audit trail for compliance with security policies

Would love feedback on scope, naming, and any additional best practices!

Francescolatorre avatar Jun 13 '25 05:06 Francescolatorre

this issue is a great contribution. on july we are planning a version open for enterprises. I will definitely check your list @Francescolatorre thank you!

enesakar avatar Jun 13 '25 06:06 enesakar

@enesakar was there any updates here?

sreejithraman avatar Oct 04 '25 13:10 sreejithraman

We added SECURITY.md https://github.com/upstash/context7/security/policy dependabot runs in the repo and we have RBAC in our dashboard.

enesgules avatar Jun 08 '26 10:06 enesgules