Skip to content

Commit de41d02

Browse files
committed
security docs: mention database auth and tweak wording
1 parent c888721 commit de41d02

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/architecture/security.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ While it's referred to as the "public" HTTP port, there is no _need_ to make it
7070

7171
## User-provided code execution
7272

73-
Like Hadoop/Spark clusters, Kubernetes/Nomad clusters, and many other cloud offerings, nimbus nodes run user-provided code in submitted jobs and deployed services. Let's be real: at some level this is remote code execution as a service. However, Nimbus is able to lean on the strengths of the Unison programming language to mitigate the risks of running arbitrary code.
73+
Like Hadoop/Spark clusters, Kubernetes/Nomad clusters, and many other cloud offerings, nimbus nodes run user-provided code in submitted jobs and deployed services. Unison Cloud performs the expected authorization checks like:
74+
75+
- Is this user able to deploy a job/service to this [environment][Environment]?
76+
- Does this user/job/service have access to the requested [config][Environment.Config]/[database][Database]?
77+
78+
And in addition to the standard authorization checks you'd expect of any platform, Unison Cloud is able to lean on the strengths of the Unison programming language to mitigate the risks of running user code. Two Unison features that are especially well-suited to security and cloud computing are [content-addressed code][content-addressed-code] and [code sandboxing][sandboxing].
7479

7580
### Content-addressed code
7681

77-
All code in Unison (and by extension user code submitted to Nimbus) is content-addressed. When a user (or cluster peer) sends a computation to a Nimbus node, they don't say that they want to run `Environment.Config.expect`; they specify that they want to run the function with the hash `01bga3jq5u8ev85lsatbqip9hkrgr4jtr4li520b0r5gpvmi9el30`. If the receiving node already has a definition for `01bga3jq5u8ev85lsatbqip9hkrgr4jtr4li520b0r5gpvmi9el30` then it can proceed with the computation. If it does _not_ know the definition that hashes to `01bga3jq5u8ev85lsatbqip9hkrgr4jtr4li520b0r5gpvmi9el30`, then it will ask for a definition. Upon receiving the requested definition it verifies that the provided code matches the specified hash.
82+
All code in Unison (and by extension user code submitted to Nimbus) is content-addressed. When a user (or cluster peer) sends a computation to a Nimbus node, they don't say that they want to run `Environment.Config.expect`; they specify that they want to run the function with the hash `01bga3jq5u8ev85lsatbqip9hkrgr4jtr4li520b0r5gpvmi9el30`. If the receiving node already has a definition for `01bga3jq5u8ev85lsatbqip9hkrgr4jtr4li520b0r5gpvmi9el30` then it can proceed with the computation. If it does _not_ know the definition that hashes to `01bga3jq5u8ev85lsatbqip9hkrgr4jtr4li520b0r5gpvmi9el30`, then it will ask for a definition. Upon receiving the requested definition it [verifies][validateLinks] that the provided code matches the specified hash.
7883

7984
This unique approach provides significant benefits:
8085

@@ -95,12 +100,19 @@ Cloud.submit Environment.default() do
95100
Luckily, the Unison programming language supports fine-grained code sandboxing. Before Nimbus runs any user-provided code (via job submission, service deployment, etc), it runs the code through [reflection.Value.validateSandboxed][Value.validateSandboxed]. By default it disallows all code that performs IO or uses reflection to dynamically load code/values. By default it does allow a small number of builtins that are tracked as being potential sandbox candidates such as `toDebugText` which returns a textual representation of an arbitrary value (in practice this one is harmless albeit not particularly useful since the Nimbus runtime doesn't have user-provided names for definitions). If you'd like a different set of sandbox rules for your cluster, contact Unison Cloud support, and we can make the sandbox rules configurable.
96101

97102
[architecture]: README.md
103+
[byoc]: https://www.unison.cloud/byoc/
98104
[cloud-client]: https://share.unison-lang.org/@unison/cloud
105+
[content-addressed-code]: #content-addressed-code
99106
[Cloud.deploy]: https://share.unison-lang.org/@unison/cloud/code/releases/21.2.0/latest/terms/Cloud/deploy
107+
[Database]: https://share.unison-lang.org/@unison/cloud/code/releases/21.2.1/latest/types/Database
100108
[developer-authorization]: #user-developer-authorization
109+
[Environment]: https://share.unison-lang.org/@unison/cloud/code/releases/21.2.1/latest/types/Environment
110+
[Environment.Config]: https://share.unison-lang.org/@unison/cloud/code/releases/21.2.1/latest/types/Environment/Config
101111
[envoy]: https://www.envoyproxy.io/
102112
[Value.validateSandboxed]: https://share.unison-lang.org/@unison/base/code/releases/6.5.0/latest/terms/reflection/Value/validateSandboxed
113+
[sandboxing]: #code-sandboxing
103114
[service-auth]: #service-authentication-and-authorization
104115
[Share]: https://share.unison-lang.org/
105116
[share-auth]: https://github.com/unisoncomputing/share-api/tree/main/share-auth
106117
[unison-auth]: https://share.unison-lang.org/@unison/auth
118+
[validateLinks]: https://share.unison-lang.org/@unison/base/code/releases/6.6.1/latest/terms/reflection/Code/validateLinks

0 commit comments

Comments
 (0)