Commit Graph

1727 Commits

Author SHA1 Message Date
Klaas van Schelven
2fe2b4fb9d Use debug-tools for email in development
See #86
2025-11-12 16:27:14 +01:00
Klaas van Schelven
a93f369ad7 Fix member counts on project/team list
they were at most 1
2025-11-12 16:10:10 +01:00
Klaas van Schelven
2ad2c819f9 bandit (trivial ignore) 2025-11-11 15:57:17 +01:00
Klaas van Schelven
7b079dd57b Add template-based comment 2025-11-11 15:54:39 +01:00
Klaas van Schelven
9462d0a2c7 merge 'main' with 'main' 2025-11-11 15:34:54 +01:00
Klaas van Schelven
d5db5e328b Merge branch brotli-bombs-tests 2025-11-11 10:01:23 +01:00
Klaas van Schelven
444e84edc0 Merge pull request #267 from bugsink/python-3.14
Support Python 3.14
2025-11-10 20:32:40 +01:00
Klaas van Schelven
0432451e8e Fix inefficient bytes concatenation when KEEP_ENVELOPES != 0 2025-11-09 21:11:35 +01:00
Klaas van Schelven
a6ead89ca8 Remove event.debug_info
basically unused
2025-11-09 20:58:39 +01:00
Klaas van Schelven
53bea102d9 Compression decoding errors: return 400 rather than 500 2025-11-09 20:50:06 +01:00
Klaas van Schelven
b81f754b8c Support Python 3.14
make it so by [a] saying it is so and [b] testing it in the CI/CD
2025-11-09 20:12:55 +01:00
Klaas van Schelven
473d4de6d2 2.0.6 CHANGELOG 2.0.6 2025-11-08 23:37:11 +01:00
Klaas van Schelven
d979b17596 Merge commit from fork
Add mitigation for a 2nd class of brotli DOS attack
2025-11-08 23:36:29 +01:00
Klaas van Schelven
69a918de7d Additional test scripts for gzip/deflate bombs 2025-11-08 23:08:59 +01:00
Klaas van Schelven
60be8fa4a4 Add end-to-end test for brotli/envelope
proving that 2.0.5 solves the problem of (well-formatted) bombs
2025-11-08 23:08:49 +01:00
Klaas van Schelven
d5858a7a41 'random' (malformed) 'bomb' and test
These tests were originally in what is now 1201f754e3
but they were held back because they provide more information
to an attacker than strictly required.

The orignal (non-published, now published) commit message (which
goes with both the code and the tests) was:

As noted by @Cycloctane:

> The problem is that the infinte loop I was talking about is happening inside
> `brotli_generator`. Because brotli `decompressor.is_finished()` never returns
> True if the input is not valid brotli compressed data or is truncated. And
> `decompressor.process()` will keep returning empty bytes that won't be *yield*
> out, making the generator keep looping inside itself. `MaxDataReader` is not
> possible to limit it.
2025-11-08 23:06:32 +01:00
Klaas van Schelven
4c07000818 Add 'send_random_data' 'bomb'
credit @Cycloctane (who provided this as a curl command)
2025-11-08 23:04:19 +01:00
Klaas van Schelven
9db2498e27 send_bomb command to test brotli decompression vulnerability 2025-11-08 23:04:15 +01:00
Klaas van Schelven
c63e23f096 Clarify why I believe the curren solution will not be stuck forever 2025-11-08 22:59:49 +01:00
Klaas van Schelven
1201f754e3 brotli decompress: avoid non-termination
Analys by @Cycloctane -- thanks!
2025-11-08 22:57:02 +01:00
Klaas van Schelven
1aa8e95892 Assign local variable for easier debugging 2025-11-08 20:37:51 +01:00
Klaas van Schelven
6a37cefc09 2.0.5 CHANGELOG 2.0.5 2025-11-08 11:49:04 +01:00
Klaas van Schelven
3f65544aab Merge pull request #266 from bugsink/brotli-bombs-and-1.2
Fixes for brotli bombs (associated with brotli-1.2 upgrade); GeneratorReader fix
2025-11-08 11:45:08 +01:00
Klaas van Schelven
b44e5cd28f Comments/docstrings 2025-11-08 11:37:40 +01:00
Klaas van Schelven
26f327a257 GeneratorReader: don't copy so much
this was exposed when dealing with things that yield in very big chunks
potentially (e.g. brotli bombs)

