Commit Graph
62 Commits
Author SHA1 Message Date
raucao 4bca003983 Hash remoteStorage access tokens at rest
CI / Test (pull_request) Successful in 45s
Release Drafter / Update release notes draft (pull_request) Successful in 4s
Store only SHA256(token) in a new token_digest column and use the digest for the Redis authorization keys instead of the plaintext token. The plaintext is now held in memory only for issuance.

This is the expand step: the plaintext token column stays in place so the old code can keep running during the deploy. A follow-up migration will drop it once rs:rekey_tokens has re-keyed Redis and confirmed no plaintext keys remain.

Refs #259
2026-11-04 09:33:57 +04:00
raucao 3dcd263d43 Store the remoteStorage user agent as text, not varchar(255)
CI / Test (pull_request) Successful in 41s
Real-world user agents (in-app browsers, Android WebView variants) commonly
exceed 255 characters. On PostgreSQL that would raise and 500 the consent
POST and token exchange; SQLite dev/test does not enforce the limit, so it
went unnoticed. Use text columns for user_agent on both tables.

Part of #254
2026-11-03 11:59:52 +04:00
raucao 7c4bad860a Store per-device user agent for remoteStorage authorizations
- Add user_agent to remote_storage_authorizations and rs_authorization_codes
- Capture the browser's user agent at consent, carry it on the authorization
  code, and store it on the authorization when the code is exchanged
- Store it directly for the implicit flow too

With the reuse shortcut gone, each authorization is already a distinct
per-device token; this adds the metadata needed to label and display them.

Part of #254
2026-11-03 11:59:51 +04:00
raucao 295261b332 Address review findings in the PKCE flow
CI / Test (pull_request) Failing after 46s
- Make authorization-code redemption atomic: claim the code with a guarded
  delete inside the transaction that creates the authorization, so concurrent
  exchanges can't both issue a token (RFC 6749 4.1.3)
- Compare the token request's client_id host to the code's stored client_id
  (defense-in-depth alongside the exact redirect_uri match)
- Reject unknown response_type values with unsupported_response_type
- Validate the PKCE code_challenge (43-128 unreserved chars, S256) so a client
  can't persist an over-long or malformed challenge
- Return invalid_request for missing token-endpoint parameters, and set
  Cache-Control: no-store on error responses too
- Use the right separator when the redirect_uri already has a query string
- Look codes up through the active scope; drop the unused consume!; serialize
  permissions as JSON
- Purge abandoned authorization codes via a recurring Solid Queue task

Part of #254
2026-11-03 11:40:18 +04:00
raucao 8dd0bf10ce Add PKCE support to remoteStorage OAuth
Implements the optional OAuth 2.0 Authorization Code grant with PKCE
(RFC 7636) for remoteStorage, as described in the remoteStorage spec
(section 10.1).

- Advertise the authorization and token endpoints plus the supported
  code_challenge method (S256) in WebFinger, and bump the advertised
  spec version to draft-dejong-remotestorage-27
- Add RsAuthorizationCode: a short-lived (5 min), single-use authorization
  code stored only as a SHA256 digest
- Add RsOauthManager services for issuing and exchanging codes, including
  S256 verification
- Add a cross-origin POST /rs/oauth/token endpoint that exchanges a code
  (and code_verifier) for an access token, with CORS and no CSRF token
- Consent dialog now carries response_type / code_challenge through the
  form and redirects with the code in the query string for the code flow
- Remove the existing-token reuse shortcut so every authorization results
  in a distinct authorization (and token)

Part of #254
2026-11-03 09:17:43 +04:00
raucao 911d2a5855 Fix db seeds for Solid Queue
CI / Test (pull_request) Successful in 45s
Release Drafter / Update release notes draft (pull_request) Successful in 3s
db/seeds.rb still required "sidekiq/testing" and wrapped seeding in
Sidekiq::Testing.inline!, but Sidekiq is no longer in the bundle after
the Solid Queue migration, so `rails db:setup` failed with a LoadError.

Run the jobs triggered while seeding inline via Active Job instead,
restoring the previous behavior with the adapter the app actually uses.
2026-10-06 13:36:33 +00:00
raucao 5ebf496096 Upgrade Rails to 8.1
CI / Test (pull_request) Successful in 1m4s
Release Drafter / Update release notes draft (pull_request) Successful in 2s
2026-08-10 17:02:37 -06:00
raucao 6014134396 Finish MVP for content editing 2025-05-29 14:18:14 +04:00
raucao 5c8ffc2630 Add editable contents table 2025-05-28 18:39:25 +04:00
raucao 252b0f1792 Revert "Add ActionText configs, update spec helpers/configs"
This reverts commit c9d23f829d.
2025-05-28 16:53:31 +04:00
raucao c9d23f829d Add ActionText configs, update spec helpers/configs 2025-05-28 14:52:31 +04:00
raucao e48132cf5f Set member status to sustainer upon payment
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Introduces a state machine for the payment status as well.

