You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.org
+30-7Lines changed: 30 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ The library defines a few core entities:
31
31
- *Strong Security*: The aggregate signature makes the entire token cryptographically tamper-proof. The =Principal= class prevents secret key leakage.
32
32
- *Clean, High-Level API*: The =CapBAC= class provides simple, intuitive methods (=forgeCertificate=, =delegateCertificate=, =invoke=) that handle all the underlying cryptographic complexity.
33
33
- *Flexible Capability Model*: Supports arbitrary permission types through a =CapabilityCodec= interface, allowing you to define simple string-based permissions or complex, structured capabilities.
34
+
- *Attenuation Enforcement*: Capabilities are checked for valid attenuation at both creation time and verification time via the =AttenuationChecker= interface, preventing privilege escalation in delegation chains.
34
35
- *Implicit Revocation Model*: Revocation is handled by removing a =Principal='s public key from the =Resolver=, providing an immediate and simple way to invalidate all tokens signed by that principal.
35
36
36
37
-----
@@ -46,7 +47,18 @@ Here's a complete example of a root entity delegating a permission to an interme
46
47
#+BEGIN_SRC java
47
48
// 1. Setup the environment and Principals
48
49
CapBACScheme scheme = CapBACScheme.MIN_PK;
49
-
CapBAC api = new CapBAC(scheme);
50
+
51
+
// Define how capabilities are decoded from bytes
52
+
CapabilityCodec<StringCapability> codec = new StringCapabilityCodec();
53
+
54
+
// Define the attenuation rule: a child capability must be
The =AttenuationChecker= interface prevents *privilege escalation* in delegation chains. Each delegated or invoked capability must be a valid attenuation (a subset or refinement) of its parent capability. This is enforced in two places:
123
+
124
+
- *At creation time*: =delegateCertificate()= and =invoke()= check the new capability against the parent and throw =IllegalArgumentException= if attenuation is violated.
125
+
- *At verification time*: =verify()= walks the full chain and checks every parent-child capability pair, returning =false= if any step escalates privileges.
126
+
127
+
You define the attenuation rule by implementing =AttenuationChecker=. For example, a prefix-based rule where ="read:/data/file.txt"= is a valid attenuation of ="read"= but ="write"= is not.
128
+
106
129
*** Revocation
107
130
The library uses an *implicit revocation* model. Revocation is handled by the =Resolver= interface. In a production environment, the =Resolver= would be backed by a database or another key store. To revoke a =Principal=, you simply remove their public key from this store. Any subsequent attempt to verify a token signed by that =Principal= will fail because the resolver can no longer provide their public key.
108
131
@@ -129,4 +152,4 @@ The project uses Maven.
129
152
130
153
** Dependencies
131
154
132
-
- [[https://github.com/ConsenSys/jblst][jblst]]: A Java wrapper for the high-performance =blst= BLS signature library.
155
+
- [[https://github.com/supranational/blst][blst]]: A high-performance BLS signature library (vendored with Java bindings).
0 commit comments