FEP-fe34 states:
In some cases, an embedded object can be trusted when its wrapping object is trusted:
- An embedded object has the same origin and the same owner as the wrapping object.
However, if an embedded object is partial, the consumer may inadvertently cache it, replacing the full object.
For example, this may happen with FEP-171b Add activities where target is a partial OrderedCollection object:
{
...
"target": {
"type": "OrderedCollection",
"id": "https://alice.example/contexts/1/history",
"attributedTo": "https://alice.example/actors/1"
}
}
Related discussion: https://socialhub.activitypub.rocks/t/partially-embedded-objects/4450
Possible solutions and their downsides
1. Never trust embedded objects without an integrity proof
Too late: embedding is used by many implementations. It's a well-established practice for reducing the network load.
2. Use a special property or type to mark partial objects
The property could be named partial, as suggested in https://socialhub.activitypub.rocks/t/partially-embedded-objects/4450 (or $partial, or partialObject)
Implementations that are not aware of this mechanism still may cache the partial object. No implementation experience.
3. Identify partial objects using fragment IDs
IDs of partial objects would need to have special fragment ID, such as #fragment
Resolution of such ID leads to a fragment, not full object. Implementers would need to treat this as a special case.
4. Use a special "reference" object instead of a partial object
This solution was suggested in https://socialhub.activitypub.rocks/t/partially-embedded-objects/4450/7
It can't be used in situations where a specific object is expected. For example, it can't be used as an object of Undo(Follow) activity.
5. Don't allow partial objects
Some implementations already use partial embeddings.
It is a good way to simplify processing of some activities such as Undo and Add. An alternative to partial embedding is to insert a property such as objectType and targetType (instead of embedding "object": {"type": "..."}).
Conclusion
My preferred solution is 2 because it is backward compatible and shifts the burden to implementations that cache all objects they encounter (they are few, if exist; probably variations of a generic AP server).
FEP-fe34 states:
> In some cases, an embedded object can be trusted when its wrapping object is trusted:
> - An embedded object has the same origin and the same owner as the wrapping object.
However, if an embedded object is partial, the consumer may inadvertently cache it, replacing the full object.
For example, this may happen with [FEP-171b](https://codeberg.org/fediverse/fep/src/branch/main/fep/171b/fep-171b.md#examples) `Add` activities where `target` is a partial `OrderedCollection` object:
```
{
...
"target": {
"type": "OrderedCollection",
"id": "https://alice.example/contexts/1/history",
"attributedTo": "https://alice.example/actors/1"
}
}
```
Related discussion: https://socialhub.activitypub.rocks/t/partially-embedded-objects/4450
## Possible solutions and their downsides
**1. Never trust embedded objects without an integrity proof**
Too late: embedding is used by many implementations. It's a well-established practice for reducing the network load.
**2. Use a special property or type to mark partial objects**
The property could be named `partial`, as suggested in https://socialhub.activitypub.rocks/t/partially-embedded-objects/4450 (or `$partial`, or `partialObject`)
Implementations that are not aware of this mechanism still may cache the partial object. No implementation experience.
**3. Identify partial objects using fragment IDs**
IDs of partial objects would need to have special fragment ID, such as `#fragment`
Resolution of such ID leads to a fragment, not full object. Implementers would need to treat this as a special case.
**4. Use a special "reference" object instead of a partial object**
This solution was suggested in https://socialhub.activitypub.rocks/t/partially-embedded-objects/4450/7
It can't be used in situations where a specific object is expected. For example, it can't be used as an `object` of `Undo(Follow)` activity.
**5. Don't allow partial objects**
Some implementations already use partial embeddings.
It is a good way to simplify processing of some activities such as `Undo` and `Add`. An alternative to partial embedding is to insert a property such as `objectType` and `targetType` (instead of embedding `"object": {"type": "..."}`).
## Conclusion
My preferred solution is 2 because it is backward compatible and shifts the burden to implementations that cache all objects they encounter (they are few, if exist; probably variations of a [generic AP server](https://codeberg.org/fediverse/fep/src/branch/main/fep/fc48/fep-fc48.md)).