mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
Add GenerateServiceLastAccessedDetails, GetServiceLastAccessedDetails, GetServiceLastAccessedDetailsWithEntities and ListPoliciesGrantingServiceAccess. Floci records no service-access history, but AWS's "never used" shape keeps the report and nulls the usage fields rather than emptying the report, so that is what these reproduce. GetServiceLastAccessedDetails lists every service the entity could reach through its permissions policies and leaves LastAuthenticated and TotalAuthenticatedEntities absent for the ones never used. GetServiceLastAccessedDetailsWithEntities lists the entities that could have used the reported permissions: a group report yields the group's users, a policy report the users and roles it is attached to, and a user or role report that entity. Both lists come from permissions-policy logic, which Floci can evaluate, so both are computed rather than stubbed; the usage timestamps are the only part left out. A report is produced when the job is created and stored with it, matching AWS, where the Get operations retrieve a report that Generate produced. So editing the policies afterwards does not change what a completed job answers, and deleting the entity does not stop a valid JobId resolving. Generate resolves the whole ARN first, rejecting one whose account is not the caller's or whose path is not the resolved entity's, so it cannot fall back to a same-named local identity; AWS-managed policy ARNs carry the literal "aws" account and are allowed through to the global catalog. An unknown JobId is NoSuchEntity, Granularity is validated and echoed back as JobType, and both readers honour MaxItems and Marker. ListPoliciesGrantingServiceAccess needs no job and no usage history, since AWS defines it purely over permissions-policy logic. A user contributes its own managed and inline policies plus those of every group it belongs to, while a group or role contributes only its own; permissions boundaries are excluded. Only Allow grants, and Allow with NotAction grants every service the list does not carve out. It models a Marker but no MaxItems, so only the former is applied. Services reachable only through a wildcard or NotAction cannot be enumerated without a catalog of IAM service namespaces, which is tracked separately in #4487 and documented.