mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(codeartifact): validate repository updates before mutation (#8083)
Validate the description before replacing stored upstreams so a refused UpdateRepository request leaves the repository unchanged. Cover rejected replacement and clearing requests through the AWS SDK, including successful updates at the accepted description-length boundary. Signed-off-by: Andre Kurait <akurait@amazon.com> Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> Co-authored-by: Andre Kurait <akurait@amazon.com>
This commit is contained in:
1 parent
67814c5d21
commit
a6b5f5e407
4 files changed
+91
-1
No files matched your search
@@ -720,6 +720,7 @@ public class CodeArtifactService implements Resettable {
|
||||
String owner = effectiveOwner(domainOwner);
|
||||
String key = repositoryKey(region, domain, repository);
|
||||
CodeArtifactRepository r = requireRepository(owner, key, repository);
|
||||
validateDescription(description);
|
||||
if (upstreams != null) {
|
||||
if (!upstreams.isEmpty() && !r.getExternalConnections().isEmpty()) {
|
||||
throw conflict("Repository '" + repository + "' has an external connection; "
|
||||
@@ -730,7 +731,6 @@ public class CodeArtifactService implements Resettable {
|
||||
r.setUpstreams(new ArrayList<>(upstreams));
|
||||
}
|
||||
if (description != null) {
|
||||
validateDescription(description);
|
||||
r.setDescription(description);
|
||||
}
|
||||
repositories.putForAccount(owner, key, r);
|
||||
|
||||
Reference in new issue
Block a user