Skip to content

Commit ca459c3

Browse files
committed
docs: closely held vs widely held
1 parent 6e2685c commit ca459c3

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

main/guides/js-programming/hardened-js.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ e.g., only giving the `entryGuard` the ability to increment the counter.
7979

8080
This limits the damage that can happen if there is an exploitable bug.
8181

82+
### Widely Shared vs. Closely Held
83+
84+
#### Widely Shared Resources
85+
86+
In the context of Agoric's object capability model, "widely shared" refers to resources or capabilities that are accessible to a large portion of the code within a system. For example:
87+
88+
- **agoricNames**: This component serves as a read-only name service, which means it can be accessed by most parts of the system. Since it only allows data to be read and not modified, it poses minimal risk and can be safely made widely available.
89+
90+
#### Closely Held Resources
91+
92+
On the other hand, "closely held" resources are restricted and only accessible to specific parts of the system that require them to function effectively:
93+
94+
- **agoricNamesAdmin**: Known as the write facet of the name service, this component allows modifications to the data in `agoricNames`. Given its capability to alter critical system data, access to `agoricNamesAdmin` is limited to only those parts of the system that have a legitimate need for write access. This precaution helps to prevent potential misuse or errors that could compromise the system.
95+
8296
::: tip Watch: Navigating the Attack Surface
8397
to achieve a _multiplicative_ reduction in risk. _15 min_<br />
8498

@@ -322,7 +336,7 @@ const makeCounter = init => {
322336
incr: () => {
323337
value += 1;
324338
return value;
325-
}
339+
},
326340
};
327341
};
328342
```
@@ -388,7 +402,7 @@ const makeMint = () => {
388402
const ledger = makeWeakMap();
389403

390404
const issuer = harden({
391-
makeEmptyPurse: () => mint.makePurse(0)
405+
makeEmptyPurse: () => mint.makePurse(0),
392406
});
393407

394408
const mint = harden({
@@ -406,11 +420,11 @@ const makeMint = () => {
406420
const newPurse = issuer.makeEmptyPurse();
407421
newPurse.deposit(amount, purse);
408422
return newPurse;
409-
}
423+
},
410424
});
411425
ledger.set(purse, initialBalance);
412426
return purse;
413-
}
427+
},
414428
});
415429

416430
return mint;

0 commit comments

Comments
 (0)