|
1 | | -# sensleak-rs |
| 1 | +# sensleak-rs |
| 2 | + |
| 3 | +sensleak-rs is developing a detect tool similar to gitleaks using Rust, which will detecting hardcoded secrets like passwords, api keys, and tokens in git repos. |
| 4 | + |
| 5 | +## Background |
| 6 | + |
| 7 | +Many developers store sensitive information such as keys and certificates in their code, which poses security risks. Therefore, there are commercial services like GitGuardian scanning GitHub and GitLab, as well as open-source components like truffleHog and Gitleaks that support similar functionalities. |
| 8 | + |
| 9 | +### Requirements |
| 10 | + |
| 11 | +Develop a Git repository sensitive data detection tool using the Rust programming language. |
| 12 | + |
| 13 | +1. Develop in Rust for improved security. |
| 14 | +2. Command-line tool that outputs a test report. |
| 15 | +3. Support running as a service and provide access control through a REST API. |
| 16 | + |
| 17 | +### Environment |
| 18 | + |
| 19 | +- Runs on X86_64 and ARM64 architectures. |
| 20 | +- Uses Rust Edition 2021. |
| 21 | + |
| 22 | +## Usage |
| 23 | + |
| 24 | +Here are a few examples of how to use the tool in different scenarios: |
| 25 | + |
| 26 | +- Running the tool in the command-line interface (CLI) to perform sensitive data checks. |
| 27 | + |
| 28 | +**Note: This project is currently under development. The following features describe sensitive information search within a local folder.** |
| 29 | + |
| 30 | +```shell |
| 31 | +sensleaks-rs |
| 32 | + |
| 33 | +Usage: sensleak.exe [OPTIONS] --repo <REPO> |
| 34 | + |
| 35 | +Options: |
| 36 | + -r, --repo <REPO> Target repository |
| 37 | + -c, --config <CONFIG> Config path.. [default: gitleaks.toml] |
| 38 | + -o, --report <REPORT> Path to write json leaks file [default: ] |
| 39 | + -v, --verbose Show verbose output from scan |
| 40 | + -e, --pretty Pretty print json if leaks are present |
| 41 | + -h, --help Print help (see more with '--help') |
| 42 | + -V, --version Print version |
| 43 | + |
| 44 | +Repository: https://github.com/open-rust-initiative/sensleak-rs |
| 45 | +``` |
| 46 | +
|
| 47 | +Examples: (test the file in src\tests\files\test) |
| 48 | +
|
| 49 | +```shell |
| 50 | +sensleak -r="tests\files\test" -v -e |
| 51 | +``` |
| 52 | +
|
| 53 | +Output: |
| 54 | +
|
| 55 | +```shell |
| 56 | +[ |
| 57 | + OutputItem { |
| 58 | + line: "token = sk_test_abcd1234567890efghijklmno", |
| 59 | + line_number: 5, |
| 60 | + secret: "sk_test_abcd1234567890efghijklmno", |
| 61 | + entropy: "", |
| 62 | + commit: "", |
| 63 | + repo: "", |
| 64 | + rule: "Stripe Access Token", |
| 65 | + commit_message: "", |
| 66 | + author: "", |
| 67 | + email: "", |
| 68 | + file: "tests\\files\\test\\file2.txt", |
| 69 | + date: "", |
| 70 | + tags: "", |
| 71 | + operation: "", |
| 72 | + }, |
| 73 | + OutputItem { |
| 74 | + line: "twilio_api_key = SK12345678901234567890123456789012", |
| 75 | + line_number: 6, |
| 76 | + secret: "SK12345678901234567890123456789012", |
| 77 | + entropy: "", |
| 78 | + commit: "", |
| 79 | + repo: "", |
| 80 | + rule: "Twilio API Key", |
| 81 | + commit_message: "", |
| 82 | + author: "", |
| 83 | + email: "", |
| 84 | + file: "tests\\files\\test\\file2.txt", |
| 85 | + date: "", |
| 86 | + tags: "", |
| 87 | + operation: "", |
| 88 | + }, |
| 89 | + .... |
| 90 | +] |
| 91 | +WARN:[2023-05-17 09:45:07]10 leaks detected. XXX commits scanned in 66.6222ms |
| 92 | +``` |
| 93 | +
|
| 94 | +
|
| 95 | +
|
| 96 | +- Accessing the tool's functionality through the REST API for access control and data scanning. (Coming soon...) |
| 97 | +
|
| 98 | +## Configuration |
| 99 | +
|
| 100 | +Use the [gitleaks configuration](https://github.com/gitleaks/gitleaks#configuration) in this project. |
| 101 | +
|
| 102 | +## Document |
| 103 | +
|
| 104 | +Run the following code to read the project document. |
| 105 | +
|
| 106 | +```shell |
| 107 | +cargo doc --document-private-items --open |
| 108 | +``` |
| 109 | +
|
| 110 | +## Contributing |
| 111 | +
|
| 112 | +The project relies on community contributions and aims to simplify getting started. To use sensleak-rs, clone the repo, install dependencies, and run sensleak-rs. Pick an issue, make changes, and submit a pull request for community review. |
| 113 | +
|
| 114 | +To contribute to rkos, you should: |
| 115 | +
|
| 116 | +- Familiarize yourself with the [Code of Conduct](https://github.com/open-rust-initiative/rkos/blob/main/CODE-OF-CONDUCT.md). sensleak-rs has a strict policy against abusive, unethical, or illegal behavior. |
| 117 | +- Review the [Contributing Guidelines](https://github.com/open-rust-initiative/rkos/blob/main/CONTRIBUTING.md). This document outlines the process for submitting bug reports, feature requests, and pull requests to sensleak-rs. |
| 118 | +- Sign the [Developer Certificate of Origin](https://developercertificate.org) (DCO) by adding a `Signed-off-by` line to your commit messages. This certifies that you wrote or have the right to submit the code you are contributing to the project. |
| 119 | +- Choose an issue to work on. Issues labeled `good first issue` are suitable for newcomers. You can also look for issues marked `help wanted`. |
| 120 | +- Fork the sensleak-rs repository and create a branch for your changes. |
| 121 | +- Make your changes and commit them with a clear commit message. |
| 122 | +- Push your changes to GitHub and open a pull request. |
| 123 | +- Respond to any feedback on your pull request. The sensleak-rs maintainers will review your changes and may request modifications before merging. |
| 124 | +- Once your pull request is merged, you will be listed as a contributor in the project repository and documentation. |
| 125 | +
|
| 126 | +To comply with the requirements, contributors must include both a `Signed-off-by` line and a PGP signature in their commit messages. You can find more information about how to generate a PGP key [here](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/generating-a-new-gpg-key). |
| 127 | +
|
| 128 | +Git even has a `-s` command line option to append this automatically to your commit message, and `-S` to sign your commit with your PGP key. For example: |
| 129 | +
|
| 130 | +```shell |
| 131 | +$ git commit -S -s -m 'This is my commit message' |
| 132 | +``` |
| 133 | +
|
| 134 | +## License |
| 135 | +
|
| 136 | +sensleak-rs is licensed under this licensed: |
| 137 | +
|
| 138 | +- MIT LICENSE ( https://opensource.org/licenses/MIT) |
| 139 | +
|
| 140 | +## References |
| 141 | +
|
| 142 | +1. [What is Gitleaks and how to use it?](https://akashchandwani.medium.com/what-is-gitleaks-and-how-to-use-it-a05f2fb5b034) |
| 143 | +2. [Gitleaks.tools](https://github.com/gitleaks/gitleaks) |
0 commit comments