[Bug]: using hostname
to identify the host on macos allows DHCP servers to change content of "HOST" history search with default macos setup
#2391
Labels
bug
Something isn't working
What did you expect to happen?
Consistent hostname is assigned to commands executed on a given computer so that the HOST history search shows a growing list of history regardless of what network I'm connected to.
What happened?
Depending on what network I connect to (and what version of macos I'm using, as this changes the hostname sent to DHCP), I get different history from atuin.
For example, now that I'm running macos 15.0, my system sends a
MacBookPro
hostname to the DHCP server, and this DHCP server uses adds a suffix (.foo.example.com
), causing thehostname
(as returned via the hostname command, for example) to beMacBookPro.foo.example.com
. This ends up in thehistory.db
history table's hostname column.If I connect to another network that has DHCP set to assign a different domain, that also is used by atuin, and the host search only shows the current understanding of the hostname (dependent on the network).
One can examine the "Local hostname" configured in the macos settings with
scutil --get LocalHostName
. On systems with macos prior to 15.0, this hostname is sent to the DHCP server, and in many cases means we would (prior to macos 15.0) get a hostname that looked somewhat right and often functioned correctly.One can also use the command
scutil --set HostName bar
to set a fixed hostname, which the hostname command then returns. This is not exposed anywhere in the user interface for macos and is by default unset, meaning most users are likely to have their hostname change depending on dhcp settings today.Atuin doctor output
Code of Conduct
The text was updated successfully, but these errors were encountered: