This implements a new peer-to-peer-based discovery protocol.
- The DHT is based on libp2p (of IPFS etc) and constitutes a new,
separate Syncthing-specific network. It does not piggyback on any
existing non-Syncthing nodes out there.
- It uses existing device IDs as the keys, and publishes discovery
documents that include the device certificate and are signed by the
same. This enables validation that the discovery data is _for_ the
right device ID, as well as published _by_ that device.
- The DHT runs on the QUIC socket, so it shares UPnP/NAT-PMP whole
punches and STUN discovery. (Unless the QUIC listener is disabled,
then it runs on an ephemeral socket and can effectively do only
queries and not participate as a full DHT node.)
- There is a hardcoded default pointing to three bootstrap nodes hosted
in the usual manner.
- Currently it's strictly additive -- it runs separately and in
parallell with the usual global discovery. Once proven and scaled, it
will gradually take over the duties of the global discovery.
- There is a new command line tool `stdht` which just runs a DHT node to
assist with discovery (the bootstrap nodes are this).
The diff is large and terrifying, but that's how it is.
Signed-off-by: Jakob Borg <[email protected]>
Syncthing's authentication options have seemed sort of lacking to me for
a while. I can choose between no authentication (and now the admin
interface is accessible to theoretically every website I visit), or
password authentication (why do I need a password? it's all on one
computer!). This PR adds magic tokens with which the `syncthing browse`
and `syncthing serve` commands can magically log you in.
I hope that adding this and refining it enough will make it eventually
possible to change the default from "zero auth" to "token auth only".
### Testing
Some unit tests, and manually tested using syncthing browser and
syncthing serve, both of which create a token when they open the
browser.
### Documentation
TODO
---------
Signed-off-by: tbodt <[email protected]>
Auto-accept ran before the check for ignored folders, so a folder in
the device's ignored folders was still accepted when the device
announced it. After that, the config cleanup removed the ignore entry,
because the folder existed again.
The docs say that an ignored folder is always skipped when the device
announces it. Skip ignored folders in the auto-accept loop too.
Signed-off-by: Vandra-Meyer Akos <[email protected]>
This adds pre-validation directly at the unmarshal step, of annotations
added to the protobuf definitions. This seeks to weed out unreasonable
situations early, by ensuring offsets are positive, string lengths are
limited, etc. Some of the limits are a bit subjective, but I think I've
put them above what is expected and reasonable...
---------
Signed-off-by: Jakob Borg <[email protected]>
A couple of "panic: bug: foo" type things, where the bug could be
controlled by the supposedly untrusted side.
Signed-off-by: Jakob Borg <[email protected]>
We might send unnecessary updates because something changed by the
actual announcement remains identical; skip those.
---------
Signed-off-by: Jakob Borg <[email protected]>
The API can use arbitrary paging parameters, causing arbitrary numbers
of prepared statements, which becomes a memory leak.
Signed-off-by: Jakob Borg <[email protected]>
This could happen when a folder has deleted files as the latest entries,
and nothing else happened for 180 days (the default tombstone cleanup
time).
Signed-off-by: Jakob Borg <[email protected]>
Prior to refactoring, this delay kicked in once all batches were sent.
Now, it came between each batch. Fix that.
---------
Signed-off-by: Jakob Borg <[email protected]>
In e7b8efb41 I disabled keepalives in several HTTP clients, which
inadvertently also disabled HTTP/2. However, the TLS setup announced h2
as a supported protocol, which caused confusion. This fixes that, and
makes sure to use the same client in all relevant places.
The old option to do usage reporting posts with InsecureSkipVerify goes
away -- nobody should have ever used it.
---------
Signed-off-by: Jakob Borg <[email protected]>
### Purpose
Improve the contrast of semantic request-dialog headers and buttons in
the light, dark, and black GUI themes.
The light theme keeps its bright semantic colors and uses black text for
success, warning, and danger alerts plus success/warning buttons. Danger
buttons use the existing darker red with white text. The dark themes use
darker success, warning, and danger backgrounds with white text.
The lowest enabled-state contrast ratio is 4.509:1, meeting WCAG AA for
normal text.
### Testing
- `go run build.go assets`
- `go run build.go build syncthing`
- `git diff --check`
- Checked the base and interactive semantic color pairs with a WCAG
contrast calculation; all enabled states are at least 4.5:1.
- Loaded the generated GUI assets in Chromium and verified the computed
foreground/background colors for success, warning, and danger alerts and
buttons in both light and dark themes.
### Screenshots
Rendered light and dark fixtures locally to verify the complete alert
and button combinations. The computed colors matched the intended theme
rules and no clipping or layout changes were introduced.
### Documentation
No documentation changes are required; this only corrects existing theme
colors.
Signed-off-by: Giridhar <[email protected]>
Co-authored-by: Giridhar <[email protected]>
### Purpose
#10726 introduces a problematic side effect which only surfaced recently
in #10882:
On Windows 24H2 stdout will be invalid when Syncthing is started
detached from a console. This caused the monitors logwriter to fail
silently before it writes it a log file.
This PR fixes this by letting the multiwriter continue even after
failing on stdout.
### Testing
#10882 can be reproduced without this PRs commit. With this PR logging
does work again.
Following scenarios are tested in which the logfile will be written
again
-console: syncthing.exe
-console: start "" syncthing.exe
-console: start "" syncthing.exe serve --log-file=path
-explorer: double click
`go test ./lib/osutil ` checks if the introduced tolerantMultiWriter
writes to all targets even on errors.
---------
Signed-off-by: Elias <[email protected]>
Co-authored-by: Elias <[email protected]>
Where we don't expect connection reuse for further requests this reduces
the number of open connection server-side.
Signed-off-by: Jakob Borg <[email protected]>
fix(gui): add accessible labels to buttons in Edit Device modal (fixes
#10873)
Currently, the buttons show text on mouse hover or keyboard focus, but
they are inaccessible to screen readers due to a lack of any readable
labels.
However, there is not enough space to add full-length textual labels
that would be visible to everyone. Therefore, add only aria labels for
screen readers, while keyboard and mouse users can still learn their
function via the tooltips.
Signed-off-by: Tomasz Wilczyński <[email protected]>
Signed-off-by: Tomasz Wilczyński <[email protected]>
As documented and intended, introducers should be able to vouch for
folders shared with them, but not other folders.
Signed-off-by: Jakob Borg <[email protected]>
It's only polite, and it enables better troubleshooting in situations
like weird-ass requests to the upgrades download service.
---------
Signed-off-by: Jakob Borg <[email protected]>