Commit graph

854 commits

Author SHA1 Message Date
silverpill
84c93fecf1 Refactor receive_activity() function 2022-12-08 22:11:15 +00:00
silverpill
999dd7e608 Don't fetch actor when verifying JSON signature on Delete(Person) activity 2022-12-08 16:31:26 +00:00
silverpill
cd6968b15a Fetch actor before verifying JSON signature 2022-12-08 16:10:29 +00:00
silverpill
a71c4ccc89 Refactor ActivityPub authentication helpers 2022-12-08 16:09:10 +00:00
silverpill
06e172d9fa Never ignore invalid HTTP signatures 2022-12-08 00:47:18 +00:00
silverpill
d3db42ec9e Rename modules 2022-12-07 21:00:54 +00:00
silverpill
e0053f19c7 Add handler function for Create() activity 2022-12-07 19:46:49 +00:00
silverpill
c218d3ebce Don't match object type in receive_activity() 2022-12-06 23:59:33 +00:00
silverpill
67313dbac7 Create unified handler for Undo() activities 2022-12-06 23:53:30 +00:00
silverpill
648a217971 Create unified handler for Update() activities 2022-12-06 23:48:24 +00:00
silverpill
a3c3f97759 Rename modules 2022-12-06 23:29:59 +00:00
silverpill
d3819c67e6 Create dedicated types for all activities and remove create_activity() function 2022-12-06 21:07:26 +00:00
silverpill
e5c1be2f93 Transform incoming events into posts
Support for Event objects from Rebased.
2022-12-06 19:54:44 +00:00
silverpill
777dd74373 Use Follow type to create embedded activity when building Undo(Follow) 2022-12-05 23:03:37 +00:00
silverpill
7c3d669e9b Use plain object ID instead of embedded activity in Accept(Follow) 2022-12-05 22:59:31 +00:00
silverpill
51318046a8 Create dedicated types for building Follow(), Accept(Follow) and Undo(Follow) activities 2022-12-05 22:53:09 +00:00
silverpill
ff745cfe64 Add tests for build_undo_follow() and build_move_person() 2022-12-05 22:50:40 +00:00
silverpill
10cd778f40 Replace generic parameter in OutgoingActivity struct with Value type 2022-12-05 18:08:15 +00:00
silverpill
d1939b10d5 Move DatabaseError to database module 2022-12-03 22:57:09 +00:00
silverpill
4185cbefb0 Rename Pool type to DbPool 2022-12-03 21:30:24 +00:00
silverpill
11ed4c1e48 Remove unnecessary as_str() conversions 2022-12-03 21:11:28 +00:00
silverpill
56427a4535 Catch error if media request returns 4xx or 5xx 2022-12-03 11:19:08 +00:00
silverpill
28aea5b023 Always set User-Agent header when using fetcher 2022-12-03 11:19:01 +00:00
silverpill
4ec5cf0f9b Render instance description to HTML
https://codeberg.org/silverpill/mitra-web/issues/3
2022-12-01 22:04:46 +00:00
silverpill
581e72ce65 Read HTTP signature expiration date from (expires) pseudo-header 2022-11-29 17:33:59 +00:00
silverpill
7d204ab150 Remove unknown classes during HTML sanitization 2022-11-29 16:46:00 +00:00
silverpill
a3ec1e7b58 Verify that actor alias exists before moving local followers 2022-11-27 22:04:53 +00:00
silverpill
ff7c6724a0 Accept Move() activities where object is local actor 2022-11-27 19:54:07 +00:00
silverpill
df8c206cf0 Accept Move() activities coming from "target" actor 2022-11-27 19:53:57 +00:00
silverpill
73ef78f021 Search for aliases by DID when processing Move(Person) activity 2022-11-27 13:47:52 +00:00
silverpill
4a42bcd369 Add API methods for creating user-signed Move() activities 2022-11-27 13:05:21 +00:00
silverpill
73a7668d18 Allow to connect to monero-wallet-rpc when it runs without --wallet-dir option 2022-11-27 13:04:47 +00:00
silverpill
12861a98b7 Use actor ID as a hint when identifying activity signer 2022-11-27 11:15:13 +00:00
silverpill
8dfd8bf0d7 Add ImportError to AuthenticationError enum 2022-11-27 10:53:51 +00:00
silverpill
7511832fa0 Rename /signed_update API method to /send_activity 2022-11-26 21:13:37 +00:00
silverpill
a6032386da Use enum to represent activity parameters during the signing process 2022-11-26 20:46:46 +00:00
silverpill
fbcba1b99d Refactor send_signed_update view 2022-11-26 01:00:42 +00:00
silverpill
dd268634ef Move change_password API method to /api/v1/settings/change_password 2022-11-26 00:17:01 +00:00
silverpill
fde8309bb9 Add check-expired-invoice command 2022-11-25 21:04:59 +00:00
silverpill
5ff2d19837 Add expires_at field to Invoice object
Also increase timeout to 3 hours

