@@ -281,8 +281,11 @@ resource SshKey {
281281 relations = { silo_user: SiloUser };
282282
283283 "read" if "read" on "silo_user" ;
284- "modify" if "modify" on "silo_user" ;
285284}
285+ # We want to allow the user to modify the ssh key but disallow a SCIM IdP token
286+ # from doing the same.
287+ has_permission (actor: AuthenticatedActor , "modify" , ssh_key: SshKey )
288+ if actor.is_user and has_permission(actor, "modify" , ssh_key.silo_user);
286289has_relation (user: SiloUser , "silo_user" , ssh_key: SshKey )
287290 if ssh_key.silo_user = user;
288291
@@ -630,6 +633,52 @@ has_relation(silo: Silo, "parent_silo", collection: SiloUserList)
630633has_relation (fleet: Fleet , "parent_fleet" , collection: SiloUserList )
631634 if collection.silo.fleet = fleet;
632635
636+ # Grant SCIM IdP actors the permissions they need on users.
637+ has_permission (actor: AuthenticatedActor , "read" , silo_user: SiloUser )
638+ if actor.is_scim_idp and silo_user.silo in actor.silo;
639+ has_permission (actor: AuthenticatedActor , "create_child" , silo_user_list: SiloUserList )
640+ if actor.is_scim_idp and silo_user_list.silo in actor.silo;
641+ has_permission (actor: AuthenticatedActor , "modify" , silo_user: SiloUser )
642+ if actor.is_scim_idp and silo_user.silo in actor.silo;
643+ has_permission (actor: AuthenticatedActor , "list_children" , silo_user_list: SiloUserList )
644+ if actor.is_scim_idp and silo_user_list.silo in actor.silo;
645+
646+ # Describes the policy for creating and managing Silo groups (mostly intended
647+ # for API-managed groups)
648+ resource SiloGroupList {
649+ permissions = [ "list_children" , "create_child" ];
650+
651+ relations = { parent_silo: Silo , parent_fleet: Fleet };
652+
653+ # Everyone who can read the Silo (which includes all the groups in the
654+ # Silo) can see the groups in it.
655+ "list_children" if "read" on "parent_silo" ;
656+
657+ # Fleet and Silo administrators can manage the Silo's groups. This is
658+ # one of the only areas of Silo configuration that Fleet Administrators
659+ # have permissions on. This is also one of the few cases (so far) where
660+ # we need to look two levels up the hierarchy to see if somebody has the
661+ # right permission. For most other things, permissions cascade down the
662+ # hierarchy so we only need to look at the parent.
663+ "create_child" if "admin" on "parent_silo" ;
664+ "list_children" if "admin" on "parent_fleet" ;
665+ "create_child" if "admin" on "parent_fleet" ;
666+ }
667+ has_relation (silo: Silo , "parent_silo" , collection: SiloGroupList )
668+ if collection.silo = silo;
669+ has_relation (fleet: Fleet , "parent_fleet" , collection: SiloGroupList )
670+ if collection.silo.fleet = fleet;
671+
672+ # Grant SCIM IdP actors the permissions they need on groups.
673+ has_permission (actor: AuthenticatedActor , "read" , silo_group: SiloGroup )
674+ if actor.is_scim_idp and silo_group.silo in actor.silo;
675+ has_permission (actor: AuthenticatedActor , "create_child" , silo_group_list: SiloGroupList )
676+ if actor.is_scim_idp and silo_group_list.silo in actor.silo;
677+ has_permission (actor: AuthenticatedActor , "modify" , silo_group: SiloGroup )
678+ if actor.is_scim_idp and silo_group.silo in actor.silo;
679+ has_permission (actor: AuthenticatedActor , "list_children" , silo_group_list: SiloGroupList )
680+ if actor.is_scim_idp and silo_group_list.silo in actor.silo;
681+
633682# These rules grants the external authenticator role the permissions it needs to
634683# read silo users and modify their sessions. This is necessary for login to
635684# work.
0 commit comments