Skip to content

auth: disable sha1 by default on non-windows#413

Merged
guelfey merged 1 commit intogodbus:masterfrom
xnox:removing-sha1
Nov 14, 2025
Merged

auth: disable sha1 by default on non-windows#413
guelfey merged 1 commit intogodbus:masterfrom
xnox:removing-sha1

Conversation

@xnox
Copy link
Contributor

@xnox xnox commented Sep 23, 2025

On non-windows platforms only external auth method is enabled. On windows platforms only sha1 auth method is available and usable.

Make default behaviour of godbus consistent with default dbus configurations on non-windows platforms.

This removes crypto and sha1 usage from godbus on non-windows platforms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with changing the default behavior to not use this mechanism on non-Windows platforms, but why make the AuthCookieSha1 definition completely Windows-only? Users can still explicitly specific authentication mechanisms, so this change would remove the possibility to use this mechanism (and strictly speaking, be a breaking change since this removes an exported type). Even though EXTERNAL is pretty much always used when it works (i.e. on Unix), maybe some users have cases where even on Unix, EXTERNAL can't be used but SHA1 can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because all usage of SHA1 must be deprecated. I am also trying to build applications that embed go-dbus without ability to use SHA1 anymore.

I do not believe any Linux distribution has working and configured SHA1 Auth that is secure. Nor can it be used securely.

Is there any pre-existing evidence of any SHA1 usage on Linux? I posit, if there was, it would have been upgraded to sha256 by now.

If such pre-existing deployments exist I can add an opt-in build tag for this. However it is insecure, and dbus spec needs upgrades to sha256.

Cc @martinpitt any advice here? Or who else to ask?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. Generally I try to stick to what the official spec says, and there it is still mentioned as the "recommended authentication mechanism for platforms and configurations where EXTERNAL cannot be used."

However it is insecure, and dbus spec needs upgrades to sha256.

I advise you to then open an issue with the spec itself: https://gitlab.freedesktop.org/dbus/dbus/-/issues

I can't judge how much / whether this is actually used - my gut feeling is that this is pretty rare, but I have been surprised before. We can merge this and see if any bug reports come in; but as long as the spec still mentions this mechanism, I'm prepared to revert this PR if this actually causes issues for users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On non-windows platforms only external auth method is enabled. On
windows platforms only sha1 auth method is available and usable.

Make default behaviour of godbus consistent with default dbus
configurations on non-windows platforms.

This removes crypto and sha1 usage from godbus on non-windows
platforms.
@guelfey guelfey mentioned this pull request Nov 14, 2025
@guelfey guelfey merged commit 99fac80 into godbus:master Nov 14, 2025
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants