News for hackers. Stuff that matters.
Re:Show HN: HiSHtory: Your shell history in context, synced,... by pastage on Wednesday November 02, 2022 @04:09AM (#33432587)
Sending your command history automatically over the network is always an huge security risk. This tool atleast have a security section in the readme, but nothing about operational security and how to guard against hacks of one synced agent.

I will try it because the history tool looks like an interesting take, but the security model is not ok for multi computer use.

Re:Show HN: HiSHtory: Your shell history in context, synced,... by ellieh on Wednesday November 02, 2022 @05:57AM (#33433429)
I think my main concern here is the fact that you're putting secrets in your shell history!
Re:Show HN: HiSHtory: Your shell history in context, synced,... by dopidopHN on Wednesday November 02, 2022 @07:21AM (#33434014)
Mistake happen.

Yesterday I was tired and working on a friend serveur. The ssh prompt was different and I entered the password from a account while the remote port has hang up on me. So effectively typing “password” straight on my shell.

His password is in my history now. I removed it but that type of thing happen all the time. ( Not that much in a professional settings, password tends to fade away )

Re:Show HN: HiSHtory: Your shell history in context, synced,... by capableweb on Wednesday November 02, 2022 @09:00AM (#33434995)
Pro-tip: if you wanna hide stuff from your shell history, enter a space/blank before the actual command.

Not that it probably would have helped in this situation, but maybe useful for others.

Usually if I have to enter secrets in my shell, I do something like this in order to save the useful stuff to history but hiding the secrets:

- ` export PASSWORD=hunter2` (notice the space before "export")

- `service-cli login username $PASSWORD` (no space before, gets saved to shell history)

Re:Show HN: HiSHtory: Your shell history in context, synced,... by Cockbrand on Wednesday November 02, 2022 @09:14AM (#33435184)
While ignoring commands preceded by a space character is absolutely one of my very favorite shell features, it usually isn't enabled by default (YMMV).

HISTCONTROL=ignorespace # bash

setopt hist_ignore_space # zsh

These go into ~/.bashrc or ~/.zshrc, respectively. zsh is really smart about this and always enables you to retrieve the immediate previous line with arrow-up, no matter whether it's got preceding whitespace or not.

Re:Show HN: HiSHtory: Your shell history in context, synced,... by 400thecat on Wednesday November 02, 2022 @09:27AM (#33435393)
why use `export` ? That is a terrible idea.
Re:Show HN: HiSHtory: Your shell history in context, synced,... by ddworken on Wednesday November 02, 2022 @10:43PM (#33446283)
+1 to prefixing with a space. hiSHtory supports this out of the box so that anything prefixed with a space isn't recorded (even if your shell doesn't do that by default!). And if you do ever mess up, `hishtory redact` can be used to delete history entries.
Re:Show HN: HiSHtory: Your shell history in context, synced,... by remram on Friday November 04, 2022 @11:43PM (#33477687)
Other options:

- read -s PASSWORD

- service-cli login username $(cat)

At least you probably don't want to use `export` when setting the variable.

Re:Show HN: HiSHtory: Your shell history in context, synced,... by Cockbrand on Wednesday November 02, 2022 @09:08AM (#33435087)
I've certainly entered passwords at the shell prompt by accident. This doesn't happen often, but it sure does.
Re:Show HN: HiSHtory: Your shell history in context, synced,... by ilyt on Wednesday November 02, 2022 @09:34AM (#33435500)
Some apps only accept password in commandline.

The better written ones might accept it in env but that will also stay in history.

But if someone have access to your home they can put keylogger in the .profile/.bashrc so it's not really relevant...

Re:Show HN: HiSHtory: Your shell history in context, synced,... by ellieh on Wednesday November 02, 2022 @10:21AM (#33436241)
Sure, but something like this also works well:

`the-command --password $(read -s;echo $REPLY)`

Re:Show HN: HiSHtory: Your shell history in context, synced,... by ilyt on Thursday November 03, 2022 @10:19AM (#33451403)
yeah now instead of history you can get the app's password via `ps aux` :D

also you still have the `export REPLY=password` in history.

sure you can source it out of file but, well, that file have same permissions (or looser! if you forgot to change) as your .bash_history file.

`cat password|command` is the safest one (or, well, something 12 factor app clowns hate, a config file)