kevinhakanson.com

Song lyrics represented using Cedar policy language

May 16, 2023 #cedar #opensource #random

Cedar is an open source policy language and evaluation engine. Cedar enables developers to express fine-grained permissions as easy-to-understand policies enforced in their applications, and decouple access control from application logic.

However, I had some fun with my own version of Name That Tune representing various song lyrics using the Cedar policy language. See this tweet for an example of next level Rickrolling .

Cedar policy

forbid (
    principal == User::"Rick",
    action == Action::"GiveUp",
    resource == User::"You"
);

I’m an 80s rap fan, and took inspiration from Beastie Boys - No Sleep Till Brooklyn (Official Music Video) for my next creation.

forbid (
    principal in Group::"BeastieBoys",
    action == Action::"sleep",
    resource == Location::"Brooklyn"
)
unless { principal.location == resource };

I’ll close this post out with a full stanza from RUN DMC - King Of Rock (Official Video).

I’m the king of rock, there is none higher
Sucker MC’s should call me sire
To burn my kingdom, you must use fire
I won’t stop rockin’ till I retire

forbid (
    principal,
    action == Action::"areHigher",
    resource == User::"KingOfRock"
);

permit (
    principal in Group::"SuckerMCs",
    action == Action::"callSire",
    resource == User::"KingOfRock"
);

forbid (
    principal,
    action == Action::"burnKingdom",
    resource == Kingdom::"KingOfRock"
)
unless { principal.use == "fire" };

forbid (
    principal == User::"KingOfRock",
    action == Action::"stopRockin",
    resource
)
unless { principal.retired == true };

Kevin Hakanson

Multi-Cloud Certified Architect | DevSecOps | AppSec | Web Platform | Speaker | Learner | Builder
Twitter | LinkedIn | GitHub | Stack Overflow | Credly

© 2024 Kevin Hakanson (built with Gatsby)