mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
Since SeaweedFS 4.08 the S3 gateways move every identity from /etc/iam/identity.json into /etc/iam/identities/<name>.json, and the COSI driver up to v0.3.1 revokes only from identity.json. Every BucketAccess deleted on such a filer left its identity file behind, with its keys still accepted (seaweedfs/seaweedfs-cosi-driver#11). A driver that deletes the file on revoke does nothing for the files already left. A post-install/post-upgrade hook removes a ba-<uid>.json file when no BucketAccess in any namespace names it, by uid or by status.accountID. The uid covers a BucketAccess still being granted, the accountID one restored with its status. The identity directory is listed before the BucketAccesses: a BucketAccess exists before its grant writes a file, so a file seen in the first listing whose BucketAccess still exists is always named by the second. File ages are not used, because grants and gateway migrations rewrite left-over files as well. A failed or empty listing removes nothing. Each removal is logged and recorded as an Event on the HelmRelease. The hook runs before the Object Lock hook, so in delete mode a left-over identity is removed before that hook grants it anything. A filer published for Client-topology clusters holds identities whose BucketAccesses live in those clusters, so cosi.orphanIdentities defaults to auto: report there, delete otherwise. An operator can force either. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>