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

Commit ab2e2d0

Browse files
committed
Merge branch 'master' into tl/deprecate_bitcoin_api
2 parents 2cd44a4 + 9a5077e commit ab2e2d0

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

docusaurus/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/_attachments/ic.did

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type snapshot_id = blob;
55
type log_visibility = variant {
66
controllers;
77
public;
8+
allowed_viewers : vec principal;
89
};
910

1011
type canister_settings = record {

spec/_attachments/interface-spec-changelog.md

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

33
### ∞ (unreleased)
4+
* Allow anonymous query and read state requests with invalid `ingress_expiry`.
5+
* Add allowed viewers variant to canister log visibility.
46

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

spec/index.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,8 @@ It must be contained in the canister ranges of a subnet, otherwise the correspon
931931

932932
- If the call is to the `provisional_create_canister_with_cycles` method, then any principal can be used as the effective canister id for this call.
933933

934+
- If the call is to the `install_chunked_code` method and the `arg` is a Candid-encoded record with a `target_canister` field of type `principal`, then the effective canister id must be that principal.
935+
934936
- Otherwise, if the `arg` is a Candid-encoded record with a `canister_id` field of type `principal`, then the effective canister id must be that principal.
935937

936938
- Otherwise, the call is rejected by the system independently of the effective canister id.
@@ -959,7 +961,7 @@ All requests coming in via the HTTPS interface need to be either *anonymous* or
959961

960962
- `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.
961963

962-
- `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.
963965

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

@@ -2615,7 +2617,12 @@ The canister logs are *not* collected in canister methods running in non-replica
26152617
The total size of all returned logs does not exceed 4KiB.
26162618
If new logs are added resulting in exceeding the maximum total log size of 4KiB, the oldest logs will be removed.
26172619
Logs persist across canister upgrades and they are deleted if the canister is reinstalled or uninstalled.
2618-
The log visibility is defined in the `log_visibility` field of `canister_settings`: logs can be either public (visible to everyone) or only visible to the canister's controllers (by default).
2620+
2621+
The log visibility is defined in the `log_visibility` field of `canister_settings` and can be one of the following variants:
2622+
2623+
- `controllers`: only the canister's controllers can fetch logs (default);
2624+
- `public`: everyone can fetch logs;
2625+
- `allowed_viewers` (`vec principal`): only principals in the provided list and the canister's controllers can fetch logs, the maximum length of the list is 10.
26192626

26202627
A single log is a record with the following fields:
26212628

@@ -3413,6 +3420,7 @@ CanisterHistory = {
34133420
CanisterLogVisibility
34143421
= Controllers
34153422
| Public
3423+
| AllowedViewers [Principal]
34163424
CanisterLog = {
34173425
idx : Nat;
34183426
timestamp_nanos : Nat;
@@ -3650,6 +3658,7 @@ delegation_targets(D)
36503658
A `Request` has an effective canister id according to the rules in [Effective canister id](#http-effective-canister-id):
36513659
```
36523660
is_effective_canister_id(Request {canister_id = ic_principal, method = provisional_create_canister_with_cycles, …}, p)
3661+
is_effective_canister_id(Request {canister_id = ic_principal, method = install_chunked_code, arg = candid({target_canister = p, …}), …}, p)
36533662
is_effective_canister_id(Request {canister_id = ic_principal, arg = candid({canister_id = p, …}), …}, p)
36543663
is_effective_canister_id(Request {canister_id = p, …}, p), if p ≠ ic_principal
36553664
```
@@ -6170,7 +6179,11 @@ Q.canister_id = ic_principal
61706179
Q.method_name = 'fetch_canister_logs'
61716180
Q.arg = candid(A)
61726181
A.canister_id = effective_canister_id
6173-
S[A.canister_id].canister_log_visibility = Public or Q.sender in S[A.canister_id].controllers
6182+
(S[A.canister_id].canister_log_visibility = Public)
6183+
or
6184+
(S[A.canister_id].canister_log_visibility = Controllers and Q.sender in S[A.canister_id].controllers)
6185+
or
6186+
(S[A.canister_id].canister_log_visibility = AllowedViewers Principals and (Q.sender in S[A.canister_id].controllers or Q.sender in Principals))
61746187

61756188
```
61766189

@@ -6308,7 +6321,7 @@ E.content = CanisterQuery Q
63086321
Q.canister_id ∈ verify_envelope(E, Q.sender, S.system_time)
63096322
|Q.nonce| <= 32
63106323
is_effective_canister_id(E.content, ECID)
6311-
S.system_time <= Q.ingress_expiry
6324+
S.system_time <= Q.ingress_expiry or Q.sender = anonymous_id
63126325

63136326
```
63146327

@@ -6370,7 +6383,7 @@ Conditions
63706383
E.content = ReadState RS
63716384
TS = verify_envelope(E, RS.sender, S.system_time)
63726385
|E.content.nonce| <= 32
6373-
S.system_time <= RS.ingress_expiry
6386+
S.system_time <= RS.ingress_expiry or RS.sender = anonymous_id
63746387
∀ path ∈ RS.paths. may_read_path_for_canister(S, R.sender, path)
63756388
∀ (["request_status", Rid] · _) ∈ RS.paths. ∀ R ∈ dom(S.requests). hash_of_map(R) = Rid => R.canister_id ∈ TS
63766389

0 commit comments

Comments
 (0)