aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/security
diff options
context:
space:
mode:
authorEduardo Julian2021-08-18 03:29:15 -0400
committerEduardo Julian2021-08-18 03:29:15 -0400
commite00ba096c8837abe85d366e0c1293c09dbe84d81 (patch)
treedc1f0955d4461ae30bb4945cddd74c462f1aee98 /stdlib/source/library/lux/control/security
parent3289b9dcf9d5d1c1e5c380e3185065c8fd32535f (diff)
Some bug fixes.
Diffstat (limited to 'stdlib/source/library/lux/control/security')
-rw-r--r--stdlib/source/library/lux/control/security/capability.lux15
-rw-r--r--stdlib/source/library/lux/control/security/policy.lux41
2 files changed, 6 insertions, 50 deletions
diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux
index 3762c6e8f..45b2bd083 100644
--- a/stdlib/source/library/lux/control/security/capability.lux
+++ b/stdlib/source/library/lux/control/security/capability.lux
@@ -25,8 +25,7 @@
["|.|" annotations]]]]])
(abstract: .public (Capability brand input output)
- {#.doc (example "Represents the capability to perform an operation."
- "This operation is assumed to have security implications.")}
+ {}
(-> input output)
@@ -37,7 +36,6 @@
(|>> :abstraction))
(def: .public (use capability input)
- {#.doc (example "Applies a capability against its required input.")}
(All [brand input output]
(-> (Capability brand input output)
input
@@ -50,16 +48,6 @@
|declaration|.parser
(<>.maybe |annotations|.parser)
(<c>.form ($_ <>.and <c>.local_identifier <c>.any <c>.any))))])
- {#.doc (example "Defines a capability as a unique type, and a constructor for instances."
-
- (capability: (Can_Duplicate a)
- (can_duplicate a [a a]))
-
- (let [capability (can_duplicate
- (function (_ value)
- [value value]))
- [left right] (..use capability 123)]
- (same? left right)))}
(do {! meta.monad}
[this_module meta.current_module_name
.let [[name vars] declaration]
@@ -77,7 +65,6 @@
))))
(def: .public (async capability)
- {#.doc (example "Converts a synchronous I/O-based capability into an asynchronous capability.")}
(All [brand input output]
(-> (Capability brand input (IO output))
(Capability brand input (Async output))))
diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux
index ea47056bd..9e33fa86b 100644
--- a/stdlib/source/library/lux/control/security/policy.lux
+++ b/stdlib/source/library/lux/control/security/policy.lux
@@ -9,38 +9,32 @@
abstract]]])
(abstract: .public (Policy brand value label)
- {#.doc (example "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.")}
+ {}
value
(type: .public (Can_Upgrade brand label value)
- {#.doc (example "Represents the capacity to 'upgrade' a value.")}
(-> value (Policy brand value label)))
(type: .public (Can_Downgrade brand label value)
- {#.doc (example "Represents the capacity to 'downgrade' a value.")}
(-> (Policy brand value label) value))
(type: .public (Privilege brand label)
- {#.doc (example "Represents the privilege to both 'upgrade' and 'downgrade' a value.")}
{#can_upgrade (Can_Upgrade brand label)
#can_downgrade (Can_Downgrade brand label)})
(type: .public (Delegation brand from to)
- {#.doc (example "Represents the act of delegating policy capacities.")}
(All [value]
(-> (Policy brand value from)
(Policy brand value to))))
(def: .public (delegation downgrade upgrade)
- {#.doc (example "Delegating policy capacities.")}
(All [brand from to]
(-> (Can_Downgrade brand from) (Can_Upgrade brand to)
(Delegation brand from to)))
(|>> downgrade upgrade))
(type: .public (Context brand scope label)
- {#.doc (example "A computational context with an associated policy privilege.")}
(-> (Privilege brand label)
(scope label)))
@@ -50,27 +44,6 @@
#can_downgrade (|>> :representation)})
(def: .public (with_policy context)
- {#.doc (example "Activates a security context with the priviledge to enforce it's policy."
-
- (type: Password
- (Private Text))
-
- (interface: (Policy %)
- (: (-> Text (Password %))
- password)
- (: (-> (Password %) Text)
- unsafe))
-
- (def: (policy _)
- (Ex [%] (-> Any (Policy %)))
- (with_policy
- (: (Context Privacy Policy)
- (function (_ (^open "%::."))
- (implementation
- (def: (password value)
- (%::can_upgrade value))
- (def: (unsafe password)
- (%::can_downgrade password))))))))}
(All [brand scope]
(Ex [label]
(-> (Context brand scope label)
@@ -104,9 +77,9 @@
(def: join (|>> :representation)))
)
-(template [<brand> <value> <upgrade> <downgrade> <doc>]
+(template [<brand> <value> <upgrade> <downgrade>]
[(abstract: .public <brand>
- {#.doc <doc>}
+ {}
Any
@@ -120,10 +93,6 @@
(Can_Downgrade <brand>))
)]
- [Privacy Private Can_Conceal Can_Reveal
- (example "A security context for privacy."
- "Private data is data which cannot be allowed to leak outside of the programmed.")]
- [Safety Safe Can_Trust Can_Distrust
- (example "A security context for safety."
- "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections.")]
+ [Privacy Private Can_Conceal Can_Reveal]
+ [Safety Safe Can_Trust Can_Distrust]
)