Skip to content

Commit f445146

Browse files
committed
describe sensitive solutions
1 parent efd694e commit f445146

File tree

1 file changed

+25
-41
lines changed
  • docs/Protocol Specifications

1 file changed

+25
-41
lines changed

docs/Protocol Specifications/core.md

+25-41
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ weight: 0
4949
- [4.1 Authentication](#41-authentication)
5050
- [4.1.1 Authenticating on a foreign server](#411-authenticating-on-a-foreign-server)
5151
- [4.1.2 Sensitive actions](#412-sensitive-actions)
52+
- [4.1.1 Sensitive Solutions](#411-sensitive-solutions)
5253
- [4.2 Key trials](#42-key-trials)
53-
- [4.3 Protection against misuse by malicious home servers](#43-protection-against-misuse-by-malicious-home-servers)
54+
- [4.4 Protection against misuse by malicious home servers](#44-protection-against-misuse-by-malicious-home-servers)
5455
- [5. Federation IDs (FIDs)](#5-federation-ids-fids)
5556
- [6. Cryptography and ID-Certs](#6-cryptography-and-id-certs)
5657
- [6.1 Home server signed certificates for public client identity keys (ID-Cert)](#61-home-server-signed-certificates-for-public-client-identity-keys-id-cert)
@@ -134,6 +135,8 @@ polyproto operates under the following trust assumptions:
134135
mostly out of the scope of this specification.
135136
6. Users rely on their home server for identity key certification, without the home server
136137
possessing the identity.
138+
7. Communication with home servers happens through TLS protected communication channels, such as
139+
`https` for HTTP and `wss` for WebSockets.
137140

138141
## 3. APIs and underlying communication protocols
139142

@@ -934,17 +937,6 @@ token. This verification must be done by proving the following facts:
934937

935938
#### 4.1.2 Sensitive actions
936939

937-
!!! bug
938-
939-
# Outdated: Challenge strings are not used for this.
940-
941-
"Sensitive solutions" are set to replace challenge strings as an authenticator for sensitive actions.
942-
943-
The API documentation already reflects this change; expect the protocol specification to reflect
944-
these changes in upcoming beta versions of polyproto.
945-
946-
TODO: Better describe "Sensitive-Solution" instead.
947-
948940
!!! warning
949941

950942
Sensitive actions require a second factor of authentication, apart from the actor's
@@ -967,11 +959,25 @@ Sensitive actions include, but are not limited to:
967959
HTTP API routes marked as sensitive actions require a header `X-P2-Sensitive-Solution`, where the
968960
header value represents the second factor of authentication chosen.
969961

962+
#### 4.1.1 Sensitive Solutions
963+
964+
Sensitive actions are authorized using so-called "Sensitive solutions". The concrete way to derive a
965+
sensitive solution depends on the authentication (authn)/authorization (authz) standard used in
966+
tandem with polyproto. Deriving a valid sensitive solution through the use of an actors private identity
967+
keys must not be possible, as sensitive solutions act as a second layer of authentication to prevent
968+
identity takeover if a private identity key were to be leaked.
969+
970970
!!! example
971971

972-
If the chosen second factor of authentication is TOTP, the value of this header is the current
973-
TOTP verification code. If the chosen second factor of authentication is a password, then the
974-
value of this header is to be that password.
972+
If the chosen second factor of authentication is TOTP, the value of this header is to be the
973+
current TOTP verification code, or to be derived from the current TOTP verification code.
974+
If the chosen second factor of authentication is a password, then the value of this header is
975+
to be that passwords' hash value. Client and server must of course agree on how the sensitive
976+
solution is to be generated and validated.
977+
978+
Sensitive solutions are only used in actor ⇄ actor home-server communications, never in actor ⇄
979+
foreign server communications. It is unsafe to use sensitive solutions as described in this chapter for
980+
actor ⇄ foreign server communications.
975981

976982
### 4.2 Key trials
977983

@@ -988,7 +994,7 @@ in preventing replay attacks.
988994
Challenge strings provide a different set of security guarantees than [sensitive actions](#412-sensitive-actions)
989995
do. They are not to be used interchangeably.
990996

991-
All challenge strings and their responses created must be made
997+
All key trials and their responses created must be made
992998
public to ensure that a chain of trust can be maintained. A third party should be able to verify that
993999
the challenge string, which authorized a specific change in data, was signed by the
9941000
correct private key. The API routes needed to verify challenges as an outsider are documented in the
@@ -1004,32 +1010,10 @@ correct private key. The API routes needed to verify challenges as an outsider a
10041010
Challenge strings can counteract replay attacks. Their uniqueness ensures that even identical requests
10051011
have different signatures, preventing malicious servers from successfully replaying requests.
10061012

1007-
Accessing a challenge string protected route is done as follows:
1008-
1009-
```mermaid
1010-
sequenceDiagram
1011-
autonumber
1012-
1013-
actor a as Client A
1014-
participant s as Server
1015-
1016-
note over a: Clients have to provide session<br/>token to request challenge string
1017-
a->>s: Request challenge string
1018-
s->>s: Note, that Client A requests challenge<br/>string for given session identified by token
1019-
s->>a: Challenge string
1020-
a->>a: Complete challenge by signing<br/>string with private key associated<br/>with pubkey of this session
1021-
a->>s: Call challenge string protected route with<br/>`X-P2-Challenge-String-Solution` header,<br/>where the value is equal to the challenge string solution
1022-
s->>s: Verify challenge
1023-
alt
1024-
note over s: Challenge string solution is valid
1025-
s->>s: Let Client A perform the challenge string protected action
1026-
else
1027-
note over s: Challenge string solution is invalid
1028-
s->>s: Return 403, indicating that<br/>the challenge string solution is invalid,<br/>with optional RetryAfter header to indicate how<br/>long the client should wait before making a<br/>follow-up request.
1029-
end
1030-
```
1013+
Accessing a key-trial protected route is done by supplying the key trial solution(s) in the `X-P2-core-keytrial`
1014+
HTTP header. The value of this header is a JSON-Array, containing the key-trial solution object or objects.
10311015

1032-
### 4.3 Protection against misuse by malicious home servers
1016+
### 4.4 Protection against misuse by malicious home servers
10331017

10341018
To protect users from misuse by malicious home servers, a mechanism is needed to prevent home
10351019
servers from generating federation tokens for users without their consent and knowledge.

0 commit comments

Comments
 (0)