Joystream / Joystream/joystream
Authentication between Argus and Colossus nodes
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
As mentioned [here](https://github.com/Joystream/joystream/issues/4414#issuecomment-1299695893), since we're introducing [content access authentication in Argus](https://github.com/Joystream/joystream/issues/4415), we also need to have authentication between Argus and Colossus for the purpose of fetching the data.
1. `InfrastructureAccessKey` schema as defined in https://github.com/Joystream/joystream/issues/4415, but with some small adjustments as described below
2. To avoid very complex queries the `accessKeys` are assigned directly to `DistributionBucketOperator` entity in this case, ie.:
```graphql
type DistributionBucketOperator @entity {
# ...
"Operator access keys"
accessKeys: [InfrastructureAccessKey] @derivedFrom(field: "distributionBucketOperator")
}
```
This also means `InfrastructureAccessKey` owner can be either `Membership` or `DistributionBucketOperator`:
```graphql
# Infrastructure access (session) key for authenticating with Argus/Colossus
type InfrastructureAccessKey @entity {
# ...
"Member that owns the access key (if it's owned by a member)."
member: Membership
"Distribution bucket operator that owns the access key (if it's owned by a distribution bucket operator)"
distributionBucketOperator: DistributionBucketOperator
}
```
3. `AddInfrastructureAccessKey` and `RemoveInfrastructureAccessKey` messages can be reused for processing `DistributionOperatorRemarked` (same way they will be used for processing `MemberRemarked`)
4. Colossus only allows Argus nodes to fetch assets that they are assigned to distribute. This means for each request to `GET /files/{id}` the colossus will:
4.1. Find all distirbution buckets that are distributing given object:
```graphql
storageDataObjects(where: { id_eq: $id }) {
storageBag {
distributionBuckets {
id
}
}
}
```
4.2. Find distribution bucket by `accessKey`:
```graphql
infrastructureKeys(where: { key_eq: $key }) {
expiresAt
distributionBucketOperator {
distributionBucket {
id
# ...
}
}
}
```
4.3. Verify the validity of access key and distribution bucket (whether it's active or not) and make sure that the requested data object is distributed by this bucket
5. In order for this to work we need to prevent interactions with Argus/Colossus nodes that are not yet in sync, as this would allow the use of outdated access keys. This means we need to check that both the QN and the Substrate node that the Colossus/Argus node connect to are no more than `x` block behind the current chain head before allowing some of the API interactions.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.