Skip to content

Conversation

entity0xfe
Copy link
Contributor

This PR aims to mitigate the token-disclosure described in #8561 (comment) by @GermanCoding: The client leaks the relay-token to discovery by announcing it as part of the relay://...-URL.

I tested this PR with network local and external clients (read: local and global discovery) but would appreciate it if somebody else could give it a go.

@calmh
Copy link
Member

calmh commented Jan 28, 2023

The question in my mind is whether/why we want to pass on any query parameters whatsoever to discovery...

@GermanCoding
Copy link
Contributor

As I understand the current logic, we do submit the query part of the relay server URL because it contains the relay server ID. ST clients wanting to dial another device via a relay address want to open a relay session in temporary mode. In order to perform relay server certificate validation, they need to know the ID. They can get that via the announced URL as part of the query.

@calmh
Copy link
Member

calmh commented Jan 28, 2023

Good point, so that needs to be sent. But currently we just send the full URL as we got it from the relay pool endpoint (or manual config), which contains all kinds of stuff like who provides it etc.

@GermanCoding
Copy link
Contributor

So we perhaps want to invert the logic (block vs allowlist)? Only include query parameters we explicitly want announced to discovery (the ID) and ignore everything else?

entity0xfe and others added 2 commits February 22, 2023 19:48
Use a whitelist of allowed relay address parameters instead of
filtering out the token
@imsodin imsodin changed the title Don't leak relay-tokens to discovery lib/discover: Don't leak relay-tokens to discovery Feb 22, 2023
@entity0xfe
Copy link
Contributor Author

Something like this? I think the checks failing has nothing to do with the code.

imsodin
imsodin previously approved these changes Mar 2, 2023
Copy link
Member

@imsodin imsodin left a comment

Choose a reason for hiding this comment

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

This looks good - thanks for updating it!

Just one naming suggestion - already approved though.

@imsodin
Copy link
Member

imsodin commented Mar 2, 2023

And yes, the check is definitely not on this PR - probably some FS/OS limitation of the github actions runner (those jobs are new-ish - nice btw :) ).

@imsodin imsodin merged commit 4558eef into syncthing:main Mar 4, 2023
calmh added a commit to imsodin/syncthing that referenced this pull request Mar 10, 2023
* main: (46 commits)
  build: Update dependencies
  lib/api: Expose `blocksHash` in file info (syncthing#8810)
  gui, man, authors: Update docs, translations, and contributors
  lib/discover: Don't leak relay-tokens to discovery (syncthing#8762)
  gui, man, authors: Update docs, translations, and contributors
  gui: Add Croatian (hr) translation template (syncthing#8801)
  build(deps): bump github.com/quic-go/quic-go from 0.32.0 to 0.33.0 (syncthing#8800)
  cmd/stupgrades: Cache should apply to HEAD as well as GET
  build: Add more GitHub Actions
  gui: Remove non-existent customicons.css file reference (fixes syncthing#8797) (syncthing#8798)
  Only fail after chmod error if permissions differ (e.g. on config file) (syncthing#8771)
  gui, man, authors: Update docs, translations, and contributors
  build: Use Go 1.19.6 for Windows
  build: Update dependencies
  gui, man, authors: Update docs, translations, and contributors
  gui: Remove duplicate Spanish (Spain) translation (fixes syncthing#8781) (syncthing#8782)
  gui: Add xattr filter editor (fixes syncthing#8660) (syncthing#8734)
  gui: Switch to Weblate for translations (syncthing#8777)
  all: Use new Go 1.19 atomic types (syncthing#8772)
  gui, man, authors: Update docs, translations, and contributors
  ...
@calmh calmh added this to the v1.23.3 milestone Mar 14, 2023
calmh added a commit to tomasz1986/syncthing that referenced this pull request Mar 18, 2023
* main: (424 commits)
  gui, man, authors: Update docs, translations, and contributors
  lib/protocol: Cache expensive key operations (fixes syncthing#8599) (syncthing#8820)
  gui: Add Persian (fa) translation template (syncthing#8822)
  lib: Correctly handle encrypted trailer size (fixes syncthing#8556) (syncthing#8563)
  gui: Disable Restore Versions filters when no versioned files exist (fixes syncthing#5408) (syncthing#8539)
  build(deps): bump github.com/chmduquesne/rollinghash from 0.0.0-20180912150627-a60f8e7142b5 to 4.0.0+incompatible (syncthing#8804)
  build: Update dependencies (syncthing#8821)
  lib/api: Expose `blocksHash` in file info (syncthing#8810)
  gui, man, authors: Update docs, translations, and contributors
  lib/discover: Don't leak relay-tokens to discovery (syncthing#8762)
  gui, man, authors: Update docs, translations, and contributors
  gui: Add Croatian (hr) translation template (syncthing#8801)
  build(deps): bump github.com/quic-go/quic-go from 0.32.0 to 0.33.0 (syncthing#8800)
  cmd/stupgrades: Cache should apply to HEAD as well as GET
  build: Add more GitHub Actions
  gui: Remove non-existent customicons.css file reference (fixes syncthing#8797) (syncthing#8798)
  Only fail after chmod error if permissions differ (e.g. on config file) (syncthing#8771)
  gui, man, authors: Update docs, translations, and contributors
  build: Use Go 1.19.6 for Windows
  build: Update dependencies
  ...
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Mar 3, 2024
@syncthing syncthing locked and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants