Patch Changes
-
#121
cffa6a2Thanks @tufantunc! - Stop refusing read-only commands for mentioning a dangerous word, and say what a refusal actually refused (#91).The never-allowed list matched
shutdown,reboot,halt,poweroffandevalanywhere in the command string, so reading about one was refused as if it caused one.last reboot,grep -r reboot /etc/,cat /var/run/reboot-requiredandjournalctl | grep shutdownwere all denied. On a NAS, where an agent tends to check boot history early, this landed on the first command.These five now match an invocation: the head of each
;/&&/||/|/newline-separated segment, looked at past anysudo/doas/pkexecprefix and its value-taking flags, with the directory part stripped.sudo -u root reboot,/sbin/reboot,true && rebootandsystemctl rebootare still refused;sudo grep reboot /var/log/syslogis not. The check is a tokenizer rather than a regex, so it adds no backtracking to a path that is deliberately free of it.A knock-on fix: a command that merely mentions one of these words is no longer classified destructive either.
cat /var/run/reboot-requiredcomes back read-only, which is what it is.Refusals now name what matched.
Command matches denylist patternsaid nothing — not the rule, not its origin, not whether the reader could change it. A built-in refusal now names the rule and states that[policy].denylistadds patterns rather than removing these; an operator pattern is quoted back with the config key that carries it.APPROVAL_DENIEDno longer covers two different failures. Approval fails closed, so a client that cannot be asked — no elicitation support, a transport failure, a malformed reply — denied the command withUser did not approve this command, blaming the user for a prompt they never saw. That case is nowAPPROVAL_UNAVAILABLE, carrying the underlying error. The real decline keepsAPPROVAL_DENIED. The diagnosis previously existed only on stderr, which for a stdio server is a client log file nobody reads.