tests are more directly on the GeneratorReader itself now rather than
integrating this with particular genators-under-test.
2025-11-08 11:37:40 +01:00
Klaas van Schelven
aab062a11e Brotli streaming decompression: use output_buffer_limit
This became possible with brotli 1.2.0

It is my understanding pre-this change there was basically no
enforced limit on the amount of bytes "coming out" of
decompressor.process(); in other words: chunk size did not
apply to the most relevant (potentially blowing up) part of
the equation.

We had a MaxDataReader in place, but that would come "too late"
since all the mem-consuming stuff would happen right in brotli_generator
before any limiting would be possible.

See https://github.com/google/brotli/issues/1381
2025-11-08 11:37:40 +01:00
Klaas van Schelven
2e882dc7c0 Merge pull request #264 from bugsink/half-of-244
migrate snappea database on server-start for Docker to avoid lack of permissions on already-created files

As discussed on #244
2025-11-07 20:40:02 +01:00
Erwin Oegema
3acd93856d Always migrate snappea database
(cherry picked from commit 3c51122746)

See #244
2025-11-07 20:34:32 +01:00
Klaas van Schelven
591b97042c docker-compose-sample.yaml: more clearly email:password
See #261
2025-11-07 19:59:23 +01:00
Klaas van Schelven
1ea365e146 Typo in LICENSE 2025-11-04 09:31:58 +01:00
Klaas van Schelven
c38aace3ae Add debug setting for email-sending
Fix #86
2025-11-03 21:35:09 +01:00
Klaas van Schelven
0bbb00c6ad smtp.EmailBackend in the docker conf: be explicit about it 2025-11-03 21:04:28 +01:00
Klaas van Schelven
20e065c6e8 Comment about FileNotError 2025-10-27 21:53:31 +01:00
Klaas van Schelven
8ad7f97380 parse_timestamp: _actually_ parse as UTC when timezone not provided
See https://github.com/Sija/raven.cr/issues/100 for the thing that triggered this

Caused by spotting this in the (shared on discord) logs of one of our users:

```
RuntimeWarning: DateTimeField Event.timestamp received a naive datetime (2025-10-26 16:01:08) while time zone support is active.
```
2025-10-26 22:56:11 +01:00
Klaas van Schelven
2b5d2f90ba Comment default fail_silently=False behavior 2025-10-26 22:50:44 +01:00
Klaas van Schelven
32be257172 Fail to start when using non-sqlite for snappea
See #252

This is not backwards compatible (it will now hard-break), but given snappea's
rather particular design decisions this is probably for the best, and given
what else was just discovered on #252 I strongly doubt anyone was actually using
it in such setups anyway.
2025-10-23 22:11:57 +02:00
Klaas van Schelven
314154a6b7 Add more warnings about using non-sqlite for snappea in the conf templates
See #252
2025-10-23 21:58:49 +02:00
Klaas van Schelven
e55c0eb417 'poor mans's DB lock: lock the right DB
See #252 where the following error was triggered:

> django.db.transaction.TransactionManagementError: select_for_update cannot be
> used outside of a transaction.

I believe that this is caused by using a non-sqlite database for the snappea DB.
"You probably shouldn't" but at least our own behavior should be consistent.

