Repository navigation
fix(security): el scaffolder recibe el nombre validado, no una relectura de la petición (CodeQL #226) - #750
Merged
beyondnetPeru merged 1 commit intoSep 19, 2026
Conversation
…o una relectura de la petición Última alerta CodeQL abierta sobre main (#226, js/path-injection en node-filesystem.provider.ts:50). El flujo del SARIF: POST /projects/initialize → body.name → InitializeProjectUseCase → ProjectScaffolderService:188 (`${projectDir}/${input.name}.csproj`) → writeFile. La guarda de #725/#737 sanea el alias local `name` (regex + `includes('..')` + `isAbsolute`), pero el scaffolder vuelve a leer `input.name` del objeto de la petición, y CodeQL rastrea el campo del objeto aparte del alias. Ahora el caso de uso reconstruye la entrada con el valor validado (`safeInput`) y es eso lo que llega al scaffolder; las etiquetas de `artifacts` también usan `name`. Ninguna otra lectura de `input.name` queda aguas abajo. No es solo la forma que CodeQL modela: un objeto cuya `name` responda una cosa a la guarda y otra al scaffolder (getter, proxy) es un TOCTOU real, y el test nuevo lo ejercita: el segundo read devuelve `../escape` y aun así lo escrito es `/tmp/honest/honest.csproj`, sin `..` en ninguna ruta ni artefacto. Verificado: spec 18/18 (17 previos + 1 nuevo), tsc sin errores en el fichero. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
📊 Bilingual Coverage ImpactPR Changes
Repository Coverage
✅ Good: All EN changes have ES counterparts. Generated by GitHub Actions |
beyondnetPeru
deleted the
security/codeql-path-injection-scaffolder-name
branch
September 19, 2026 13:10
This was referenced Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cierra la última alerta CodeQL abierta sobre
main(#226,js/path-injection,node-filesystem.provider.ts:50).El flujo (SARIF de main, no el tab)
POST /projects/initialize→body.name→InitializeProjectUseCase.execute→ProjectScaffolderService.scaffoldDotnet:188(${projectDir}/${input.name}.csproj) →NodeFileSystemProvider.writeFile.La guarda de #725/#737 sanea el alias local
nameen la forma canónica (includes('..')+isAbsolute), pero el scaffolder releeinput.namedel objeto de la petición y CodeQL rastrea el campo aparte del alias.Qué cambia
safeInput = { ...input, name }) y es eso lo que recibenscaffoldEvolithYaml/scaffoldReadme/scaffoldByRuntime/scaffoldCommitConventions; las etiquetas deartifactsusanname. No queda ninguna lectura deinput.nameaguas abajo de la guarda.namecon getter que respondehonesta la guarda y../escapedespués → lo escrito es/tmp/honest/honest.csproj, sin..en rutas ni artefactos.Verificación
initialize-project.use-case.spec.ts: 18/18 (17 previos + 1 nuevo).CodeQL SASTpor push sobremain(gh workflow run sdk-cli-ci.yml --ref maintras la promoción, porque el trigger por paths no cubrecore-domain).🤖 Generated with Claude Code