Replies: 3 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
|
Following up on the discussion, I’ve implemented an updated prototype integrating security propagation into New branch ambrishrawat:security_poc Key changes
Example test: |
Beta Was this translation helpful? Give feedback.
-
|
Cool! Looks like we're starting to converge on something. Would you mind opening up a PR against You can mark it as a draft. But now that we're down to implementation vagaries it's far easier to have discussions using the code review tool on PRs than by copy/pasting code blocks into comments on a discussion :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Overall Problem Statement
Some systems co-mingle data of different privilege levels in prompts. This can result in security bugs. The resulting bugs are typically in one of two major classes:
execcall without explicit santitization.Ambrish's PoC
@ambrishrawat is implementing a taint analysis for Mellea programs at ambrishrawat:security_minimal.
He introduces the following mechanisms:
First, a
SecurityLevel: SAFE | TAINTED | PROPRIETARY | SANITIZEDis attached to eachCBlock | Component.Next, he adds a
@privilegeddecorator, which rejects unsafeCBlock. he also adds asanitize : CBlock -> ...function which mutates its input.Finally, he adds
.mark_tainted(level)and.is_safe()to theCBlockclass, both of which modify the CBlock.Here's his example:
He also asks:
Problems with the PoC
Mutation
The PoC mutates
CBlocks.Our goal is for
CBlocks andComponents to be immutable outside of unsafe and highly audited portions of the code-base (primarily backend/inference engine implementations). If we force CBlocks and Components to be immutable, then you need to know the taint "level" at construction-time.The downside of immutability: de-classification becomes a bit of a pain. Creating a new
CBlockwith a lower permission level isn't enough - you have to go through every Component that contains that CBlock.SecurityLevelis too coarse-grainedWhen adding this feature, we might as well include integration is capability systems. If we instead make
SecurityLevelthis type:then we can define various capability schemes, or, more importantly, "plug into" cloud-based IAMs. Using
TaintedByseems like a good idea to me, for reasons I don't have time to elaborate on but are maybe hinted at in the mutation concern.Problems with Mellea
We need to start tracking
parts()again. Ideally this should be automatic. @jakelorocco we should talk about this, because forgetting to add stuff to yourparts()is going to be a footgun moving forward. Ideally we should do this with meta-programming or a superclass constructor.Beta Was this translation helpful? Give feedback.
All reactions