Report it privately through GitHub: Security > Report a vulnerability on this repository. Do not open a public issue. Expect a first answer within 5 business days.
- The private key and the
.pfxpassword never leave the process. The key signs the TLS handshake locally; only the public certificate is sent to the official Sefin and ADN hosts (*.nfse.gov.br). TLS server verification uses Node's defaults. Certificate.privateKeyPemis the decrypted private key. Keep it in memory only. Store the.pfxand its password encrypted, and never log them.- The public certificate is embedded in every signed DPS and event XML, and Sefin returns it inside the NFS-e XML. For an e-CNPJ it carries holder data, including the legal representative's CPF and birth date. Treat signed DPS XML, NFS-e XML and event XML as personal data.
loadCertificateonly extracts data. It does not validate the ICP-Brasil chain, socertificate.cnpjis not proof that the uploader owns the company. Never use it for authorization.loadCertificaterefuses.pfxfiles over 64 KB, passwords over 256 characters and more than 300,000 key-derivation iterations in total. It is synchronous: an accepted file can still cost about 0.3 s of CPU. Residual risk: the iteration cap only sees unencrypted layers, so a crafted.pfxcan hide a larger count inside an encrypted layer. Parse untrusted uploads in a worker thread with a time limit, and rate-limit them.- Sefin answers are limited to 10 MB, compressed and decompressed. An ADN page is limited to 10 MB of body and
10 MB decompressed in total. Larger or malformed answers throw
SefinError/AdnErrorwith kindunavailable. - XML text values are escaped when the DPS and events are built, and the fields that form
Idattributes are validated (digits, or uppercase letters for a CNPJ). The library does not verify signatures of XML it receives; it trusts Sefin and the ADN over TLS. - Never commit certificates, passwords or XML captured from Sefin without anonymizing it and removing its signatures.