An ECR Repository Policy is a resource-based access policy attached to an Amazon Elastic Container Registry repository. It defines which principals can pull, push or manage images, and is evaluated alongside IAM permissions when controlling repository access.
What an ECR repository policy does
An Amazon Elastic Container Registry repository policy is a resource-based policy that sits on the repository itself. It lets you define who can pull images, who can push new images, and who can administer the repository, while still being evaluated alongside IAM permissions. That dual evaluation matters because access is granted only when both the identity-based and repository-based policy paths allow it.
In practical terms, the repository policy is the control point for cross-account or repository-specific access. It is useful when a team needs to share images with another account, delegate publishing rights to a build system, or separate read and write access more tightly than a broad account-level permission would allow.
How repository policies shape access decisions
Because the policy is attached to a specific repository, it follows the asset rather than the principal. That makes it a precise way to express exceptions or partnerships without opening access to every repository in an account. It also means the policy must be read together with IAM, since a principal can still be blocked if either side does not permit the action.
The main actions are straightforward: pull access lets a consumer retrieve images, push access lets a publisher upload or update images, and management access can expose higher-risk operations such as changing repository settings or permissions. The security value comes from limiting each principal to the smallest set of actions needed for its role.
This is why repository policy design is not just an AWS detail, but an access design choice. If the policy is too broad, image tampering, unauthorized publication, or repository misuse become easier. If it is too narrow, automation and deployment pipelines can fail in ways that are hard to diagnose unless policy evaluation is understood end to end.
Common access patterns and when they are used
Repository policies are commonly used for controlled image sharing across accounts, for example when a central build account publishes trusted images to application accounts. They are also used when a downstream environment needs read-only access to a curated image repository without receiving unrelated permissions in the source account.
Another common pattern is separating build and deploy responsibilities. A CI system may need push permission, while runtime systems or developers only need pull permission. That separation reduces the blast radius if a token, role, or automation credential is misused.
In mature environments, repository policies are paired with naming conventions, image provenance checks, and logging so that access decisions are not only correct but also explainable. The policy itself is only one layer, but it is the layer that tells ECR which principals are allowed to act on that repository object.
Why repository policies become security-sensitive
An ECR repository policy becomes sensitive when it governs shared build output or production deployment images, because compromise at the repository layer can affect what software is distributed. A permissive policy can expose the repository to unintended writes, stale trust relationships, or overly broad read access that makes image leakage easier.
For a deeper treatment of repository-level controls, cross-account image sharing, and related ECR safeguards, see AWS CodeArtifact Security, which covers the same policy pattern across repository-style access control.
Authoritative reference points for access design are the NIST SP 800-53 Rev 5 Security and Privacy Controls and the NIST Cybersecurity Framework 2.0, both of which reinforce least privilege, access governance, and monitoring discipline around sensitive resources.
Risk and Threat Considerations
Repository policies matter because they can turn a single registry into a shared software distribution point. If write access is broader than intended, an attacker or mistaken operator can replace trusted images, publish malicious ones, or expand access from one account into many downstream environments.
Failure mechanism: The policy allows principals to act on the repository even when the surrounding IAM design is too permissive, stale, or misunderstood, so access control breaks at the point where software artifacts are stored and distributed.
Impact: Unauthorized image publication, image tampering, and overexposure of internal artifacts can lead to deployment of untrusted code, leakage of private images, and compromise of build or runtime trust.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | AC-3 — Access Enforcement | Repository policies enforce who can pull, push, or manage the ECR repository. |
| AC-6 — Least Privilege | The term centers on limiting repository actions to the minimum necessary principals. | |
| AU-2 — Event Logging | Repository access decisions should be auditable for image pull, push, and admin activity. | |
| Recommendation — Enforce repository-specific allow rules that only grant the minimum required ECR actions. Restrict ECR repository permissions to the smallest set of principals and actions needed. Log repository policy and image access events so unusual registry use can be investigated. | ||
| NIST CSF 2.0 | PR.AA-01 — Identities and Credentials | Repository access depends on authenticated principals and their granted permissions. |
| PR.AA-05 — Least Privilege | Repository policy design is an access-minimisation problem at the resource layer. | |
| Recommendation — Bind ECR repository access to managed identities and credentials with explicit authorization. Apply least-privilege authorization to ECR repository pull, push, and management rights. | ||
Practitioner Guidance
Governance implication: Treat repository policy changes as part of application delivery governance, not as a routine registry tweak. The policy should reflect who is allowed to publish, who is only allowed to consume, and which cross-account relationships are genuinely required.
What to watch for: Review any statement that grants broad principal access, especially when it combines repository permissions with wildcard actions or cross-account sharing. The safest policy is the one that maps cleanly to a known build, release, or consumption workflow.
Practitioner takeaway: Use the repository policy to express narrow, repository-specific access, then validate it against the IAM side of the authorization decision so the effective access path is intentional rather than accidental.
Related resources from NHI Mgmt Group
- How do security teams know if agent-driven repository access is operating outside policy?
- What should teams do when repository policy conflicts with developer speed?
- Why do security programs need centralized policy with repository-level flexibility in CI/CD?
- What are the signs that a Kubernetes repository allow-list policy is failing?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 9, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org