https://codeberg.org/silverpill/mitra/issues/23
2022-11-25 15:04:46 +00:00
silverpill
2a9794f8f7 Add API methods for exporting followers and follows 2022-11-24 21:58:00 +00:00
silverpill
262b910638 Rename instance.host() to instance.hostname() 2022-11-24 13:27:10 +00:00
silverpill
473147ed04 Move signature type check to activitypub::authentication module 2022-11-23 16:11:25 +00:00
silverpill
3b092631ca Add signature type to the output of get_json_signature function 2022-11-23 14:56:29 +00:00
silverpill
301ade36a3 Use enum to define identity proof type 2022-11-23 01:04:55 +00:00
silverpill
3f3518001d Implement Display trait for ChainId and DidPkh 2022-11-22 22:41:23 +00:00
silverpill
241351c2bf Allow value of "icon" property to be empty object 2022-11-22 19:00:29 +00:00
silverpill
5712c9099c Allow to search for profile by actor ID 2022-11-22 00:19:46 +00:00
silverpill
1edcefee6d Accept Create() activities with object type Article and Video 2022-11-21 23:24:40 +00:00
silverpill
126c04febb Include local posts in search results 2022-11-21 22:06:06 +00:00
silverpill
6a6f151ec0 Verify that Monero transaction exists after sending
https://codeberg.org/silverpill/mitra/issues/21
2022-11-19 22:23:45 +00:00
silverpill
49a55d888f Use multibase encoding for integrity proofs 2022-11-19 15:53:22 +00:00
silverpill
4a5bcba127 Change signature format in minisign integrity proofs 2022-11-19 15:52:20 +00:00
silverpill
a46ceeb575 Use base64 encoding for JcsEip191Signature2022 integrity proofs 2022-11-19 15:52:20 +00:00
silverpill
5974ac8618 Move base64 encoding/decoding out of RSA signing functions 2022-11-19 15:52:16 +00:00
silverpill
bd4a9a0de9 Move multibase encoder and decoder to utils::multibase 2022-11-18 23:05:27 +00:00
silverpill
e1bb00a8dc Handle Accept(Follow) activities without nested Follow 2022-11-18 16:42:04 +00:00
silverpill
3b470a04f7 Allow alsoKnownAs attribute value to be string 2022-11-17 22:49:31 +00:00
silverpill
8045b9f543 Add delete-empty-profiles CLI command 2022-11-17 21:46:00 +00:00
silverpill
ec03476b58 Allow password login when token gate is disabled 2022-11-16 17:21:42 +00:00
silverpill
6765674118 Add token gate feature flag to instance info 2022-11-16 15:11:25 +00:00
silverpill
57c5ab3c4e Add API method for changing password 2022-11-15 22:43:49 +00:00
silverpill
9ad6bdf1c9 Revoke all access tokens after password reset 2022-11-15 22:32:10 +00:00
silverpill
445177d9a7 Add API method for revoking access token 2022-11-15 15:45:30 +00:00
silverpill
09cb15297a Ignore Announce(Undo) activities 2022-11-14 18:56:42 +00:00
silverpill
92d96e3745 Abort registration process if profile with a similar name already exists 2022-11-14 17:37:25 +00:00
silverpill
43f99b597a Fix parsing of ordered lists 2022-11-13 21:31:19 +00:00
silverpill
c11daa21a0 Rename utils::crypto module to crypto_rsa 2022-11-13 21:31:04 +00:00
silverpill
4d85638d8c Move password utils to utils::passwords module 2022-11-13 21:30:59 +00:00
silverpill
9b96ce4700 Add CLI command for password reset 2022-11-11 00:53:23 +00:00
silverpill
8ad88f84b2 Support integrity proofs created with minisign 2022-11-11 00:53:23 +00:00
silverpill
64546ecabe Refactor signature verifiers 2022-11-11 00:53:23 +00:00
silverpill
db00ad1623 Move signature suites to identity::signatures module 2022-11-11 00:53:23 +00:00
silverpill
f4aebdfdb2 Accept minisign identity proofs from other instances 2022-11-11 00:53:23 +00:00
silverpill
38bb3e38e9 Expose all identity proofs when building Account object 2022-11-11 00:53:23 +00:00
silverpill
cd93858488 Use canonicalized JSON for identity claims 2022-11-11 00:53:23 +00:00
silverpill
14a123ad7e Implement minisign identity proofs 2022-11-11 00:53:19 +00:00
silverpill
9d86d58274 Add methods for conversions between did:key and Ed25519 key 2022-11-10 17:35:47 +00:00
silverpill
99f7b334d1 Change identity proof API to avoid key-to-DID converion at client side 2022-11-10 13:06:59 +00:00
silverpill
efb51c1be6 Decode multibase value when parsing did:key 2022-11-10 13:06:54 +00:00
silverpill
1bfb951df8 Move create_identity_claim to identity::claims module
Make it work with any DID type
2022-11-10 09:46:06 +00:00
silverpill
a5c9da78ef Add DidKey type 2022-11-09 18:53:52 +00:00
silverpill
dae6e9437b Use general Did type intsead of DidPkh in identity proofs 2022-11-09 18:15:50 +00:00
silverpill
4e53a5c4e4 Move DidPkh type to identity module 2022-11-08 22:45:59 +00:00
silverpill
fbfb6bb3c2 Create dedicated type for Update(Person) activity 2022-11-07 15:52:53 +00:00
silverpill
e750b2b718 Add test for build_update_person 2022-11-07 15:32:49 +00:00
silverpill
ff12501ec0 Exclude local profiles when looking up activity signer 2022-11-06 22:37:09 +00:00
silverpill
109a519607 Treat activity signature as primary signature
Request signature is secondary.
2022-11-06 22:29:06 +00:00
silverpill
0840197cac Fix clippy warnings 2022-11-06 21:20:14 +00:00
silverpill
3cc7b58350 Change log level of JSON signature error message 2022-11-02 19:23:32 +00:00
silverpill
7f9b2a8768 Verify activities containing EIP-155 integrity proof 2022-11-02 18:04:12 +00:00
silverpill
cdd3bfb6df Rewrite get_json_signature to return signer type along with other info 2022-11-02 17:16:53 +00:00
silverpill
75fe4df328 Implement EIP-191 integrity proofs 2022-11-02 16:08:34 +00:00
silverpill
1ec8cb4ddd Add views for signing Update(Person) activity 2022-11-02 16:08:34 +00:00
silverpill
dec9b1f3a4 Create function for inserting integrity proofs into JSON objects 2022-11-02 16:08:34 +00:00
silverpill
3dbb922f3c Return error if trying to sign activity which is already signed 2022-11-02 16:08:34 +00:00
silverpill
b700a8ac6d Return verified results when searching for DID 2022-11-02 16:06:19 +00:00
silverpill
4193ba94a5 Write warning to log if request signer differs from activity signer 2022-10-31 22:33:14 +00:00
silverpill
67eb654203 Add canonicalize_object function 2022-10-31 20:12:19 +00:00
silverpill
8c1d871d9e Return HTTP 405 in reponse to POST request to outbox
ActivityPub C2S is not supported.
2022-10-31 19:11:00 +00:00
silverpill
c8b8a5ffe5 Remove name attribute from link tag 2022-10-28 15:34:30 +00:00
silverpill
1d66f5e864 Add creation date to JSON signature 2022-10-28 13:27:36 +00:00
silverpill
3bbf902b28 Require HTTP signatures to have creation date 2022-10-28 12:56:49 +00:00
silverpill
2e7403ef14 Add redirection views for /profile/{id} and /post/{id} paths 2022-10-27 22:13:53 +00:00
silverpill
367e3f37c7 Verify signed activities 2022-10-27 20:45:49 +00:00
silverpill
077d942573 Add error type for AP authentication errors 2022-10-27 20:09:47 +00:00
silverpill
b345cb4a77 Allow GET requests from any origin 2022-10-27 15:48:54 +00:00
silverpill
23dca1b4c5 Allow object links with custom text 2022-10-26 20:32:43 +00:00
silverpill
acad0f260b Perform post content cleaning at the end of validation process 2022-10-25 23:26:42 +00:00
silverpill
a67a7b9b17 Remove character limit check 2022-10-25 19:49:48 +00:00
silverpill
a3723e2e6d Sign outgoing activities 2022-10-24 21:20:41 +00:00
silverpill
295150361c Improve reporting of JSON parsing error 2022-10-24 21:19:48 +00:00
silverpill
518fb704c3 Add test for HTTP signature verification 2022-10-24 20:01:58 +00:00
silverpill
01d3f54939 Move verify_signed_request function to activitypub::authentication module 2022-10-23 23:51:51 +00:00
silverpill
256e225742 Rename ImportError to HandlerError 2022-10-23 23:51:51 +00:00
silverpill
1e575b2f6f Rewrite receive_activity to return ImportError instead of HttpError 2022-10-23 23:51:50 +00:00
silverpill
862415d49b Refactor http_signatures module 2022-10-23 23:49:16 +00:00
silverpill
9d671344e6 Don't use rng when generating private keys in tests 2022-10-23 17:56:32 +00:00
silverpill
0063a14264 Send notifications when actor moves to another instance 2022-10-23 17:56:32 +00:00
silverpill
9b31395853 Handle Move(Person) activity
https://codeberg.org/silverpill/mitra/issues/10
2022-10-23 17:56:23 +00:00
silverpill
ec349afc80 Reset repost and reply visibility settings after unfollowing 2022-10-22 16:06:50 +00:00
silverpill
65661698c7 Pass instance as ref to activity builders 2022-10-22 11:33:23 +00:00
silverpill
8f7dd5d88c Write message to log if remote actor has aliases 2022-10-22 11:33:09 +00:00
silverpill
01305475c3
Allow object links in replies 2022-10-20 18:07:01 +00:00
silverpill
f92428e509 Add support for SOCKS proxy 2022-10-19 20:29:24 +00:00
silverpill
36730be03b Replace actor image fetchers with a single function 2022-10-19 19:47:06 +00:00
silverpill
dbe54f0924 Sort inboxes before delivering activity 2022-10-18 21:35:59 +00:00
silverpill
f0dace197b Allow instance URI to be onion, i2p or yggdrasil address 2022-10-18 19:10:30 +00:00
silverpill
eef20f6b7c Write list of unreachable instances to log after finishing delivery 2022-10-18 00:20:02 +00:00
silverpill
09d025d461 Add get_hostname function 2022-10-18 00:06:26 +00:00
silverpill
879e284403 Fetch posts quoted in replies
Previously only quotes in top-level posts were processed.
2022-10-17 19:00:56 +00:00
silverpill
762b3e053e Refactor fetcher loop in import_post 2022-10-17 18:55:09 +00:00
silverpill
374d17c8cf Prevent panic in import_post 2022-10-17 00:01:44 +00:00
silverpill
a422b1bf8a Preserve mentions when converting markdown into html 2022-10-16 20:08:31 +00:00
silverpill
f6c3cbc0fa Prepare Delete(Note) before deleting post from database 2022-10-16 00:42:20 +00:00
silverpill
ea62f1fdaf Ignore object links inside code blocks 2022-10-16 00:01:49 +00:00
silverpill
a771e5e4fa Add support for object link microsyntax
Example: [[https://example.com/objects/1]].
2022-10-15 21:52:36 +00:00
silverpill
8d271fe4e3 Replace "quote" property on Status object with array of linked posts 2022-10-15 21:08:03 +00:00
silverpill
1f713d536e Allow to create posts with multiple object links 2022-10-15 21:07:57 +00:00
silverpill
22d4695614 Add get_post_by_object_id helper 2022-10-15 14:20:45 +00:00
silverpill
a74736d29f Ignore Update(Note) if it tries to update local post 2022-10-15 14:13:12 +00:00
silverpill
0ce634564b Rename some functions 2022-10-15 13:08:50 +00:00
silverpill
b26b2419ed Add support for posts authored in markdown 2022-10-14 16:00:39 +00:00
silverpill
33b04c9bdd Add optional content_type parameter to /api/v1/status data and set default to text/html 2022-10-13 19:19:11 +00:00
silverpill
03ebf75da2 Wrap markdown in remote object content in <p> tag 2022-10-13 16:52:06 +00:00
silverpill
c95e983a3d Remove images from remote posts
To prevent tracking.
2022-10-13 11:01:54 +00:00
silverpill
187e46612d Remove unnecessary line breaks before inline-quote block 2022-10-11 20:02:47 +00:00
silverpill
47149e5379 Fix panic during post deletion 2022-10-11 19:52:41 +00:00
silverpill
81910f9591 Rename instance field in ActorAddress to hostname 2022-10-09 14:28:30 +00:00
silverpill
0a62fdac2b Remove target="_blank" and add rel="noopener" during HTML cleaning 2022-10-09 13:06:57 +00:00