Comments (7)
paths -> replace dirs except for common ones
git url -> replace url, replace dirs of path
replace parts of arguments if possible:
scp [email protected]:path/path
-> scp HASH@HASH:HASH/HASH
replace whole arguments if they don't match any special form
git commit -m "message"
-> git commit -m HASH
keep standard arguments and commands (?)
from resh.
Almost done: https://github.com/curusarn/resh/tree/dev_2
from resh.
I'm handling different types of data differently.
Types
Single value entries
e.g. username, hostname (usually sensitive information)
- replace with its hash
- no exceptions, no whitelist
Paths
- split by
/
- repace each part by its hash
- unless it's in the whitelist or it's only one character
- append together
Git origin URL
- parse the URL using this library https://github.com/whilp/git-urls
- repace each part by its hash
- unless it's in the whitelist or it's only one character long
- get a string of sanitized URL
Command line
I need to replace the command and arguments separately so that I can analyze partial matches later.
However, I don't want to parse bash.
I'm doing the following:
- split the line into consecutive strings of letters and/or digits (
tokens
)- command options are detected and left unhashed
- replace each token with its hash
- unless it's in the whitelist or it's only one character long
- append together
Whitelisting
I created a whitelist containing various common strings.
- directories in
/
- commands installed by default on Ubuntu, Debian or Fedora
- bash and zsh keywords and builtins
- file-extensions
- git subcommands
- some more stuff added by hand:
- "com", "cz", ...
- "vim", "emacs", ...
- "Makefile", "Dockerfile", ...
- ...
TL;DR
I pretty much hash everything except:
- Commandline options
- All non-alphanumeric chars
- Single-letter or single-digit strings
- Anything whitelisted (see above^)
from resh.
-
TODO: add more file extensions to the whitelist
-
TODO: show this to people
from resh.
I have shown this to 3 of my colleagues. Everyone was okay with the result. I got a suggestion that data is sanitized too much.
from resh.
I have found a couple of file extension databases. However, they don't seem very fond of other people using their data. I have asked FileInfo.com for permission to use their data.
- WAIT for fileinfo.com to message you back
from resh.
I have added a few of common TLDs to the list. Source: https://www.hayksaakian.com/most-popular-tlds/
from resh.
Related Issues (20)
- Bad UX when `.resh_history.json` is corrupted HOT 3
- Often crash on open terminal HOT 3
- vi bindings?
- resh messes with my starship prompt: it adds plus (+) to the start of it HOT 2
- Incomplete or incorrect text in install info block HOT 1
- Windows Support (MSYS2/git bash) HOT 5
- use of internal package github.com/curusarn/resh/internal/record not allowed HOT 1
- Release v3 HOT 1
- Don't enable RESH in old shells HOT 1
- Use `eval $(resh-init)` instead of `. ~/.resh/shellrc` HOT 3
- Bundle `bash-preexec` with Resh shell files
- Test v3 installation HOT 2
- Install using Brew HOT 1
- Unable to install it with sh HOT 3
- Bash-preexec use bash_preexec_imported
- Accessing history in multiuser environment HOT 2
- Additional Invocation Methods for Resh except ctrl+R HOT 4
- MacOS installation problems HOT 1
- broken fzf Ctrl + t feature. HOT 2
- Resh overrides behaviour of zsh-autosuggestions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resh.