scanDiff ignores commitConfig.diff.block rules from the --config file

Abierto Apto para principiantes
#1,874 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@goldensyntax ya está trabajando en esto.

Desde el 2/11/2026.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
cli, security

Línea de trabajo

Empieza con scanDiff.ts en src/proxy/processors/push-action, donde getCommitConfig() y getPrivateOrganizations() se ejecutan una vez al cargar el módulo (líneas 24-25). Compara con isMessageAllowed en checkMessages.ts, que lee la configuración en cada ejecución, y revisa cómo index.ts aplica --config en las líneas 50-51 después de importar el proxy. Está terminado cuando un diff que contiene un literal del bloque commitConfig.diff.block del archivo --config es rechazado por scanDiff al iniciar el proxy con --config.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Describe the bug

When Git Proxy is started with --config <file>, scanDiff doesn't enforce the
commitConfig.diff.block rules (literals, patterns, providers) from that file. Pushes that
should be blocked go to approval instead, with no error or warning.

Cause

scanDiff reads its config once, when the module is imported
(src/proxy/processors/push-action/scanDiff.ts, lines 24–25):

const commitConfig = getCommitConfig();
const privateOrganizations = getPrivateOrganizations();

index.ts imports the proxy on line 25 but only applies --config on lines 50–51, so
scanDiff keeps the default config, where the block lists are empty.

Other processors read config each time they run (e.g. getCommitConfig() inside
isMessageAllowed in checkMessages.ts), so they aren't affected.

To reproduce

  1. Add a diff block rule to a config file:

    "commitConfig": {
      "diff": {
        "block": { "literals": ["blocked.example.com"], "patterns": [], "providers": {} }
      }
    }
    
  2. Start Git Proxy with --config <that file>.

  3. Push a commit that adds a line containing blocked.example.com.

Expected: the push is blocked by scanDiff.
Actual: scanDiff passes and the push goes to approval.

Setting the CONFIG_FILE environment variable to the same file makes it work, because
it's read before scanDiff loads.

Reproduced on 2.2.0 and 2.3.0.

Suggested fix

Move the two calls into the code that runs per push, as checkMessages does, e.g.:

const combineMatches = (organization: string) => {
  const commitConfig = getCommitConfig();
  const privateOrganizations = getPrivateOrganizations();
  // ...
};

Happy to pick this issue up in a week or two.

Lenguaje dominante
TypeScript
Estrellas
263
Forks
185
Merge medio
2 d 15 h
PR fusionados (30 d)
39

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de finos/git-proxy

Todos los issues de finos/git-proxy

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.