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

[FINAL] feat: [EXC-1676] add allowed viewers variant to canister's log visibility #326

Merged
merged 21 commits into from
Nov 1, 2024
Merged
1 change: 1 addition & 0 deletions spec/_attachments/ic.did
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ type wasm_module = blob;

type log_visibility = variant {
controllers;
allowed_viewers : vec principal;
public;
};

Expand Down
15 changes: 13 additions & 2 deletions spec/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2603,7 +2603,12 @@ The canister logs are *not* collected in canister methods running in non-replica
The total size of all returned logs does not exceed 4KiB.
If new logs are added resulting in exceeding the maximum total log size of 4KiB, the oldest logs will be removed.
Logs persist across canister upgrades and they are deleted if the canister is reinstalled or uninstalled.
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).

The log visibility is defined in the `log_visibility` field of `canister_settings` and can be one of the following variants:

- `controllers`: only canister's controllers can fetch logs (by default)
- `allowed_viewers` (`vec principal`): only the provided list of principals can fetch logs, the maximum length of the list is 10
Dfinity-Bjoern marked this conversation as resolved.
Show resolved Hide resolved
- `public`: everyone can fetch logs

A single log is a record with the following fields:

Expand Down Expand Up @@ -3242,6 +3247,7 @@ CanisterHistory = {
}
CanisterLogVisibility
= Controllers
| AllowedViewers [Principal]
| Public
CanisterLog = {
idx : Nat;
Expand Down Expand Up @@ -5878,7 +5884,12 @@ Q.canister_id = ic_principal
Q.method_name = 'fetch_canister_logs'
Q.arg = candid(A)
A.canister_id = effective_canister_id
S[A.canister_id].canister_log_visibility = Public or Q.sender in S[A.canister_id].controllers
S[A.canister_id].canister_log_visibility =
Public
maksymar marked this conversation as resolved.
Show resolved Hide resolved
or
(S[A.canister_id].canister_log_visibility = AllowedViewers Principals and Q.sender in Principals)
Dfinity-Bjoern marked this conversation as resolved.
Show resolved Hide resolved
or
(S[A.canister_id].canister_log_visibility = Controllers and Q.sender in S[A.canister_id].controllers)

```

Expand Down
Loading