A file holding a private key
A file that carries a PEM private-key header or footer (-----BEGIN … PRIVATE KEY----- or -----END … PRIVATE KEY-----: plain, RSA, EC, DSA, OpenSSH, PGP, encrypted) is never drawn. The check runs once, where the Source tab reads the blob, before a renderer or the long-file tail is chosen, so a key in a .md, a .json (line breaks written \n), a .csv, the tail of an oversized log, or the hex head of a binary is withheld alike. A README holding one is not drawn under the tree.
- What shows: the empty state (
empty, the component the binary and too-large files use) titled Private key, with the shared sentencePRIVATE_KEY_NOTICEand a Download button and a View raw link beside it. Raw and Download return the file as pushed. - Quoted headers: source that only quotes a header (a secret scanner, say) is withheld too; that is accepted, Raw shows it.
- Speed: the detector finds each
PRIVATE KEYwithindexOfand reads only the 51 characters before it with a fixed, bounded pattern, so a hostile file costs one pass (test/blob-private-key.test.tstimes 200 escaped lines under 50 ms). - Terminal: the workspace and its facts view show the same sentence as the file's only line.
- Code:
src/core/private_key.tsholds the one detector and sentence;web/render/cert.ts,web/pages/repo.tsand the terminal import it.