Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicate object cannot be optional? #374

Open
mihaimaruseac opened this issue Jul 27, 2024 · 0 comments
Open

Predicate object cannot be optional? #374

mihaimaruseac opened this issue Jul 27, 2024 · 0 comments
Labels

Comments

@mihaimaruseac
Copy link

Hello,

I think I may be holding this wrong. In https://github.com/in-toto/attestation/blob/main/spec/v1/predicate.md it is said that the predicate itself can be missing:

plus an optional predicate JSON object containing additional, type-dependent parameters.

However, the Python constructor requires the predicate to be set:

def __init__(self, subjects: list, predicate_type: str, predicate: dict) -> None:

For my (very test-y, WIP-y) use case I don't currently have anything to put in the predicate, so I pass {}.

However, when I then do statement.validate(), it fails to validate due to

if len(self.pb.predicate) == 0:
raise ValueError("Predicate object required")

Should we always have something for the predicate? I was thinking that if I am able to record the subjects and don't have any additional metadata for my custom predicate I should be able to skip having to pass in a predicate object.

Happy to update documentation or code, depending on what is the desired path forward.

@mihaimaruseac mihaimaruseac changed the title Predicate type cannot be optional? Predicate object cannot be optional? Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants