Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 2f4aede

Browse files
mraszykTHLO
andauthored
feat: allow anonymous query and read_state requests with invalid ingress_expiry (#343)
* feat: allow anonymous requests with invalid ingress_expiry * allow anonymous queries with invalid ingress expiry * Update spec/index.md Co-authored-by: Thomas Locher <[email protected]> * ambiguity * changelog --------- Co-authored-by: Thomas Locher <[email protected]>
1 parent e477c6a commit 2f4aede

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

spec/_attachments/interface-spec-changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Changelog {#changelog}
22

33
### ∞ (unreleased)
4+
* Allow anonymous query and read state requests with invalid `ingress_expiry`.
45

56
### 0.28.0 (2024-10-11) {#0_28_0}
67
* Add new management canister methods for canister snapshot support.

spec/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ All requests coming in via the HTTPS interface need to be either *anonymous* or
961961

962962
- `nonce` (`blob`, optional): Arbitrary user-provided data of length at most 32 bytes, typically randomly generated. This can be used to create distinct requests with otherwise identical fields.
963963

964-
- `ingress_expiry` (`nat`, required): An upper limit on the validity of the request, expressed in nanoseconds since 1970-01-01 (like [ic0.time()](#system-api-time)). This avoids replay attacks: The IC will not accept requests, or transition requests from status `received` to status `processing`, if their expiry date is in the past. The IC may refuse to accept requests with an ingress expiry date too far in the future. This applies not only to update calls, but all requests alike (and could have been called `request_expiry`).
964+
- `ingress_expiry` (`nat`, required): An upper limit on the validity of the request, expressed in nanoseconds since 1970-01-01 (like [ic0.time()](#system-api-time)). This avoids replay attacks: The IC will not accept requests, or transition requests from status `received` to status `processing`, if their expiry date is in the past. The IC may refuse to accept requests with an ingress expiry date too far in the future. These rules for ingress expiry apply not only to update calls but all requests alike (and could have been called `request_expiry`), except for anonymous `query` and anonymous `read_state` requests for which the IC may accept any provided expiry timestamp.
965965

966966
- `sender` (`Principal`, required): The user who issued the request.
967967

@@ -6285,7 +6285,7 @@ E.content = CanisterQuery Q
62856285
Q.canister_id ∈ verify_envelope(E, Q.sender, S.system_time)
62866286
|Q.nonce| <= 32
62876287
is_effective_canister_id(E.content, ECID)
6288-
S.system_time <= Q.ingress_expiry
6288+
S.system_time <= Q.ingress_expiry or Q.sender = anonymous_id
62896289

62906290
```
62916291

@@ -6347,7 +6347,7 @@ Conditions
63476347
E.content = ReadState RS
63486348
TS = verify_envelope(E, RS.sender, S.system_time)
63496349
|E.content.nonce| <= 32
6350-
S.system_time <= RS.ingress_expiry
6350+
S.system_time <= RS.ingress_expiry or RS.sender = anonymous_id
63516351
∀ path ∈ RS.paths. may_read_path_for_canister(S, R.sender, path)
63526352
∀ (["request_status", Rid] · _) ∈ RS.paths. ∀ R ∈ dom(S.requests). hash_of_map(R) = Rid => R.canister_id ∈ TS
63536353

0 commit comments

Comments
 (0)