Skip to content

amazing-programming/matlab_rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Reglas Semgrep para MATLAB

Conjunto de 100 reglas de seguridad personalizadas para analizar código MATLAB (.m) usando Semgrep en modo genérico.

📋 Contenido

  • 100 reglas Semgrep escritas en formato YAML
  • 53% reglas de flujo (control/ejecución): eval(), system(), command injection, etc.
  • 47% reglas de expresión (valores/secretos): contraseñas, API keys, tokens, credenciales

🚀 Instalación

1. Instalar Semgrep

# Crear entorno virtual Python
python3 -m venv .venv
source .venv/bin/activate

# Instalar Semgrep
pip install semgrep

2. Clonar este repositorio

git clone https://github.com/amazing-programming/matlab_rules.git
cd matlab_rules

📊 Ejecución

Analizar un archivo MATLAB

semgrep --config semgrep-rules/ tu_archivo.m

Analizar un directorio completo

semgrep --config semgrep-rules/ tu_proyecto/

Generar reporte JSON

semgrep --config semgrep-rules/ tu_proyecto/ --json > reporte.json

Generar reporte SARIF (para GitHub/GitLab)

semgrep --config semgrep-rules/ tu_proyecto/ --sarif > reporte.sarif

🔍 Categorías de Reglas

  • Inyección de Código: 8 reglas (CWE-94)
  • Credenciales Hardcodeadas: 30+ reglas (CWE-798)
  • Criptografía Débil: 15 reglas (CWE-327)
  • Path Traversal: 5 reglas (CWE-22)
  • OS Command Injection: 7 reglas (CWE-78)
  • SQL Injection: 1 regla (CWE-89)

📈 Estadísticas

  • Total de reglas: 100
  • 0% falsos positivos
  • Severidades: 15 CRITICAL, 55 HIGH, 25 MEDIUM, 5 LOW

🛠️ Integración CI/CD

GitHub Actions

- name: Install Semgrep
  run: pip install semgrep
- name: Clone rules
  run: git clone https://github.com/amazing-programming/matlab_rules.git
- name: Run Semgrep
  run: semgrep --config matlab_rules/semgrep-rules/ . --sarif > semgrep.sarif

📄 Licencia

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published