I haven't been able to reproduce this particular error BTW, but at least I've
reproduced _some_ error conditions that this commit fixes.
2025-10-23 21:54:59 +02:00
Klaas van Schelven
dcaa1d5e72 Fix redirect on single-click actions when hosting at subdomain
`path_info` (pre-commit siutation) is precisely w/o script_name, but you
want to just redirect to where you are, which is `path`.

Fix #250, See #93
See:

https://docs.djangoproject.com/en/5.2/ref/request-response/#django.http.HttpRequest.path_info
https://docs.djangoproject.com/en/5.2/ref/request-response/#django.http.HttpRequest.path
2025-10-22 09:52:16 +02:00
Klaas van Schelven
d8fef759ca Add database vendor, version and machine arch to phonehome message
See #226, in the context of which having some idea of the number of
installations on 2.x w/ mariadb would have been very useful
2025-10-10 09:41:57 +02:00
Klaas van Schelven
9cb89ecf46 Markdown stacktrace: render with all frames
not just in-app ones;

basic principle: more info means the LLM (or whatever) has more to go by
2025-10-10 09:19:11 +02:00
Klaas van Schelven
e6e0118583 2.0.4 release notes 2.0.4 2025-10-09 22:53:32 +02:00
Klaas van Schelven
1b5cf8dea4 Add convert_mariadb_uuids command
Bugsink 2.0 upgraded to Django 5.2 (from 4.2) under the hood. However, Django
5.0 made it so that on MariaDB >= 10.7, UUIDFields are stored as native UUID
fields, and special conversion steps are required.

The Django 5.0 release notes suggest basically downgrading your existing UUIDs
to CharField values and sticking with that forever, but that's not a workable
solution for us for many reasons:

* Bugsink is multi-DB-backend, and this change would affect them all. I don't
  want to force postgres-users to downgrade just for this.

* Bugsink 2.0 is already out in the wild, and people who've deployed it on
  MariaDB >= 10.7 would already "be in the correct future" (have UUID columns).
  i.e. the "solution" would just create the inverse problem.

* What with new models with new UUID fields? We'd run the rist of a "mix" with
  all the future complexity that comes with _that_.

So I've decided to just bite the bullet and force an upgrade. The provided
command allows users to upgrade their data. Just run:

```
bugsink-manage convert_mariadb_uuids
```

I have not (yet) provided this as a migration (it's always an option for the
future)... mostly for lack of time but also because we "need this as a command
anyway"... because people that would be on MariaDB < 10.7 still need this
tool whenever they migrate to >= 10.7.

Fix #226
2025-10-09 22:47:00 +02:00
Klaas van Schelven
43b1d63030 2.0.3 CHANGELOG 2.0.3 2025-10-05 14:47:54 +02:00
Klaas van Schelven
f8be55da89 Simplify login template
See #236 (for context, not for something that's solved by this):

> I did just notice that whatever the form validation error on-login is, the
> above message is shown. I will fix that at least to make debugging the above
> easier in the future. (i.e.: to make it so that if the form data is missing
> entirely, you'd get a "this field is required" for both fields)

This also gets rid of the lock/person but I don't care enough for those
to keep them around.
2025-10-01 17:13:39 +02:00
Klaas van Schelven
a20e10ef09 Hide development server warning: development only 2025-09-27 13:35:31 +02:00
Klaas van Schelven
d0e7b75dbb Better hints for malformed Token headers 2025-09-26 15:15:31 +02:00
Klaas van Schelven
afd31d2263 API: datetime objects always in UTC
i.e. avoid the pain of time-conversions when 'talking with computers'.
2025-09-26 15:01:55 +02:00
Klaas van Schelven
0ca3e33e1f API: remove 'is_deleted' as a field
it's implicit(ly not so): soft-deleted items should
not be returned, and everything that's returned isn't
deleted
2025-09-26 13:53:51 +02:00
Klaas van Schelven
16eccea851 Fix null constraint failure when remote_addr is None and user is '{{auto}}'
Fix #229
2025-09-23 10:14:28 +02:00