Commit graph

316 commits

Author SHA1 Message Date
Lambda
d425ba72f8
Update ruma to 0.12.2 2025-05-04 14:03:46 -07:00
Olivia Lee
6cb7896e17
use trust-dns for all DNS queries
Previously we were only using trust-dns for resolving SRV records in
server discovery, and then for resolving the hostname from the SRV
record target if one exists. With the previous behavior, admins need to
ensure that both their system resolver and trust-dns are working
correctly in order for outgoing traffic to work reliably. This can be
confusing to debug, because it's not obvious to the admin if or when
each resolver are being used. Now, everything goes through trust-dns and
outgoing federation DNS should fail/succeed more predictably.

I also expect some performance improvement from having an in-process DNS
cache, but haven't taken measurements yet.
2025-04-14 15:56:33 -07:00
Olivia Lee
abb1b5681e
add partial_canonicalize helper function
This is useful for checking for potential overlap between paths that
have not been fully created yet.
2025-04-14 15:28:31 -07:00
Charles Hall
bb80f1cf2e
update rust deps that don't require code changes
I also had to pin ruma because otherwise cargo complained that features
were removed from ruma so it couldn't resolve the dependency by itself.
2025-03-27 16:31:45 -07:00
Charles Hall
8b7cbb5f25
update rocksdb
This is done separately since it requires more involved changes than
just cargo's files.
2025-03-27 16:30:52 -07:00
Charles Hall
8da6c5d4b3
bump lockfile format version
This was actually introduced in version 1.83 of the rust toolchain.
2025-03-27 16:30:48 -07:00
Charles Hall
2f8e0e3e52
update rust dependencies
Ruma dropped a couple dependencies and includes a stateres performance
improvement. May as well pull in everything else (except OTel) while
we're at it.
2024-11-29 10:39:53 -08:00
Charles Hall
af15f0c596
update rust dependencies
Except OTel stuff, as usual.

The main point is to bump `ruma-state-res` for a state resolution fix.
2024-11-18 11:07:23 -08:00
Charles Hall
c9c30fba30
upgrade to latest ruma 2024-11-08 17:26:44 -08:00
Charles Hall
2dbb101140
upgrade to latest rust-rocksdb
We gotta overrideAttrs to set the src and version to a newer version
than nixpkgs has now.
2024-11-08 17:26:38 -08:00
Charles Hall
d565b22da9
run cargo upgrade && cargo update
There are a few available incompatible updates not covered here:

* RocksDB
* Ruma
* OTel stuff
2024-11-07 11:36:13 -08:00
Charles Hall
e74c8687f5
drop dependency on once-cell 2024-11-07 11:36:13 -08:00
Charles Hall
f07c8c2b6f
update flake.lock
And some supporting changes:

* crane: It removed its dependency on nixpkgs and made overrideToolchain
  take a function for splicing reasons, but we're doing splicing
  ourselves so we can just ignore the function argument. These changes
  are in `flake.nix`.
