Wykres commitów

203 Commity (ld-signatures)

Autor SHA1 Wiadomość Data
Jason Robinson eef1f7d820 Add fetchers for nodeinfo, nodeinfo2 and statisticsjson 2018-04-08 12:57:08 +03:00
Jason Robinson 2a02f866aa Allow port in Diaspora handles as per the protocol specification
Previously handles were validated like emails.
2018-03-09 22:17:08 +02:00
Jason Robinson 4c2a42dfb9 Fix validation of `Retraction` with entity type `Share` 2018-03-09 21:50:54 +02:00
Jason Robinson ab3e2451b8 Ensure when processing payload empty payload tags don't create None values 2018-02-27 23:03:23 +02:00
Jason Robinson c15aa14e8e Switch Diaspora protocol to send new style entities
We've already accepted these on incoming payloads for a long time and so do all the other platforms now, so now we always send out entities with the new property names. This can break federation with really old servers that don't understand these keys yet.

Closes #59
2018-02-24 15:04:07 +02:00
Jason Robinson aa8e8a7960 Use unquote instead of unquote_plus when preparing XML payload
Change unquote method used when preparing Diaspora XML payloads for verification.

Some platforms deliver payloads not using the urlsafe base64 standard which caused problems when validating the unquoted signature. Ensure maximum compatibility by allowing non-standard urlsafe quoted payloads.

Closes #115
2018-02-24 14:02:06 +02:00
Jason Robinson f80211b178 Add RFC3033 webfinger generator
Also provided is a Django view and url configuration for easy addition into Django projects. Django is not a hard dependency of this library, usage of the Django view obviously requires installing Django itself. For configuration details see documentation.

Closes #108
2018-02-17 01:38:37 +02:00
Jason Robinson 47f79205f1 Changelog entries for last commits 2018-02-13 23:11:53 +02:00
Jason Robinson c1efc1add1 Enable generating encrypted JSON payloads with the Diaspora protocol
This adds possibility for private message support.

JSON encrypted payload encryption and decryption is handled by the Diaspora `EncryptedPayload` class.

Refs: #82
2018-02-12 23:14:27 +02:00
Jason Robinson c6bbd3ac4b Send outbound Diaspora payloads in new format
Remove possibility to generate legacy MagicEnvelope payloads.

