google / google/magika

[Misdetection] OpenSSH private key file misdetected as <PEM certificate>

Open
#550 1 comment 0 reactions 0 assignees View on GitHub
misdetection
Dominant language
Rust
Stars
18.6k
Forks
1.2k
Avg merge
3d 12h
Merged PRs (30d)
20

Description

**What should the file have been detected as? What has the file been misdetected as?**
OpenSSH private key files are being mistaken for PEM certificate files.

**Please link or attach the misdetected file below** (Do NOT upload PII!)
The file could not be uploaded as the format is not supported. Also, the file is a private key, so I'm inclined to not share it.

**Additional context**
Private keys look a lot like PEM certificates, except that their structure is:
```
-----BEGIN PRIVATE KEY-----
[...Base64 gibberish...]
-----END PRIVATE KEY-----
```
whereas certificates' format is:
```
-----BEGIN CERTIFICATE-----
[...Base64 gibberish...]
-----END CERTIFICATE-----
```

I would have thought that this was an easy distinction, and in fact, the Linux command `file` manages to distinguish them.

I got this mistake both in command-line and from Python code. I'm using the model `standard_v1`. Should I be doing something different?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.