change allowed characters for options, add bash keywords and builtins to whitelist

pull/13/head
Simon Let 7 years ago
parent bb82c73a50
commit 0900bc4441
  1. 4
      sanitize-history/resh-sanitize-history.go
  2. 61
      sanitizer_data/whitelist.txt

@ -179,8 +179,8 @@ func (s *sanitizer) sanitizeRecord(record *common.Record) error {
} }
func (s *sanitizer) sanitizeCmdLine(cmdLine string) (string, error) { func (s *sanitizer) sanitizeCmdLine(cmdLine string) (string, error) {
const optionEndingChars = "=;)" const optionEndingChars = "\"$'\\#[]!><|;{}()*,?~&=" // all bash control characters and '=' which commonly ends options w/ values
const optionAllowedChars = "-_" const optionAllowedChars = "-_" // characters commonly found inside of options
sanCmdLine := "" sanCmdLine := ""
buff := "" buff := ""

@ -1,7 +1,13 @@
!
. .
.. ..
:
[ [
[[
]]
{
}
addgnupghome addgnupghome
addgroup addgroup
addpart addpart
@ -37,6 +43,7 @@ bashbug
bashbug-64 bashbug-64
bg bg
bin bin
bind
blkdeactivate blkdeactivate
blkdiscard blkdiscard
blkid blkid
@ -44,9 +51,11 @@ blkzone
blockdev blockdev
boot boot
bootctl bootctl
break
bridge bridge
brotli brotli
build-locale-archive build-locale-archive
builtin
bunzip2 bunzip2
busctl busctl
bzcat bzcat
@ -62,8 +71,10 @@ bzless
bzmore bzmore
cal cal
ca-legacy ca-legacy
caller
capsh capsh
captoinfo captoinfo
case
cat cat
catchsegv catchsegv
cd cd
@ -104,7 +115,12 @@ com
combinedeltarpm combinedeltarpm
comm comm
command command
compgen
complete
compopt
continue
convert convert
coproc
coredumpctl coredumpctl
cp cp
cpgr cpgr
@ -163,6 +179,7 @@ deb-systemd-helper
deb-systemd-invoke deb-systemd-invoke
debugfs debugfs
debuginfo-install debuginfo-install
declare
delgroup delgroup
delpart delpart
deluser deluser
@ -178,6 +195,8 @@ dircolors
dirmngr dirmngr
dirmngr-client dirmngr-client
dirname dirname
dirs
disown
dmesg dmesg
dmfilemapd dmfilemapd
dmsetup dmsetup
@ -185,8 +204,10 @@ dmstats
dnf dnf
dnf-3 dnf-3
dnsdomainname dnsdomainname
do
docker docker
domainname domainname
done
dpkg dpkg
dpkg-deb dpkg-deb
dpkg-divert dpkg-divert
@ -214,12 +235,20 @@ echo
egrep egrep
eject eject
elfedit elfedit
elif
else
enable
env env
esac
etc etc
eval
evmctl evmctl
ex ex
exec
exit
expand expand
expiry expiry
export
expr expr
factor factor
faillock faillock
@ -232,6 +261,7 @@ fdisk
ffmpeg ffmpeg
fg fg
fgrep fgrep
fi
filefrag filefrag
fincore fincore
find find
@ -244,6 +274,7 @@ fish
flock flock
fmt fmt
fold fold
for
free free
fsck fsck
fsck.cramfs fsck.cramfs
@ -254,6 +285,7 @@ fsck.minix
fsfreeze fsfreeze
fstab-decode fstab-decode
fstrim fstrim
function
g13 g13
g13-syshelp g13-syshelp
gapplication gapplication
@ -310,7 +342,9 @@ halt
hardlink hardlink
hash hash
head head
help
hexdump hexdump
history
home home
hostid hostid
hostname hostname
@ -324,8 +358,10 @@ iconvconfig
iconvconfig.x86_64 iconvconfig.x86_64
id id
idn idn
if
ifenslave ifenslave
igawk igawk
in
info info
infocmp infocmp
infokey infokey
@ -366,6 +402,7 @@ ldconfig
ldconfig.real ldconfig.real
ldd ldd
ld.gold ld.gold
let
lgroupadd lgroupadd
lgroupdel lgroupdel
lgroupmod lgroupmod
@ -378,6 +415,7 @@ linux64
ln ln
lnewusers lnewusers
lnstat lnstat
local
locale locale
locale-check locale-check
localectl localectl
@ -387,6 +425,7 @@ logger
login login
loginctl loginctl
logname logname
logout
logsave logsave
look look
losetup losetup
@ -416,6 +455,7 @@ make
makedb makedb
makedeltarpm makedeltarpm
make-dummy-cert make-dummy-cert
mapfile
mawk mawk
mcookie mcookie
md5sum md5sum
@ -512,6 +552,7 @@ pkill
pldd pldd
pmap pmap
policy-rc.d policy-rc.d
popd
portablectl portablectl
poweroff poweroff
pr pr
@ -521,6 +562,7 @@ prlimit
proc proc
ps ps
ptx ptx
pushd
pwck pwck
pwconv pwconv
pwd pwd
@ -546,8 +588,10 @@ rbash
rdisc rdisc
rdma rdma
read read
readarray
readelf readelf
readlink readlink
readonly
readprofile readprofile
realpath realpath
reboot reboot
@ -565,11 +609,12 @@ repo-rss
reposync reposync
repotrack repotrack
reset reset
resh
resize2fs resize2fs
resizepart resizepart
resolvconf resolvconf
resolvectl resolvectl
resh return
rev rev
rfkill rfkill
rgrep rgrep
@ -610,12 +655,14 @@ scriptreplay
sdiff sdiff
sed sed
sefcontext_compile sefcontext_compile
select
select-editor select-editor
sensible-browser sensible-browser
sensible-editor sensible-editor
sensible-pager sensible-pager
seq seq
service service
set
setarch setarch
setcap setcap
setfacl setfacl
@ -634,6 +681,8 @@ sha384sum
sha512sum sha512sum
shadowconfig shadowconfig
sh.distrib sh.distrib
shift
shopt
show-changed-rco show-changed-rco
show-installed show-installed
shred shred
@ -649,6 +698,7 @@ sln
snice snice
sort sort
sotruss sotruss
source
split split
sprof sprof
sqlite3 sqlite3
@ -668,6 +718,7 @@ sudoedit
sudoreplay sudoreplay
sulogin sulogin
sum sum
suspend
swaplabel swaplabel
swapoff swapoff
swapon swapon
@ -716,9 +767,12 @@ telinit
tempfile tempfile
test test
testgdbm testgdbm
then
tic tic
time
timedatectl timedatectl
timeout timeout
times
tipc tipc
tload tload
tmp tmp
@ -729,6 +783,7 @@ tput
tr tr
tracepath tracepath
tracepath6 tracepath6
trap
true true
truncate truncate
trust trust
@ -737,6 +792,7 @@ tsort
tty tty
tune2fs tune2fs
type type
typeset
tzconfig tzconfig
tzselect tzselect
udevadm udevadm
@ -756,7 +812,9 @@ unix_update
unlink unlink
unlz4 unlz4
unminimize unminimize
unset
unshare unshare
until
unxz unxz
update-alternatives update-alternatives
update-ca-trust update-ca-trust
@ -794,6 +852,7 @@ wdctl
weak-modules weak-modules
whereis whereis
which which
while
who who
whoami whoami
wipefs wipefs

Loading…
Cancel
Save