* [NixOS/nixpkgs#347228][0]: linkerFor* were removed because the linker
  no longer needs to be different in some edge cases. Based on the
  diff of the PR that introduced this change, ccFor* are the proper
  replacements. These changes are in `cross-compilation-env.nix` in the
  compiler-and-linker-choosing section.
* [NixOS/nixpkgs#350299][1]: buildPlatform isn't at the top level
  anymore, we have to go through stdenv now. These changes are in
  `nix/shell.nix`.
* rocksdb: nixpkgs has 9.6.1 now so we need to upgrade our rust
  library to use the matching version. These changes are in
  `Cargo.toml`, `Cargo.lock`, `nix/pkgs/default/default.nix`, and
  `cross-compilation-env.nix` in the linker flags section.

[0]: https://github.com/NixOS/nixpkgs/pull/347228
[1]: https://github.com/NixOS/nixpkgs/pull/350299

Flake lock file updates:

• Updated input 'attic':
    'github:zhaofengli/attic/4dbdbee45728d8ce5788db6461aaaa89d98081f0' (2024-03-29)
  → 'github:zhaofengli/attic/48c8b395bfbc6b76c7eae74df6c74351255a095c' (2024-10-30)
• Updated input 'attic/crane':
    'github:ipetkov/crane/7195c00c272fdd92fc74e7d5a0a2844b9fadb2fb' (2023-12-18)
  → 'github:ipetkov/crane/4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4' (2024-08-06)
• Updated input 'attic/flake-compat':
    'github:edolstra/flake-compat/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9' (2023-01-17)
  → 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33' (2023-10-04)
• Added input 'attic/flake-parts':
    'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d' (2024-08-01)
• Added input 'attic/flake-parts/nixpkgs-lib':
    follows 'attic/nixpkgs'
• Removed input 'attic/flake-utils'
• Updated input 'attic/nixpkgs':
    'github:NixOS/nixpkgs/07262b18b97000d16a4bdb003418bd2fb067a932' (2024-03-25)
  → 'github:NixOS/nixpkgs/159be5db480d1df880a0135ca0bfed84c2f88353' (2024-09-11)
• Updated input 'attic/nixpkgs-stable':
    'github:NixOS/nixpkgs/44733514b72e732bd49f5511bd0203dea9b9a434' (2024-03-26)
  → 'github:NixOS/nixpkgs/797f7dc49e0bc7fab4b57c021cdf68f595e47841' (2024-08-22)
• Added input 'attic/nix-github-actions':
    'github:nix-community/nix-github-actions/e04df33f62cdcf93d73e9a04142464753a16db67' (2024-10-24)
• Added input 'attic/nix-github-actions/nixpkgs':
    follows 'attic/nixpkgs'
• Updated input 'crane':
    'github:ipetkov/crane/109987da061a1bf452f435f1653c47511587d919' (2024-05-24)
  → 'github:ipetkov/crane/498d9f122c413ee1154e8131ace5a35a80d8fa76' (2024-10-27)
• Removed input 'crane/nixpkgs'
• Updated input 'fenix':
    'github:nix-community/fenix/b6fc5035b28e36a98370d0eac44f4ef3fd323df6' (2024-05-22)
  → 'github:nix-community/fenix/87b4d20f896c99018dde4702a9c6157b516f2a76' (2024-11-01)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/21ec8f523812b88418b2bfc64240c62b3dd967bd' (2024-05-19)
  → 'github:rust-lang/rust-analyzer/0ba893e1a00d92557ac91efb771d72eee36ca687' (2024-10-31)
• Updated input 'flake-utils':
    'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11)
  → 'github:numtide/flake-utils/c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a' (2024-09-17)
• Updated input 'nix-filter':
    'github:numtide/nix-filter/3342559a24e85fc164b295c3444e8a139924675b' (2024-03-11)
  → 'github:numtide/nix-filter/776e68c1d014c3adde193a18db9d738458cd2ba4' (2024-10-29)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5710852ba686cc1fd0d3b8e22b3117d43ba374c2' (2024-05-21)
  → 'github:NixOS/nixpkgs/807e9154dcb16384b1b765ebe9cd2bba2ac287fd' (2024-10-29)
2024-11-07 11:35:48 -08:00
Andreas Fuchs
26ba489aa3 Add a "check-config" command to validate config files & tests for it 2024-11-01 12:08:17 -04:00
Lambda
70ee206031 Extract source address for requests 2024-10-25 20:48:38 +00:00
Lambda
3247c64cd8 Add support for HAProxy proxy protocol for listeners 2024-10-25 20:48:38 +00:00
Benjamin Lee
e2318cad8a
fix serving tls by setting rustls default crypto provider
The rustls version bump in c24f79b79b
introduced a panic when serving listeners with 'tls = true':

> thread 'main' panicked at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/rustls-0.23.13/src/crypto/mod.rs:265:14:
> no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point

This commit fixes this by setting the default provider to ring. I chose
ring (the old rustls default) over aws-lc-rs (the new default) for a few
reasons:

 - Judging by github issues, aws-lc-rs seems to have a lot of build problems.
   We don't need more of that.
 - The "motivation" section in the aws-lc-rs docs only talks about FIPS,
   which we do not care about.
 - My past experience with things that start with "aws-" has been very
   negative.
2024-09-23 23:39:23 -07:00
Charles Hall
b0d1cc1b63
bump otel to v0.24.0
Someone contributed opentelemetry-prometheus support for v0.24 and this
version also doesn't put stupid requirements on the tokio version. This
version of the OTel ecosystem also fixes an apparent bug with some hacks
I plan on doing in the future...
2024-09-23 14:22:55 -07:00
Charles Hall
c24f79b79b
update rust deps except rocksdb and otel clownery
* OTel v0.25.0 requires downgrading Tokio to 1.38 [0]
* They have a fix for this but aren't cutting a release just for release
  schedule reasons [1]
* Prometheus support (at least for server-pull) was dropped at OTel
  v0.23 and isn't planned to be picked up again until OTel v1 [2]
* No real reasoning was provided for this decision AFAICT [3] [4]
* So many compiler errors
* Unhelpful changelogs

The last two points are what made me give up on trying to upgrade to
OTel v0.24 too.

RocksDB isn't updated because we'd need to update our nixpkgs too but
that causes other problems, such as an upstream bug in liburing when
building for musl.

[0]: https://github.com/open-telemetry/opentelemetry-rust/issues/2094
[1]: https://github.com/open-telemetry/opentelemetry-rust/issues/2094#issuecomment-2346834030
[2]: https://docs.rs/opentelemetry-prometheus/0.17.0/opentelemetry_prometheus/index.html
[3]: https://github.com/open-telemetry/opentelemetry-rust/pull/1792
[4]: https://github.com/open-telemetry/opentelemetry-rust/pull/1792#issuecomment-2121514344
2024-09-23 14:22:55 -07:00
Lambda
5a5bea3217 cargo update ruma httparse
This adds authenticated media APIs.
2024-09-01 09:42:45 +00:00
Benjamin Lee
a909e2079b
config options for log format and color usage
We want to be able to disable colors for complement logs (since they
are likely to be opened in a text editor). There's no pressing need for
alternative log formats, but I'm interested in whether the 'pretty'
format will be easier for debugging.

I chose to add 'log_*' options rather than making a separate 'log'
section for now. There's been some discussion about trying to separate
the tracing/logging stuff into more structured sections, but that can
happen later.
2024-06-13 21:21:14 -07:00
Charles Hall
70fa17dde0
enable clap's wrap_help feature
This makes the output easier to read.
2024-06-12 19:57:00 -07:00
Charles Hall
85e77832e9
follow xdg base dirs spec by default 2024-06-12 19:57:00 -07:00
Charles Hall
2b0bc140cf
drop figment
Just deserialize directly via the `toml` crate.
2024-06-12 19:56:59 -07:00
Charles Hall
9364d44ce2
use strum instead 2024-06-05 17:41:39 -07:00
Charles Hall
aa4cd8b1e1
switch to RustCrypto's argon2 crate 2024-06-04 19:35:21 -07:00
Charles Hall
a0b92c82e8
set up opentelemetry for metrics
Also adds an `allow_prometheus` option (disabled by default) to expose
a `/metrics` endpoint that returns Prometheus data.
2024-06-03 18:18:44 -07:00
Lambda
62dd097f49 Use Ruma XMatrix type instead of rolling our own
Both the hand-rolled parser and serialization were wrong in countless
ways. The current Ruma parser is much better, and the Ruma serialization
will be fixed by https://github.com/ruma/ruma/pull/1830.
2024-06-03 20:50:49 +00:00
Charles Hall
aec314ce85
get tracing-opentelemetry from crates.io
They made a release with the changes we needed; we can stop pulling it
from git now.
2024-06-02 17:27:54 -07:00
Charles Hall
a275543494
enable axum's tracing feature
This pretty much only makes it log a single error event, but it's one
that's useful to know about.
2024-05-26 19:47:00 -07:00
Charles Hall
8f0fdfb2f2
upgrade all cargo dependencies
Unfortunately we need to pull tracing-opentelemetry from git because
there hasn't been a release including the dependency bump on the other
opentelemetry crates.
2024-05-26 19:47:00 -07:00
Charles Hall
b5321d81c0
update flake.lock
Nixpkgs and `rust-rocksdb` line up so we can drop our RocksDB input for
the time being.

Flake lock file updates:

• Updated input 'attic':
    'github:zhaofengli/attic/6eabc3f02fae3683bffab483e614bebfcd476b21' (2024-02-14)
  → 'github:zhaofengli/attic/4dbdbee45728d8ce5788db6461aaaa89d98081f0' (2024-03-29)
• Updated input 'attic/nixpkgs':
    'github:NixOS/nixpkgs/aa9d4729cbc99dabacb50e3994dcefb3ea0f7447' (2023-12-14)
  → 'github:NixOS/nixpkgs/07262b18b97000d16a4bdb003418bd2fb067a932' (2024-03-25)
• Updated input 'attic/nixpkgs-stable':
    'github:NixOS/nixpkgs/1e2e384c5b7c50dbf8e9c441a9e58d85f408b01f' (2023-12-17)
  → 'github:NixOS/nixpkgs/44733514b72e732bd49f5511bd0203dea9b9a434' (2024-03-26)
• Updated input 'crane':
    'github:ipetkov/crane/55f4939ac59ff8f89c6a4029730a2d49ea09105f' (2024-04-21)
  → 'github:ipetkov/crane/109987da061a1bf452f435f1653c47511587d919' (2024-05-24)
• Updated input 'fenix':
    'github:nix-community/fenix/c8943ea9e98d41325ff57d4ec14736d330b321b2' (2024-03-05)
  → 'github:nix-community/fenix/b6fc5035b28e36a98370d0eac44f4ef3fd323df6' (2024-05-22)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/9f14343f9ee24f53f17492c5f9b653427e2ad15e' (2024-03-04)
  → 'github:rust-lang/rust-analyzer/21ec8f523812b88418b2bfc64240c62b3dd967bd' (2024-05-19)
• Updated input 'flake-utils':
    'github:numtide/flake-utils/d465f4819400de7c8d874d50b982301f28a84605' (2024-02-28)
  → 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11)
• Updated input 'nix-filter':
    'github:numtide/nix-filter/3449dc925982ad46246cfc36469baf66e1b64f17' (2024-01-15)
  → 'github:numtide/nix-filter/3342559a24e85fc164b295c3444e8a139924675b' (2024-03-11)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/b8697e57f10292a6165a20f03d2f42920dfaf973' (2024-03-03)
  → 'github:NixOS/nixpkgs/5710852ba686cc1fd0d3b8e22b3117d43ba374c2' (2024-05-21)
• Removed input 'rocksdb'
2024-05-24 20:08:54 -07:00
Charles Hall
a60501189d
prevent xss via user-uploaded media
Previously, `Content-Disposition` was always set to `inline`, even for
HTML, which means that XSS could be easily acheived by uploading
malicious HTML and getting someone to click on the Matrix HTTP API link
for that piece of media. Now, we have an allowlist of safe values for
`Content-Type` that use `inline` while everything else defaults to
`attachment`, including HTML and SVG, which prevents XSS.

We also set the `Content-Security-Policy` header because why not.

A `set_header_or_panic` function is introduced to do what it says in
case Ruma begins providing better or worse values for the relevant
headers in the future. The safest way to handle such a case is simply
to panic.
2024-05-19 21:05:02 -07:00
Charles Hall
e7b8f78867
update rocksdb
Flake lock file updates:

• Updated input 'rocksdb':
    'github:facebook/rocksdb/bcf88d48ce8aa8b536aee4dd305533b3b83cf435' (2024-04-16)
  → 'github:facebook/rocksdb/6f7cabeac80a3a6150be2c8a8369fcecb107bf43' (2024-04-22)
2024-05-16 21:50:31 -07:00
Charles Hall
844b32f097
enable string_slice lint
Also swaps out vendored HTML-escaping code for a dependency that I
imagine has decent testing considering all of its reverse depedencies.
2024-05-12 19:08:12 -07:00
Charles Hall
360e020b64
rename conduit to grapevine 2024-04-30 21:54:56 -07:00
Charles Hall
c496878afa
remove unused dependencies 2024-04-30 21:54:55 -07:00
Charles Hall
c765a1634d
remove unused database backends 2024-04-30 21:54:39 -07:00
Charles Hall
aa51acf152
remove dead code 2024-04-30 00:08:26 -07:00
Timo Kösters
a854a46c24
Bump version to v0.7.0 2024-04-24 23:24:20 +02:00
Charles Hall
61cb186b5b
update rocksdb 2024-04-21 12:39:27 -07:00
Matthias Ahouansou
1c529529aa
chore: upgrade nix to 0.28
needed for musl targets on s390x
2024-04-01 13:36:38 +01:00
Matthias Ahouansou
5c634ceb6b
fix: reject requests with authentication when not used 2024-03-30 16:50:21 +00:00
Timo Kösters
879a8b969d
improvement: use simpler rocksdb config 2024-03-21 15:04:40 +01:00
Charles Hall
10f3f9da49
switch/update rocksdb crate
This fork was created because the original seems de-facto unmaintained.
2024-03-10 20:58:01 -07:00
Matthias Ahouansou
21a5fa3ef0 refactor: use re-exported JsOption from ruma rather than directly adding it as a dependency 2024-02-25 10:30:30 +00:00
Matthias Ahouansou
b27e9ea95c chore: bump ruma to latest commit (as of 2024-02-25) 2024-02-25 08:49:20 +00:00
Matthias Ahouansou
8aa915acb9 bump ruma, support deprecated user login field 2024-02-23 20:29:17 +00:00
Matthias Ahouansou
d841b81c56 chore: update Cargo.lock 2024-02-16 20:52:19 +00:00
Charles Hall
7fb9e99649
update ring and jsonwebtoken to remove ring ^0.16 2024-01-29 16:21:42 -08:00