Separate the permission surfaces
How IAM permissions, domain and repository policies, and temporary authorization tokens govern package access for same-account and cross-account build and deployment roles. · advanced
CodeArtifact access is not one permission. A workload uses AWS credentials to obtain an authorization token and discover a repository endpoint. Its package manager then presents the token to read or publish packages. Permission to obtain a token does not, by itself, authorize package access.
Scope each action to the resource it supports. codeartifact:GetAuthorizationToken targets a domain. codeartifact:GetRepositoryEndpoint and codeartifact:ReadFromRepository target a repository. ReadFromRepository cannot be restricted to individual package ARNs; use repository boundaries when readers need different access.
Publishing uses package-level permissions, including codeartifact:PublishPackageVersion. Package formats can require additional actions; Maven publishing also requires codeartifact:PutPackageMetadata. A deployment role that only installs dependencies needs read permissions, not publishing permissions.
| Action | Resource scope | Purpose |
|---|---|---|
| GetAuthorizationToken | Domain ARN | Obtain package credential |
| GetRepositoryEndpoint | Repository ARN | Discover endpoint |
| ReadFromRepository | Repository ARN | Download packages |
| PublishPackageVersion | Package ARN | Publish package versions |