refs #213
2025-05-27 16:39:03 +04:00
raucao c291765777 Add mastodon_id to users 2025-05-17 16:44:13 +04:00
raucao 84ed4b2de2 Remove old ln columns from users table
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-05-06 19:47:58 +04:00
raucao eae370b737 Migrate from lockbox to ActiveRecord encryption (1/2)
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-05-06 18:09:27 +04:00
raucao 0cad4cdcfe WIP Switch from Sidekiq to Solid Queue
continuous-integration/drone/push Build is running
continuous-integration/drone/pr Build is failing
2025-05-04 17:40:33 +04:00
raucao 1ddecab2c3 Upgrade Rails to 8.0
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-04-28 17:49:54 +04:00
raucao a2921297fe Fix seeds
The CreateAccount service has moved to a namespace
2025-04-11 16:14:44 +04:00
raucao 4a677178e8 Add Web Key Directory endpoint
Serve public keys in binary and armored text, if they contain a user's
account address.
2024-09-23 19:20:10 +02:00
raucao 90a8a70c15 Add OpenPGP key to LDAP directory and User model
continuous-integration/drone/push Build is passing
2024-09-23 15:20:00 +02:00
raucao 5a5c316c14 Fix time format in migration
continuous-integration/drone/push Build is passing
2024-06-09 13:29:39 +02:00
raucao 5588e3b3e8 Add settled_at to zaps, scope by settlement status
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 4s
2024-06-07 15:11:06 +02:00
raucao c6c5d80fb4 WIP Persist zaps, create and send zap receipts
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-09 14:31:37 +02:00
raucao 49d24990b4 Add zap model, user relation 2024-05-04 17:05:34 +02:00
raucao 51a3cb60ec Merge pull request 'Add custom LDAP attributes to schema' (#181) from feature/custom_ldap_attributes into master
continuous-integration/drone/push Build is passing
Reviewed-on: #181
Reviewed-by: greg <greg@noreply.kosmos.org>
2024-03-19 14:46:44 +00:00
raucao 5a3adba603 Move nostr pubkeys to LDAP attribute
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 4s
closes #173
2024-03-17 11:04:11 +01:00
raucao 2130369604 Update db schema
continuous-integration/drone/push Build is passing
2024-03-13 18:15:42 +01:00
raucao 8de0a2e26e Improve seed output 2024-03-13 14:28:31 +01:00
raucao 06521d1c34 LDAP: add delete_all_users method, use in seeds 2024-03-13 14:27:39 +01:00
raucao e3b96d5cff Merge branch 'master' into feature/donations_btcpay
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-03-03 12:50:16 +01:00
raucao e65b890880 Update db schema
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 3s
2024-03-02 17:31:44 +01:00
raucao 079ee8833c Implement bitcoin donations via BTCPay 2024-03-02 14:31:48 +01:00
raucao 56d91083e5 Fix seeds for new keyword argument
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 3s
2024-02-22 13:24:41 +01:00
raucao c9052b35f6 Database update for Flipper
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-02-08 12:29:11 +01:00
Râu Cao fcea11f0e5 Associate RS authorizations with web apps 2023-10-24 17:29:24 +02:00
Râu Cao e56c9bd0d5 Add web app model, service to fetch metadata 2023-10-24 17:29:23 +02:00
Râu Cao 86f85a90f4 Add/configure ActiveStorage 2023-09-06 12:14:28 +02:00
Râu Cao a91ee2bd0a Fix generated usernames in seeds potentially being too short
continuous-integration/drone/push Build is passing
2023-09-04 11:35:51 +02:00
Râu Cao 96c669ab4e Update database schema, fix spec
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 2s
2023-09-03 15:29:09 +02:00
Râu Cao 558100c35e Fix migration failing with PostgreSQL 2023-09-03 15:28:32 +02:00
galfert 716d4b944a Merge branch 'master' into feature/rs-oauth
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
# Conflicts:
#	app/models/user.rb
#	config/routes.rb
#	db/schema.rb
2023-06-20 14:07:46 +02:00
Râu Cao 49de4007ab Settings page for adding verified nostr pubkeys 2023-06-16 14:22:30 +02:00
Râu Cao bc4d9ff528 Add nostr_pubkey to users 2023-06-16 13:52:42 +02:00
Râu Cao 287adbd365 Add flipper gem and database migration/tables 2023-05-23 14:09:35 +02:00
Râu Cao eeabbdb7df Merge branch 'master' into feature/rs-oauth
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-04-13 15:02:51 +02:00
Râu Cao 23821f9e65 Add preferences to user model 2023-04-04 12:27:49 +02:00
galfert ee42d68471 Add RemoteStorageAuthorization model
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-03-28 01:21:28 +02:00
Râu Cao 8a7016a30b Add remember-me function for sign-in
When checked, remember user for 2 weeks. Otherwise expire session after
30 minutes.
2023-03-19 18:06:18 +07:00
Râu Cao dfb12b8f62 Fix typo
continuous-integration/drone/push Build is passing
2023-03-02 15:54:03 +08:00
Râu Cao 7cff849d79 Add more users when seeding db 2023-03-01 17:07:13 +08:00