Crates.io | slip |
lib.rs | slip |
version | 0.1.0 |
source | src |
created_at | 2020-04-30 15:17:32.069485 |
updated_at | 2020-04-30 15:17:32.069485 |
description | A hassle-free utility to encrypt error handling strings in your public binaries to protect your business logic |
homepage | |
repository | https://github.com/Moxinilian/slip/ |
max_upload_size | |
id | 235859 |
size | 19,318 |
A hassle-free utility to encrypt error handling strings in your public binaries to protect your business logic.
This crate DOES NOT provide general runtime obfuscation for strings. Please consider using something like obfstr for this purpose.
Sometimes one wants to make sure some business logic is difficult to reverse-engineer. But they also want it to be easy to debug, even in production. However, quality error handling might leak through error strings how the program works, giving great insight to attackers. slip helps tackling this specific issue.
slip is a Rust macro that converts error strings into encrypted tokens at compile time. Attackers only get exposed to those undecipherable tokens. Then, when the error comes back to the software maintainers, they will be able to decrypt it using their secret key. The unslip utility is an easy to use, easy to automate and transparent tool to decrypt tokens, even within complex error reports.
slip works best with automated error report systems, so users never get to see any slip token and can enjoy a quality product with automated bug fixes. If any of your dependencies uses slip, you can take advantage of it as well as the key is defined globally (even if the dependency is third party).
slip is a regular crates.io crate fetchable using cargo.
unslip is a binary. You can either download it from the GitHub releases for Linux and Windows (x64), or clone this repository and use cargo to install it on your system.
cargo install --path unslip
You first need to generate a secret key. You can do it using unslip, but any random 16 bytes hexadecimal string will do.
$ unslip key
Then, you need to set that key to be the SLIP_KEY
environment variable in your building environment (please see important considerations below).
On Linux, it can be done temporarily like so (the variable will disappear once you leave the terminal):
$ export SLIP_KEY=<your key, without quotations>
On Windows, it can be done temporarily like so (the variable will disappear once you leave the terminal):
$ set SLIP_KEY=<your key, without quotations>
Once this is done, slip is ready to be used! See the examples for how to use the macro, and the examples section for how to use unslip.
cargo clean
before building again.SLIP_KEY
is not provided. In cases where proceeding without encryption is the expected behavior for a missing key (such as in public dependencies), the allow-no-encryption
feature should be passed to the slip dependency.concat!
), or make the macro accept more than just string literals, is that possible?You can find how to use the macro in your code in the network protocol example (it's as simple as wrapping your strings with the macro).
slip!("this string will be encrypted!");
The unslip utility takes your secret key as parameter, takes the data to process from stdin and outputs the result to stdout.
For example, if you store the following error in input.txt
...
thread 'main' panicked at '$slip:1:WA5mKhwP74N+g8KjAT6hEA==:J1IxgRDKGxAWyM+uwF4y3ZyRKvysUw==$: $slip:1:p6NIauAikdOUN1Iw5OCc9Q==:ZIqdMcLD4q2dsOKaWw==$[3, 1, 2]'
...and then run...
$ unslip decrypt 15478569587452125874565845212565 < input.txt > output.txt
...output.txt
will contain the following human-friendly message!
thread 'main' panicked at 'failed to parse packet: packet data: [3, 1, 2]'
Licensed under the MIT license (license or http://opensource.org/licenses/MIT).