Skip to content

add json and protobuf serialization of some tpe types + fix#922

Merged
victornicolet merged 2 commits intomainfrom
victornicolet/tpe-ffi-lean
Apr 8, 2026
Merged

add json and protobuf serialization of some tpe types + fix#922
victornicolet merged 2 commits intomainfrom
victornicolet/tpe-ffi-lean

Conversation

@victornicolet
Copy link
Copy Markdown
Contributor

This adds some serialization/deserialization utilities for some TPE entities to build the FFI for TPE.isAuthorized.

Also makes a small change in cedar-lean/Cedar/TPE/Input.lean: previously, the entitiesIsValid function would validate all entities in the PartialEntities against only the entity schema. If an action is in the PartialEntities, validation would fail. But the validation also requires the actions to be in partial entities (env.acts.toList.all instanceOfActionSchema and instanceOfActionSchema tries to find the action in the PartialEntities). The Rust side automatically inserts the actions in the partial entities as far as I understand.

…es validation split between entities and actions

Signed-off-by: Victor Nicolet <victornl@amazon.com>
@victornicolet
Copy link
Copy Markdown
Contributor Author

Building cedar-spec-drt will fail until #921 is merged.

@@ -89,6 +94,13 @@ def requestIsValid (env : TypeEnv) (req : PartialRequest) : Bool :=
def entitiesIsValid (env : TypeEnv) (es : PartialEntities) : Bool :=
(es.toList.all entityIsValid) && (env.acts.toList.all instanceOfActionSchema)
where
Copy link
Copy Markdown
Contributor Author

@victornicolet victornicolet Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a fix here that I think is necessary. What I don't understand fully is what kind of pairs of TypeEnv and PartialEntities were valid before, if any. Let me know if I'm missing something

Copy link
Copy Markdown
Contributor

@john-h-kastner-aws john-h-kastner-aws Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be valid as long as the type of every action is declared as an entity type. This is inconsistent with how we normally think about schemas, but it's not really a problem.

See

(
ActionType,
.standard ⟨default, default, default⟩
),

I agree with this fix, but I don't think it will have any consequences for the proofs/algorithms

@victornicolet victornicolet requested a review from lianah April 6, 2026 14:06
@victornicolet victornicolet merged commit 7fb98b8 into main Apr 8, 2026
13 checks passed
@victornicolet victornicolet deleted the victornicolet/tpe-ffi-lean branch April 8, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants