question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Private key recognition hook is not accurate

See original GitHub issue

Hi Team!

I just discovered your work, and it is fantastic. Many thanks for putting this together, it is very useful.

I have a use case where code is extracting private keys, and contains lines such as

String keyContents = base64Content.VersionData.tostring();
keyContents = keyContents.replace('-----BEGIN RSA PRIVATE KEY-----', '');
keyContents = keyContents.replace('-----END RSA PRIVATE KEY-----', '');
keyContents = keyContents.replace('\n', '');

This is caught by the private key discoverer and it makes the tests fail.

Technically, private keys or certs would have a pattern that is (-----BEGIN RSA PRIVATE KEY-----)( base64 stuff)(-----END RSA PRIVATE KEY-----)

The current code seems to just check if the words “BEGIN RSA PRIVATE KEY” appears in the code, which is slightly weak.

As a result, I am using a combination of pre-commit and Talisman but I would love to have a single code base for everything.

Best, Sam

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
nicaincommented, Jan 14, 2018

Thanks @asottile. Allowing .pre-commit-config.yaml to point to a different fork/sha made it very easy to test. Great design, Ill be tweeting and letting my co-workers know about your work!

1reaction
asottilecommented, Jan 14, 2018

Always open to improvements @nicain 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Cloud Composer get default service account private key
Now I'm trying to do the same in Cloud Composer but I can't find how to access the private key from the default...
Read more >
Best practices for managing service account keys - IAM
Because the private key lets you authenticate as the service account, having access to the private key is similar to knowing a user's...
Read more >
Secret Detection - GitLab Docs
By default, Secret Detection scans only the current state of the Git repository. Any secrets contained in the repository's history are not detected....
Read more >
How To Force SSH Client To Use Given Private Key/Identity File
Explains how to force SSH client to use given private key ( identity file ) under Linux, macOS, *BSD and Unix.
Read more >
Web Authentication: An API for accessing Public Key ... - W3C
A public key credential is created and stored by a WebAuthn Authenticator at ... If the credential ID is not recognized by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found