mirror of
https://github.com/Nutomic/ibis.git
synced 2024-12-26 00:41:24 +00:00
Add domain checks for federation
This commit is contained in:
parent
41a4d18949
commit
dd56a3f0d5
3 changed files with 12 additions and 6 deletions
|
@ -5,6 +5,7 @@ use crate::common::DbInstance;
|
|||
|
||||
use crate::common::DbArticle;
|
||||
use activitypub_federation::kinds::collection::CollectionType;
|
||||
use activitypub_federation::protocol::verification::verify_domains_match;
|
||||
use activitypub_federation::{
|
||||
config::Data,
|
||||
traits::{Collection, Object},
|
||||
|
@ -55,10 +56,11 @@ impl Collection for DbArticleCollection {
|
|||
}
|
||||
|
||||
async fn verify(
|
||||
_apub: &Self::Kind,
|
||||
_expected_domain: &Url,
|
||||
json: &Self::Kind,
|
||||
expected_domain: &Url,
|
||||
_data: &Data<Self::DataType>,
|
||||
) -> Result<(), Self::Error> {
|
||||
verify_domains_match(&json.id, expected_domain)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use crate::common::EditVersion;
|
|||
use crate::common::{DbArticle, DbEdit};
|
||||
use activitypub_federation::config::Data;
|
||||
use activitypub_federation::fetch::object_id::ObjectId;
|
||||
use activitypub_federation::protocol::verification::verify_domains_match;
|
||||
use activitypub_federation::traits::Object;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -63,10 +64,11 @@ impl Object for DbEdit {
|
|||
}
|
||||
|
||||
async fn verify(
|
||||
_json: &Self::Kind,
|
||||
_expected_domain: &Url,
|
||||
json: &Self::Kind,
|
||||
expected_domain: &Url,
|
||||
_data: &Data<Self::DataType>,
|
||||
) -> Result<(), Self::Error> {
|
||||
verify_domains_match(json.id.inner(), expected_domain)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use crate::common::DbArticle;
|
|||
use crate::common::DbEdit;
|
||||
use crate::common::DbInstance;
|
||||
use activitypub_federation::kinds::collection::OrderedCollectionType;
|
||||
use activitypub_federation::protocol::verification::verify_domains_match;
|
||||
use activitypub_federation::{
|
||||
config::Data,
|
||||
traits::{Collection, Object},
|
||||
|
@ -59,10 +60,11 @@ impl Collection for DbEditCollection {
|
|||
}
|
||||
|
||||
async fn verify(
|
||||
_apub: &Self::Kind,
|
||||
_expected_domain: &Url,
|
||||
json: &Self::Kind,
|
||||
expected_domain: &Url,
|
||||
_data: &Data<Self::DataType>,
|
||||
) -> Result<(), Self::Error> {
|
||||
verify_domains_match(&json.id, expected_domain)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue