~bigbes/core-go

862728a4 — Drew DeVault 9 months ago
server: add error presenter to make context cancellation semantic
09368917 — Drew DeVault 9 months ago
auth: ensure semantic errors are bubbled up to user properly
038a9eb0 — Drew DeVault 10 months ago
auth: add error code on unauthorized request response
ccd2a4b8 — Drew DeVault 10 months ago
auth: handle edge case when fetching users from meta
33acd1b0 — Drew DeVault 10 months ago
feature: add submodule + middleware for feature flags
565df04e — Drew DeVault 10 months ago
model: introduce ID type

Based on UUIDv7 but represented to users in a more compact base32 form,
though all of that are internal implementation details.
898f2e95 — Drew DeVault 10 months ago
database: add WithReadOnlyTx
398f1a70 — Conrad Hoffmann 10 months ago
Refactor config loading and server initialization

As is, LoadConfig() does some things that are not strictly related to
the configuration, such as parsing command line arguments. This has led
to a proliferation of different ways to load the config based on various
needs and also prevents tools that need a config but are not services to
use custom command line arguments.

This commit aims to decouple config loading from everything else and
do nothing but loading the config files.

On a high level, this commit:
- renames server.NewServer() to server.New()
- moves config.Debug and config.Addr into the server package
- moves crypto.InitCrypto() call into server.New()
- moves command line parsing into server.New(), using passed-in values
  rather than os.Args

The only changes required for services would be changing

   cfg := config.LoadConfig(":5100")
   server := server.NewServer("meta.sr.ht", cfg)

to

   cfg := config.LoadConfig()
   server := server.New("meta.sr.ht", ":5100", cfg, os.Args)

All other tools will be switched to just LoadConfig() and, optionally, a
call to crypto.InitCrypto(). I managed to completely remove some global
state (addr) and at least make the rest private, so that users are
forced to use the designated functions.

The config module gained support for custom FS implementation, mainly
for testing.
3e875f28 — Conrad Hoffmann 10 months ago
objects: bring back support for plain HTTP

This got lost during the transition from minio to S3 client.
87bd2cb1 — Drew DeVault 10 months ago
client: improve user agent
304e09bb — Drew DeVault 10 months ago
config: don't log config path

This is kind of useful but it's also pretty noisy in a lot of places.
80be9ad7 — Conrad Hoffmann 11 months ago
server: enable GraphQL introspection
cc170f8f — Drew DeVault 11 months ago
Don't prevent suspended users from authenticating

With cookies or internal auth. The frontends already prevent users from
accessing services while suspended, and there are some complications if
we don't let the frontends access the backends at all if the
authenticated user is suspended.
44cf5e79 — Drew DeVault 11 months ago
auth: remove legacy OAuth support
3e1d5d3a — Drew DeVault 11 months ago
config: add GetAPI
62578ea9 — Drew DeVault 1 year, 12 days ago
auth/bearer: log username associated with expired token
3686f7e2 — Drew DeVault 1 year, 17 days ago
objects: improve support for our s3 deployment

Not sure how well this generalizes but we can improve it when someone
complains.
42a4b67b — Drew DeVault 1 year, 18 days ago
Switch from minio to AWS SDK S3 client

Moves s3 => objects to avoid conflicting with the AWS module.
e5f2298c — Drew DeVault 1 year, 18 days ago
server: log GraphQL queries if running in debug mode
1c4d7007 — Conrad Hoffmann 1 year, 21 days ago
auth: fix remote IP determination for audit log

This is probably isolated to dev or other small environments, but I had
two issues with the remote IP determination, breaking the audit log
display in my dev env after fairly standard usage.

The gist is that the audit log is designed to contain clean IP addresses
only. However, the algorithm starts out with `r.RemoteAddr`, which may
contain a port (usually 127.0.0.1:xxxxx). The port removal is already
performed at the beginning of the function, so simply re-use the result
of this.

Furthermore, the initial value (containing the port leading to breakage)
landed in the audit log because I was using a private IP (it's my dev
evn). We correctly trust private IPs, but that means if no public IP
ever shows up in the X-Forwarded-For header, the last private IP was the
one that actually made the request.

I am not entirely sure why this showed up now. I already had a bunch of
oder audit log entries that had the correct private-but-not-localhost
addresses. But in the current state, e.g. simply updating my profile
would cause the bad IP:port notation to be written to the audit log.
Next