Refs: #82
2018-02-12 23:00:22 +02:00
Jason Robinson f6091d270a Release 0.15.0 2018-02-12 22:37:11 +02:00
Jason Robinson 29b6f79705 Support fetching new style Diaspora protocol Webfinger (RFC 3033) (#110)
The legaxy Webfinger is still used as fallback if the new Webfinger is not found.

Refs: #108
2018-02-02 18:28:36 +02:00
Jason Robinson 9c132df16e
Ensure handle is always lower cased when fetching remote profile (#109)
Using `retrieve_remote_profile`. Warning will be logged if an upper case handle is passed in.
2018-01-20 15:29:56 +02:00
Jason Robinson 1da5a05cd5
Changelog for #107 2018-01-04 23:17:26 +02:00
Jason Robinson a65b040969 Support Diaspora URI scheme
Add 'id' and 'target_id' to Diaspora entities. Refactor retrieve content fetcher to use the Diaspora URI scheme based ID.
2017-10-22 14:40:12 +03:00
Jason Robinson e343369f5b New high level fetcher function retrieve_remote_content
The given ID will be fetched using the correct entity class specific remote endpoint, validated to be from the correct author against their public key and then an instance of the entity class will be constructed and returned.

Also related changes and refactoring:

* New Diaspora protocol helper `federation.utils.diaspora.retrieve_and_parse_content`. See notes regarding the high level fetcher above.
* New Diaspora protocol helper `federation.utils.fetch_public_key`. Given a `handle` as a parameter, will fetch the remote profile and return the `public_key` from it.
* Refactoring for Diaspora `MagicEnvelope` class.
* Diaspora procotol receive flow now uses the `MagicEnvelope` class to verify payloads.
* Diaspora protocol receive flow now fetches the sender public key over the network if a `sender_key_fetcher` function is not passed in. Previously an error would be raised.

Closes #103
2017-10-21 22:04:05 +03:00
Jason Robinson fb2f9d091d Added base entity Share
Maps to a `DiasporaReshare` for the Diaspora protocol.

The `Share` entity supports all the properties that a Diaspora reshare does. Additionally two other properties are supported: `raw_content` and `entity_type`. The former can be used for a "quoted share" case where the sharer adds their own note to the share. The latter can be used to reference the type of object that was shared, to help the receiver, if it is not sharing a `Post` entity. The value must be a base entity class name.

Closes #94
2017-08-22 12:12:47 +03:00
Jason Robinson b3c4ac76a6 Fix DiasporaProfile.from_base
Converting base entity `Profile` to `DiasporaProfile` for outbound sending missed two attributes, `image_urls` and `tag_list`. Those are now included so that the values transfer into the built payload.
2017-08-09 00:02:49 +03:00
Jason Robinson 5d3db57e65 Release 0.14.1... 2017-08-06 16:20:30 +03:00
Jason Robinson c6343bbd74 Fix regression in handling Diaspora relayables
Due to security fix in 0.14.0. Payload and entity handle need to be allowed to be different when handling relayables.
2017-08-06 16:06:45 +03:00
Jason Robinson 36da89e0bb Release 0.14.0 2017-08-06 15:35:54 +03:00
Jason Robinson 934bd69bba Verify payload and entity handle are the same
Add proper checks to make sure Diaspora protocol payload handle and entity handle are the same. Even though we already verified the signature of the sender, we didn't ensure that the sender isn't trying to fake an entity authored by someone else.

The Diaspora protocol functions `message_to_objects` and `element_to_objects` now require a new parameter, the payload sender handle. These functions should normally not be needed to be used directly.
2017-08-06 14:04:50 +03:00
Jason Robinson 977c584d96 Refactor handle_send and handle_create_payload signatur
**Breaking change.** The high level `federation.outbound` functions `handle_send` and `handle_create_payload` signatures have been changed. This has been done to better represent the objects that are actually sent in and to add an optional `parent_user` object.

For both functions the `from_user` parameter has been renamed to `author_user`. Optionally a `parent_user` object can also be passed in. Both the user objects must have `private_key` and `handle` attributes. In the case that `parent_user` is given, that user will be used to sign the payload and for Diaspora relayables an extra `parent_author_signature` in the payload itself.
2017-07-29 13:43:35 +03:00
Jason Robinson f0eba0e3d1 Release 0.13.0 2017-07-22 00:03:49 +03:00
Jason Robinson 10fa2cf846 Enable correct Diaspora relayable behaviour
Store the original object when signing with parent, then use that for sending, not serializing our entity object.

This fixes relayable support broken with the new Diaspora protocol.
2017-07-21 23:21:30 +03:00
Jason Robinson 5b04e5ea84 Add created_at to Diaspora Comment entity XML creator
This is required in renewed Diaspora protocol.

Refs: #59
2017-07-21 22:51:16 +03:00
Jason Robinson 8c5f52c0a9 Improve changelog for #91 closure
Closes: #91
2017-07-19 00:58:34 +03:00
Jason Robinson 109e97cbd9 Fix identifying Diaspora payload if it is passed to handle_receive as a bytes object 2017-07-19 00:39:47 +03:00
Jason Robinson 2e8d608256 Support receiving Diaspora new style encrypted JSON payloads
Decrypt the JSON and extract the Magic Envelope inside.

Closes #83
2017-07-04 23:24:39 +03:00
Jason Robinson ccf161a5d3 Remove deprecated 'user.key' lookup for private key 2017-07-04 23:16:56 +03:00
Jason Robinson 5580b5143f Fix parsing Diaspora profile with empty tag_string
Closes #88
2017-07-03 22:53:08 +03:00
Jason Robinson 0363260374 Correctly extend entity _children
Certain payloads caused _children for an entity to be written over by an empty list. Correctly do an extend on it.

Closes #89
2017-07-03 22:30:24 +03:00
Jason Robinson 659ba5643d Remove Post.photos attribute which was never used
It was replaced by the _children attribute.
2017-07-03 22:27:18 +03:00
Jason Robinson 78d344d6a8 Fix getting sender from a combination of legacy Diaspora encrypted payload and new entity names
For example `author`. This combination probably only existed in this library.
2017-06-08 23:37:59 +03:00
Jason Robinson e28e3fd587 Release 0.12.0 2017-05-22 23:25:54 +03:00
Jason Robinson d64a2c27a2 Add receiving user guid to entity for private Diaspora payloads
Required for example to actually use (legacy) relationship retraction.
2017-05-21 22:46:23 +03:00
Jason Robinson 41937389a5 Support Diaspora legacy request retraction 2017-05-18 22:32:31 +03:00
Jason Robinson ec7bf037f5 Add changelog for Follow entity 2017-05-17 23:16:22 +03:00
Jason Robinson 1a5cb4d163 Add support for new style Diaspora Salmon magic envelope in public payloads
Closes #75
2017-05-16 22:53:50 +03:00
Jason Robinson f857fe0ab4 Release 0.11.0 2017-05-08 22:23:10 +03:00
Jason Robinson 8478d3b90c Add handle_send outbound helper
Allows sending a single entity to multiple receivers. Currently public Diaspora entities supported.
2017-05-07 21:28:56 +03:00
Jason Robinson bf5b4a03b6 Save order of elements for Diaspora relayables to the entities
Refs: diaspora/diaspora_federation#26
2017-05-06 21:24:03 +03:00
Jason Robinson f773e78ebc Add changelog for #60 2017-05-06 20:24:50 +03:00
Jason Robinson 3206cab1e1 Add changelog related to comment and like additions 2017-05-01 17:42:49 +03:00
Jason Robinson b24a3370f2 Raise specific exception when Diaspora payload signature verification fails
Also convert another 'assert' to a raise. Asserts might be skipped in production environments.

Closes #61
2017-04-29 22:05:38 +03:00
Jason Robinson 14030faeb3 Add changelog entry for author_signature and _source_protocol 2017-04-23 22:14:38 +03:00
Jason Robinson bedf5801e9 Release 0.10.1 2017-03-09 23:24:08 +02:00
Jason Robinson 8ccb8eefdf Ensure tags are lower cased after collecting them from raw_content 2017-03-09 23:18:44 +02:00
Jason Robinson 503076a30c Add missing 0.10.0 timestamp to changelog 2017-01-28 16:56:38 +02:00
Jason Robinson abfc01d3d5 Release 0.10.0 2017-01-28 16:55:35 +02:00
Jason Robinson f6a5438a54 Add support for new Diaspora timestamp format
Diaspora protocol changed to ISO 8601 timestamp format in protocol version 0.1.6.

Closes #67
2017-01-28 13:34:48 +02:00
Jason Robinson ef46515ee7 Don't crash diaspora retrieve_diaspora_webfinger on XRD parse error 2017-01-12 21:54:48 +02:00
Jason Robinson 1bf4d8f41a Release 0.9.1 2016-12-10 16:33:30 +02:00
Jason Robinson b4559c256d Made Profile.raw_content optional
This fixes validating profiles parsed from Diaspora hCard's.
2016-12-10 16:28:53 +02:00
Jason Robinson dae45fc609 Release 0.9.0 2016-12-10 12:48:08 +02:00
Jason Robinson e7eb4b75bb Fix Diaspora photo support and allow entities to have children
Diaspora photo elements are now processed correctly. Inbound parsing has been changed to also correctly add them to created entities as children, if they happen to be embedded in status messages, for example. Entity children can be iterated using the `_children` list.

Also rename the `Image.text` attribute to `Image.raw_content` to be more consistent.

Closes #62
2016-12-10 12:28:52 +02:00
Jason Robinson 334d6902e3 Release 0.8.2 2016-10-23 16:04:06 +03:00
Jason Robinson 1d0de928fc Remove legacy splitting of payload to 60 chars when creating Diaspora payloads
It looks like new 0.6 diaspora doesn't understand these payloads any more.
2016-10-23 16:03:00 +03:00
Jason Robinson d01e656daf Release 0.8.1 2016-10-18 22:34:45 +03:00
Jason Robinson 5b917838a8 Ensure send_document accepts headers in a case insensitive fashion 2016-10-18 22:33:35 +03:00
Jason Robinson 17ba97ab1f Fix crash in send_document when passing in custom headers
`federation.utils.network.send_document` incorrectly passed in `kwargs` to `requests.post`, causing an error when sending custom headers.
2016-10-18 22:11:27 +03:00
Jason Robinson 85d6f9c03d Release 0.8.0 2016-10-09 14:58:21 +03:00
Jason Robinson c5becee7fe Rename library to federation
Less typing saves lives.
2016-10-04 22:07:24 +03:00
Jason Robinson 4edca37168 Init documentation
Closes #34
2016-10-02 23:07:39 +03:00
Jason Robinson 64839a9d81 Remove unnecessary 'protocol' parameter from retrieve_remote_profile
We're miles away from including other protocols and ideally the caller shouldn't have to pass in the protocol anyway.
2016-10-01 23:36:09 +03:00
Jason Robinson ae717aefa8 Validate fetched remote profile
federation.utils.diaspora.retrieve_and_parse_profile will now return None if the Profile retrieved doesn't validate. This will affect also the output of federation.fetchers.retrieve_remote_profile which is the high level function to retrieve profiles.

Closes #54
2016-10-01 23:33:34 +03:00
Jason Robinson c7b741913e Add Retraction entity
With DiasporaRetraction counterpart.

Closes #8
2016-10-01 22:48:48 +03:00
Jason Robinson 42fce2493f Release 0.7.0 2016-09-15 23:54:42 +03:00
Jason Robinson 0f2c97adf8 Validate entities that are created through message_to_objects
To safeguard invalid entities being passed on to library users, validate entities that are created in the message_to_objects calls. Any failures are logged as errors.

This means for Diaspora Profile messages we must fetch the remote GUID from the hcard. Diaspora Profile XML message does not contain the guid but our data structure enforces GUID as a required attribute. This ensures library users will get a full profile back always. Implement in the Diaspora entities a hook fill_extra_attributes that is called in message_to_objects.
2016-09-15 23:02:55 +03:00
Jason Robinson dea861db18 Fix parsing profile from hCard
In the future diaspora hCard is not guaranteed to contain pod url or username. Don't rely on these in the parser, instead pass handle to the hCard parser directly.

Closes #50
2016-09-15 15:39:41 +03:00
Jason Robinson efccbab823 Release 0.6.1 2016-09-14 22:08:44 +03:00
Jason Robinson c1a37a7a91 Fix new style Diaspora Magic Envelope payload data
New style Diaspora Magic Envelope didn't require or like payload data to be cut to 60 char lines, as the legacy protocol does. Fixed to not cut lines.
2016-09-14 22:04:02 +03:00
Jason Robinson 054f2b60e0 Release 0.6.0 2016-09-13 12:07:20 +03:00
Jason Robinson 476c6114ec Fix hcard selectors in parse_profile_from_hcard
Closes #39
2016-09-13 11:55:42 +03:00
Jason Robinson 0b91e828d4 New style Diaspora Magic Envelope support
Not used in actual federation yet. Offers a class to build the envelope separately.

Closes #47
2016-09-13 11:29:13 +03:00
Jason Robinson 4b01542fd4 Add changelog for user.private_key change 2016-09-12 21:58:28 +03:00
Jason Robinson 8d62831ae9 Release 0.5.0 2016-09-05 23:38:33 +03:00
Jason Robinson 6cf06e915e Add Diaspora entity utility get_full_xml_representation 2016-09-05 23:33:35 +03:00
Jason Robinson ee5b16415e Add send_document network utility
It's a wrapper around requests.post that adds the correct user agent and silently captures common requests exceptions and returns them instead.
2016-09-05 22:58:08 +03:00
Jason Robinson f979b8e91e Add mappings for Post.provider_display_name 2016-09-05 22:22:49 +03:00
Jason Robinson c8f436cd4e Make to_user optional in handle_create_payload
Public content does not require a recipient.
2016-09-05 22:09:08 +03:00
Jason Robinson b2011b3fac Release 0.4.1 2016-09-04 23:15:39 +03:00
Jason Robinson 71ff2e7943 Changelog for #41 2016-09-04 23:06:25 +03:00
Jason Robinson 1b991a4555 Release 0.4.0 2016-07-24 22:06:18 +03:00
Jason Robinson b64031ef29 Add remote profile fetcher
High level method to fetch a remote profile. Currently falls back to Diaspora protocol as no others are supported.

Returns a Profile entity.

Closes #15
2016-07-24 20:25:16 +03:00
Jason Robinson 3e73658d65 Add 'guid' and 'public_key' as required for DiasporaHCard generator
Leaving these out was a mistake in the initial implementation. Diaspora has these in at least 0.6 development branch.
2016-07-24 14:51:29 +03:00
Jason Robinson 7b458b7fc7 Split federation.controllers to inbound and outbound 2016-07-23 13:37:56 +03:00
Jason Robinson f8cc459057 Add changelog entry for #33
[ci skip]
2016-07-23 00:23:38 +03:00
Jason Robinson 3c27abf0a9 Add Profile entity
Closes #24
2016-07-20 00:04:46 +03:00
Jason Robinson bf348e9544 Convert outbound entities to correct protocol types
When sending an entity, first convert it to the correct entity using the protocol entities. If a suitable entity is not found, raise an error.

Closes #27
2016-07-19 21:51:59 +03:00
Jason Robinson 08c1d4fa91 Add Relationship entity
Relationship base entity which represents relationships between two handles. Types can be following, sharing, ignoring and blocking. The Diaspora counterpart, DiasporaRequest, which represents a sharing/following request is outwards a single entity, but incoming a double entity, handled by creating both a sharing and following version of the relationship.

Closes #26
2016-07-18 22:39:17 +03:00
Jason Robinson f69e7bfd8a Refactor Diaspora protocol sender handle fetching
Diaspora private messages don't have a plain text sender handle in the header. One must first
open the message (without verifying it), fetch the sender handle and then verify the content.

Closes #21
2016-07-17 21:02:13 +03:00
Jason Robinson 3c6c7f6145 Unlock more direct dependency version ranges
Unlock most of the direct dependencies to a certain version range. Unlock all of test requirements to any version.
2016-05-22 21:43:23 +03:00
Jason Robinson a6863680ef Release 0.3.2 2016-05-09 22:04:08 +03:00
Jason Robinson f1eadbf8d7 Changelog for changed dependencies 2016-05-09 21:58:15 +03:00
Jason Robinson fde1e988da Don't raise on Post.tags if Post.raw_content is None
Fixes #17
2016-05-09 21:35:42 +03:00
Jason Robinson cddebf87cd Install all test files with package
Test factories can be useful in building project tests.
2016-04-16 22:28:10 +03:00
Jason Robinson de87e7e210 Release 0.3.1 2016-04-13 22:14:42 +03:00
Jason Robinson 3e2a77c490 Add support for generating .well-known/nodeinfo
Was forgotten from previous release.

Refs: #11
2016-04-13 21:59:26 +03:00
Jason Robinson 1411c1aadd Release 0.3.0 2016-04-13 18:47:30 +03:00
Jason Robinson 69e179f506 Add support for NodeInfo document generation
Support for generating NodeInfo documents using the generator `federation.hostmeta.generators.NodeInfo`. Strict validation is skipped by default, but can be enabled by passing in `raise_on_validate` to the `NodeInfo` class. By default a warning will be generated on documents that don't conform with the strict NodeInfo values. This can be disabled by passing in `skip_validate` to the class.
2016-04-12 22:46:43 +03:00
Jason Robinson e8cc4d7bdd Release 0.2.0 2016-04-09 13:56:17 +03:00
Jason Robinson 36dac79121 Add a changelog [ci skip] 2016-04-06 22:53:07 +03:00