News for hackers. Stuff that matters.
Re:Shellfirm: Intercept risky patterns at the command line by TekMol on Sunday July 31, 2022 @03:24AM (#32293901)
This should be a small, easy to read bash script.

Not a plethora of rust files that compile to a binary.

I would never trust this thing to not cause more issues, unless it is so small and elegant, that I can audit it very easily and be very very sure it is safe.

Re:Shellfirm: Intercept risky patterns at the command line by NavinF on Sunday July 31, 2022 @03:49AM (#32294007)
Funny you say that when the sketchiest part of this submission is the shell script dependency it uses to intercept every command you run: https://github.com/rcaloras/bash-preexec/blob/master/bash-pr...

I don’t know rust, but the rust files in the submission look very straightforward. (Why wouldn’t it? It’s just matching a few hardcoded commands. It’d be easy in any language)

Re:Shellfirm: Intercept risky patterns at the command line by eladkaplan on Sunday July 31, 2022 @03:54AM (#32294038)
In base you need a hook that get the command before your shell execute the command. when the shell get the command interrupt this project execute shellfirm before summation in your shell
Re:Shellfirm: Intercept risky patterns at the command line by NavinF on Sunday July 31, 2022 @04:12AM (#32294125)
Yeah I get it. Your code is fine.

I just find it hilarious how that guy wanted you to implement this as a shell script so he could “audit it very easily”. I mean, bash-preexec.sh isn’t the worst shell script I’ve seen (It even has a Bats test!), but anyone that thinks shell scripts are easy to audit is full of shit.

Re:Shellfirm: Intercept risky patterns at the command line by eladkaplan on Sunday July 31, 2022 @04:15AM (#32294137)
In zshrc is much more easier based on the hooks that you get
Re:Shellfirm: Intercept risky patterns at the command line by creatonez on Sunday July 31, 2022 @03:30AM (#32293924)
Why nitpick the programming language of a project clearly intended to be used by the author?
Re:Shellfirm: Intercept risky patterns at the command line by TekMol on Sunday July 31, 2022 @03:36AM (#32293941)
Because of the indirection and complexity it causes.

The user is in a shell. The simplest way to add something to their system is a shellscript. No moving parts. You get what you see in the script.

The way the project is set up, there are multiple moving parts. The interaction between the shell, some compiler and a bunch of rust files.

Imagine during the moon landing, Neil Armstrong could not have communicated directly with Buzz Aldrin. But they would had to go through a translator who translates English to German. Who passes the message on to a translator who translates it from German to French. Who then passes it on to Buzz. BOOM!

                      +   /\
         +              .'  '.   *
                *      /======\      +
                      ;:.  _   ;
                      |:. (_)  |
                      |:.  _   |
            +         |:. (_)  |          *
                      ;:.      ;
                    .' \:.    / `.
                   / .-'':._.'`-. \
                   |/    /||\    \|
Re:Shellfirm: Intercept risky patterns at the command line by Thiez on Sunday July 31, 2022 @04:20AM (#32294171)
By that reasoning all command line tools must be shell scripts.
Re:Shellfirm: Intercept risky patterns at the command line by pca006132 on Sunday July 31, 2022 @03:45AM (#32293992)
I don't think this tool changes the shell command for you? Your analogy doesn't fit here.

But I do agree that it is probably easier to implement as a shell script.

Re:Shellfirm: Intercept risky patterns at the command line by eladkaplan on Sunday July 31, 2022 @04:37AM (#32294240)
shellfirm not changes the shell command, only get the the command and check the pattern. the shell is execute the command.

You really think shell script will be easier? can you elaborate?

Re:Shellfirm: Intercept risky patterns at the command line by IshKebab on Sunday July 31, 2022 @04:20AM (#32294169)
The idea that this would be easier to read and more reliable in Bash is downright hilarious.
Re:Shellfirm: Intercept risky patterns at the command line by eladkaplan on Sunday July 31, 2022 @04:23AM (#32294181)
what is your point? do implement the risky command in bash script?
Re:Shellfirm: Intercept risky patterns at the command line by glitchcrab on Sunday July 31, 2022 @04:34AM (#32294225)
They're saying that writing the whole thing in bash (no rust) would be even harder to read. Programming in bash is hideous.
Re:Shellfirm: Intercept risky patterns at the command line by eladkaplan on Sunday July 31, 2022 @04:49AM (#32294282)
agree, this is the reason that i wrote it in rust faster easy to maintain unitesting and small binary
Re:Shellfirm: Intercept risky patterns at the command line by eladkaplan on Sunday July 31, 2022 @03:51AM (#32294017)
Hey this project is very small, and not execution command! only prompt you a verification when detect a risky pattern from a yaml pre-define (default or by you)

You can see the yaml files.

it wrote in rust to make is faster