Segurança: atualiza fast-xml-parser de 4.5.3 para 5.9.3#25
Open
jcmelati wants to merge 1 commit into
Open
Conversation
Corrige as falhas criticas de expansao de entidades em DOCTYPE presentes no fast-xml-parser 4.5.3 (GHSA-jmr7-xgp7-cmfj, GHSA-m7jm-9gc2-mpf2 e GHSA-8gc5-j5rx-235r). A correcao vem do endurecimento padrao da v5; a biblioteca nao define nenhuma opcao de entidade, entao herda os padroes seguros sem mudanca de comportamento. - package.json: fast-xml-parser 4.5.3 -> 5.9.3, versao 0.14.13 -> 0.14.14 - src/util/xml.js: inalterado — todas as opcoes de XMLParser/XMLBuilder mantem o mesmo padrao na v5 (saida verificada byte-a-byte identica entre 4.5.3 e 5.9.3) - test/helpers.test.js: testes golden, orientados a fixtures, para os helpers montarResponse sensiveis a versao (cStat 138 unico/array, 137, RecepcaoEvento 135/573) com docZip realmente compactado em gzip Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Contexto
O
fast-xml-parser@4.5.3é vulnerável a três falhas críticas de expansão de entidades em DOCTYPE, ainda em aberto nonpm audit:A correção da série 4.x não cobre estas falhas, então o caminho é a v5.
Mudança
package.json:fast-xml-parser4.5.3→5.9.3(e versão0.14.13→0.14.14).src/util/xml.js: inalterado. A v5.0.0 foi um release de empacotamento (ESM/CJS dual) sem mudança de API; as correções dos CVEs são endurecimento padrão (limites de expansão de entidade + validação de DOCTYPE). A biblioteca não define nenhuma opção de entidade, então herda os padrões seguros automaticamente. Orequire('fast-xml-parser')continua retornando{ XMLBuilder, XMLParser }no build CJS.Por que é seguro (comportamento idêntico)
Rodei um teste de paridade lado a lado (4.5.3 vs 5.9.3) com exatamente as opções do
XMLParserdesta lib (parseTagValue:false,parseAttributeValue:false,textNodeName:'value',attributeNamePrefix:'@_', etc.). A saída foi byte-a-byte idêntica em todos os casos:&→&e demais entidades predefinidas decodificam igual;000000000000001) permanece string (sem numericização).Testes
Adicionei
test/helpers.test.js— testes golden orientados a fixtures que exercitam os helpers sensíveis a versão (DistribuicaoHelper.montarResponseeRecepcaoHelper.montarResponse), e não apenasXml.xmlToJson:cStat 138com um e com doisdocZip(coerção single→array e o caminho de array), comdocZiprealmente compactado em gzip para exercitarGzip.unzip+ o parse interno;cStat 137(nada novo) →docZipvazio;RecepcaoEventocStat 135(registrado) e573(duplicidade), incluindo o caminho de múltiplosretEvento;<error>de transporte.npm run buildpermanece reproduzível e os testes de parser (test/xml.test.js) seguem verdes.🤖 Generated with Claude Code