mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
Adds ListPackageVersionDependencies, extracted from each format's own metadata
file: the POM for Maven, package.json for npm, the wheel/sdist metadata for
pypi, and the .nuspec for NuGet. Scoped to exactly npm/pypi/maven/nuget,
matching AWS's own documented Valid Values for this action's format
parameter; generic, cargo, ruby, and swift are rejected with a
ValidationException even though cargo's own sparse index already carries the
data, since AWS does not document cargo as a valid format for this specific
action.
A new RepositorySidecarManager#listPackageVersionDependencies default method
(throwing UnsupportedOperationException, the same convention
listPackageVersionAssetNames already uses) is overridden by all four valid
formats' sidecar clients:
- ReposiliteSidecarClient tries the version's standard release POM name
first, falling back to the real directory listing for a -SNAPSHOT
version's own timestamped filename (and surfacing a genuine fetch error
through that same fallback, rather than reporting it as an empty
dependency list), and parses it with a new PomDependencies helper. That
helper only ever walks direct children of a known element rather than
Document#getElementsByTagName, specifically so a managed version pin under
dependencyManagement or a conditionally-activated dependency under profiles
is never mistaken for a real, always-active dependency. One synthetic
"parent"-typed entry is emitted when <parent> is present. No ${property}
placeholder resolution on a dependency's raw version text, a documented
limitation.
- VerdaccioSidecarClient reads dependencies/devDependencies/
peerDependencies/optionalDependencies straight off the already-fetched
packument's version document, splitting a scoped dependency name the same
way CodeArtifactNpmDataPlane already does for the package's own name.
- BagetterSidecarClient reuses the same already-proven .nuspec fetch
fetchPackageVersionReadme falls back to, with NuspecXml extended with a new
dependencies() method that flattens every <group targetFramework> block
(and the older schema's bare <dependency> with no group wrapper) into one
list.
- PypiserverSidecarClient is new ground: a new PypiVersionMetadata helper
opens a real wheel via plain ZipInputStream, or an sdist via GZIPInputStream
plus a new minimal hand-rolled TAR reader (classic 512-byte headers only,
no long-name or PAX support) for .tar.gz/.tgz, or via ZipInputStream for a
.zip sdist, bounding the total bytes it will ever decompress while
scanning one archive so a small, highly compressible entry ahead of the
real metadata entry cannot force unbounded decompression. Only the exact
top-level dist-info/METADATA or PKG-INFO entry is matched, never a nested
one, so a wheel or sdist that vendors another package's own dist-info
alongside its own cannot have that vendored entry mistaken for the real
one. Requires-Dist headers are parsed with RFC822 continuation-line
folding, stopping at the blank line that ends the real header block so a
Requires-Dist-looking line inside the package's own long description is
never read as a real dependency. Any "; extra == ..." environment marker
is kept verbatim in versionRequirement rather than stripped, since
PackageDependency has no marker field. A release available only as a real
.tar.bz2/.tar.xz sdist is reported as having no dependencies rather than
attempted, since bzip2/xz decompression would need a new runtime
dependency this codebase deliberately avoids.
XmlParser gained a new parseDocument(byte[]) overload so a POM or .nuspec's
own raw bytes reach the parser directly: the existing String-based overload
pre-decodes as UTF-8 before the parser ever sees the original bytes, which
would silently corrupt or fail to parse a document that declares a different
encoding. PomDependencies and NuspecXml both now go through the byte-based
overload.
CodeArtifactService#listPackageVersionDependencies validates the format
against this narrower set before the shared validatePackageCoordinates call,
which already enforces the maven-namespace-required and
pypi/nuget-namespace-forbidden rules AWS documents for this action.
Pagination's cursor now folds in each entry's own original-list index as a
final tiebreaker, so two byte-for-byte identical dependencies (e.g. the same
NuGet package id declared under two different target-framework groups with
the same version requirement) never share a cursor and silently drop across
a page boundary.
Verified with standalone parser unit tests, per-client wire-contract tests
against a JDK HttpServer fake, CodeArtifactServiceTest dispatch and
validation cases, and a live Docker-gated round trip added to all four
existing format Docker integration tests, each publishing a real artifact
with real dependency metadata through the real sidecar container.
659 lines
57 KiB
Markdown
659 lines
57 KiB
Markdown
# CodeArtifact
|
|
|
|
**Protocol:** REST JSON
|
|
|
|
**Endpoint:** `http://localhost:4566`
|
|
|
|
Floci supports the CodeArtifact control plane: domains, repositories, resource policies, tags,
|
|
and public upstream (external) connections. Package publish/fetch through the CodeArtifact API
|
|
itself is implemented for the `generic` format only, matching AWS's own restriction that
|
|
`PublishPackageVersion` accepts only `generic`. The `maven`, `npm`, `pypi`, `nuget`, and `cargo`
|
|
formats are each served through their own real package-manager-protocol proxy (`mvn`/Gradle,
|
|
`npm`/`yarn`/`pnpm`, `pip`/`twine`, `nuget`/`dotnet`, and `cargo` publish and resolve all work
|
|
against the URL `GetRepositoryEndpoint` returns); the remaining formats (Ruby, Swift) have no real
|
|
proxy behind them yet.
|
|
|
|
## Supported Actions
|
|
|
|
<!-- floci:actions:start -->
|
|
| Action | Description |
|
|
| --- | --- |
|
|
| `CreateDomain` | Creates a domain (max 10 per account per Region), optionally with a KMS encryption key and initial tags, and its root package group `/*`, whose restrictions are all `ALLOW`. |
|
|
| `DeleteDomain` | Deletes a domain; fails with `ConflictException` while it still contains repositories, and with `ResourceNotFoundException` for a missing domain (as AWS does, although the API reference does not list it). |
|
|
| `DescribeDomain` | Returns a domain's full description, including its repository count and the total size of its assets (generic, Maven, npm, pypi, NuGet, and Cargo; see Known limitations). |
|
|
| `ListDomains` | Lists domain summaries for the account and Region, paginated. |
|
|
| `GetAuthorizationToken` | Issues a bearer token scoped to a domain, valid for 0 (12 hours) or 900-43200 seconds, required by the `maven`, `npm`, `pypi`, `nuget`, and `cargo` repository endpoints. |
|
|
| `PutDomainPermissionsPolicy` | Attaches or replaces a domain's resource policy, versioned by `policyRevision`. |
|
|
| `GetDomainPermissionsPolicy` | Returns a domain's current resource policy and revision. |
|
|
| `DeleteDomainPermissionsPolicy` | Removes a domain's resource policy, optionally checked against `policyRevision`. |
|
|
| `CreateRepository` | Creates a repository (max 1,000 per domain) with optional description, upstreams (max 10), and tags. |
|
|
| `DeleteRepository` | Deletes a repository. |
|
|
| `DescribeRepository` | Returns a repository's full description, including upstreams and external connections. |
|
|
| `UpdateRepository` | Updates a repository's description and/or upstream list. |
|
|
| `ListRepositories` | Lists repository summaries across all domains, optionally filtered by name prefix. |
|
|
| `ListRepositoriesInDomain` | Lists repository summaries within one domain, optionally filtered by name prefix. |
|
|
| `GetRepositoryEndpoint` | Returns the package-format-specific endpoint URL for a repository. |
|
|
| `PutRepositoryPermissionsPolicy` | Attaches or replaces a repository's resource policy, versioned by `policyRevision`. |
|
|
| `GetRepositoryPermissionsPolicy` | Returns a repository's current resource policy and revision. |
|
|
| `DeleteRepositoryPermissionsPolicy` | Removes a repository's resource policy, optionally checked against `policyRevision`. |
|
|
| `AssociateExternalConnection` | Attaches a fixed-catalog public upstream (e.g. `public:npmjs`) to a repository; mutually exclusive with repository upstreams. |
|
|
| `DisassociateExternalConnection` | Removes a repository's external connection. |
|
|
| `PublishPackageVersion` | Uploads a generic-format asset, creating or extending a package version; requires `x-amz-content-sha256` and verifies it against the real hash of the bytes received. |
|
|
| `DescribePackage` | Returns a package's format, namespace, name, and origin controls (`publish` and `upstream` restrictions). |
|
|
| `DeletePackage` | Deletes a package and every one of its versions; `ResourceNotFoundException` for one that does not exist. |
|
|
| `PutPackageOriginConfiguration` | Sets a package's `publish`/`upstream` origin-control restrictions; can create the package (with no versions) if it doesn't exist yet. |
|
|
| `DescribePackageVersion` | Returns a package version's status, revision, and origin. |
|
|
| `GetPackageVersionAsset` | Downloads one asset from a package version by name, optionally pinned to a specific revision. |
|
|
| `ListPackageVersionAssets` | Lists the assets of a package version, with size and hashes. |
|
|
| `ListPackageVersionDependencies` | Lists a package version's direct dependencies, extracted from that format's own metadata file (the POM for Maven, `package.json` for npm, the wheel/sdist metadata for pypi, the `.nuspec` for NuGet); `npm`, `pypi`, `maven`, and `nuget` only, matching AWS's own restriction for this action (`generic`, `cargo`, `ruby`, and `swift` are all rejected, even though Cargo's own sparse index already carries the data). Maven requires a `namespace` (groupId); pypi and NuGet reject one. A dependency's raw `${property}` placeholder in a Maven version is returned as-is, never resolved; a NuGet dependency declared under more than one `<group targetFramework>` is returned once per group, so the same package id can legitimately appear more than once with a different version. |
|
|
| `ListPackageVersions` | Lists a package's versions with status, revision, and origin, paginated and sorted most recently published first; `defaultDisplayVersion` is `dist-tags.latest` for npm, the most recently published version otherwise. |
|
|
| `ListPackages` | Lists package names across every format in a repository, with each package's origin controls; paginated, optionally filtered by format, namespace prefix, package-name prefix, or publish/upstream restriction. |
|
|
| `GetPackageVersionReadme` | Returns the readme text for a package version; `npm`, `pypi`, and `nuget` only, matching AWS's own restriction for this action. |
|
|
| `CopyPackageVersions` | Copies one or more versions of a package from one repository to another in the same domain. |
|
|
| `UpdatePackageVersionsStatus` | Moves one or more versions of a package to `Published`, `Unlisted`, or `Archived`; all-or-nothing per call, with `versionRevisions`/`expectedStatus` as optional preconditions. |
|
|
| `DisposePackageVersions` | Permanently deletes a package version's assets and sets its status to `Disposed`; irreversible, and shares `UpdatePackageVersionsStatus`'s all-or-nothing batch semantics. |
|
|
| `DeletePackageVersions` | Permanently removes one or more versions of a package, real assets included; unlike `DisposePackageVersions`, leaves no trace, the freed coordinates can be freely republished, and it is the one action allowed on an already-`Disposed` version. |
|
|
| `CreatePackageGroup` | Creates a package group from a pattern (its own identifier); every restriction type starts at `INHERIT`. The root group `/*` exists from the domain's creation, so it cannot be created again. |
|
|
| `DeletePackageGroup` | Deletes a package group; its direct children reparent onto its own parent, recomputed from the remaining groups. The root group `/*` cannot be deleted (`ValidationException`). |
|
|
| `DescribePackageGroup` | Returns a package group's pattern, origin configuration (stored and resolved effective mode per restriction type), and parent. |
|
|
| `UpdatePackageGroup` | Updates a package group's `contactInfo`/`description`; the pattern and restrictions are unchanged. |
|
|
| `UpdatePackageGroupOriginConfiguration` | Sets a package group's per-restriction-type mode and/or edits its `ALLOW_SPECIFIC_REPOSITORIES` allow-list. |
|
|
| `ListPackageGroups` | Lists package group summaries in a domain, optionally filtered by pattern prefix, paginated. |
|
|
| `ListSubPackageGroups` | Lists a package group's direct children only (not grandchildren), per the hierarchy computed from the domain's current groups. |
|
|
| `ListAllowedRepositoriesForGroup` | Lists the repositories a package group's `ALLOW_SPECIFIC_REPOSITORIES` allow-list names for one restriction type. |
|
|
| `ListAssociatedPackages` | Lists the packages (across every repository in the domain) for which this group is the most specific match; `preview` answers the same question for a pattern that doesn't exist yet. |
|
|
| `GetAssociatedPackageGroup` | Returns the most specific package group matching a package's coordinate, and whether the match is `STRONG` or `WEAK`; the root group `/*` when no other group's pattern reaches it. |
|
|
| `TagResource` | Adds or updates tags on a domain, repository, or package group ARN. |
|
|
| `UntagResource` | Removes tags by key from a domain, repository, or package group ARN. |
|
|
| `ListTagsForResource` | Lists the tags on a domain, repository, or package group ARN. |
|
|
<!-- floci:actions:end -->
|
|
|
|
Domains and repositories are account and Region scoped and persisted through `StorageFactory`.
|
|
`DeleteDomain` fails with `ConflictException` while the domain still contains repositories, matching
|
|
AWS. `PutDomainPermissionsPolicy`/`PutRepositoryPermissionsPolicy` use the returned `policyRevision`
|
|
for optimistic locking on subsequent updates, also matching AWS. Floci enforces AWS's own account
|
|
and domain quotas: `CreateDomain` caps a single account at 10 domains per Region, and
|
|
`CreateRepository` caps a single domain at 1,000 repositories, both returning
|
|
`ServiceQuotaExceededException` with the offending `resourceId`/`resourceType` once reached.
|
|
|
|
`AssociateExternalConnection` accepts the same fixed set of AWS-hosted public upstreams
|
|
documented for real CodeArtifact (`public:npmjs`, `public:pypi`, `public:maven-central`, etc.) and
|
|
enforces the one-external-connection-per-repository limit AWS enforces. A repository can have
|
|
upstream repositories or an external connection, but not both, matching AWS; `CreateRepository`
|
|
and `UpdateRepository` also cap direct upstreams at 10, AWS's own repository limit.
|
|
|
|
For the Maven format specifically, an external connection is more than stored metadata: a real
|
|
`mvn`/Gradle GET or HEAD miss on a repository with one of the 5 Maven external connections
|
|
attached (`public:maven-central`, `public:maven-clojars`, `public:maven-commonsware`,
|
|
`public:maven-googleandroid`, `public:maven-gradleplugins`) is retried against the real public
|
|
repository and, if found, retained into the repository exactly as a real CodeArtifact repository
|
|
would, with the same AWS-documented rules a real one applies: release versions only (AWS never imports a Maven SNAPSHOT through an external
|
|
connection), the standard `.pom`/`.jar`/`-javadoc.jar`/`-sources.jar` set imported together on a
|
|
standard-named request, a non-standard asset name imported individually and only on demand, a
|
|
retained version's own origin checked against any later asset request for the same version
|
|
(rejecting one that would mix in a different connection's bytes), and a direct `mvn deploy` of a
|
|
version already present in the connection rejected with `ConflictException`. npm's own
|
|
`public:npmjs` external connection, NuGet's own `public:nuget-org` one, and pypi's own
|
|
`public:pypi` one all resolve the same way, each against its own format's one real public
|
|
connection and documented rules; see their own repository endpoint sections and the
|
|
known-limitations entry below for exactly how. A repository-to-repository `upstreams` chain
|
|
resolves the same way too, for every format including Maven, reusing the same mechanism against
|
|
another repository in the domain instead of a real public registry; see the known-limitations
|
|
entry below for the real behavioral differences (Archived/Disposed propagation, and a candidate
|
|
upstream's own real content only, not its own external connection).
|
|
|
|
`PublishPackageVersion` creates a package version in the `Unfinished` state when the `unfinished`
|
|
flag is set, and `Published` otherwise. While still `Unfinished`, publishing a new asset name is
|
|
always accepted; once `Published`, a new asset name always conflicts, since real CodeArtifact never
|
|
lets a `Published` generic version grow beyond the assets it already has. Republishing an asset name
|
|
that already exists is only accepted when the content is byte-identical to what's already stored
|
|
(AWS's own "Overwriting package assets" rule: idempotent on a matching retry, `ConflictException` on
|
|
genuinely different content), and that rule applies the same way regardless of the version's status,
|
|
since a client is just as likely to retry the terminal publish call (the one that leaves a version
|
|
`Published`) as any earlier one. The comparison itself is against each asset's persisted SHA-256,
|
|
not its raw bytes, so deciding whether content matches costs no disk read and needs no special case
|
|
for a backing file that happens to be missing (e.g. a partial restore); each asset's hashes (`MD5`,
|
|
`SHA-1`, `SHA-256`, `SHA-512`) are computed from the bytes Floci actually received, not echoed from
|
|
the request. An idempotent retry still separately verifies the backing file's actual bytes (streamed
|
|
in fixed-size chunks, not loaded whole) before deciding there's nothing to do: an intact file stays
|
|
a true no-op needing no write capacity at all, while a file that's missing or has been corrupted
|
|
independently of Floci gets rewritten, so that kind of gap doesn't survive indefinitely just because
|
|
its recorded checksum still matched. A publish that adds or changes something returns a fresh
|
|
`versionRevision`; an idempotent no-op retry returns the version's existing one unchanged. Floci
|
|
enforces AWS's own published quotas for this action: a 5 GB max asset file size and a 350-asset cap
|
|
per package version, both returning
|
|
`ServiceQuotaExceededException`.
|
|
|
|
## The Maven repository endpoint
|
|
|
|
`GetRepositoryEndpoint` for `format=maven` returns `http://localhost:4566/codeartifact/maven/<domain>/<repository>/`.
|
|
Real Maven clients (`mvn deploy`, `mvn dependency:get`, Gradle) can publish to and resolve from
|
|
that URL directly, the same way they would against real AWS CodeArtifact; it speaks the raw Maven
|
|
repository layout (GET/PUT/HEAD over a group/artifact/version path), not the CodeArtifact JSON API.
|
|
Every request needs a token from `GetAuthorizationToken` scoped to the domain being accessed,
|
|
either as `Authorization: Bearer <token>` or as HTTP Basic with the token as the password (the
|
|
username is ignored). Basic is what a real `settings.xml`, configured the way
|
|
[AWS documents for `mvn`](https://docs.aws.amazon.com/codeartifact/latest/ug/maven-mvn.html)
|
|
(`<server><username>aws</username><password>${env.CODEARTIFACT_AUTH_TOKEN}</password></server>`),
|
|
actually sends: Maven's HTTP wagon authenticates with Basic, not a custom header. A missing,
|
|
invalid, expired, or wrong-domain token gets a 401 challenging `Basic`.
|
|
|
|
It is backed by a shared [Reposilite](https://reposilite.com) container that Floci starts lazily
|
|
on first use and reuses for every CodeArtifact repository; a CodeArtifact repository maps to its
|
|
own Reposilite repository, provisioned automatically the first time it is published to or fetched
|
|
from, and identified internally by a fresh id generated at `CreateRepository` time rather than a
|
|
name derived from the domain/repository, so a repository deleted and recreated under the same name
|
|
never inherits the previous one's artifacts. `DeleteRepository` also releases that storage:
|
|
Reposilite has no bulk-delete endpoint, so this deletes each of the repository's top-level entries
|
|
(DELETE recursively removes everything under a path in one call) before removing it from the
|
|
shared settings list. Two config knobs,
|
|
`FLOCI_SERVICES_CODEARTIFACT_MAVEN_IMAGE` and `FLOCI_SERVICES_CODEARTIFACT_MAVEN_URL`, pin the
|
|
image version or point at an already-running instance and skip container management, matching the
|
|
pattern used elsewhere in Floci for sidecars.
|
|
|
|
Each Reposilite repository is provisioned with `redeployment: false`, so redeploying an existing
|
|
GAV path with different content is rejected with a real `409`, matching AWS's documented asset
|
|
immutability. Reposilite's own setting has no content-aware mode, though, and would reject a
|
|
byte-identical redeploy too; Floci fetches the existing artifact first and short-circuits to `200`
|
|
on an exact match, matching AWS's own documented exception ("Overwriting package assets" in
|
|
CodeArtifact's packages overview) that a republish is idempotent when the content hasn't actually
|
|
changed.
|
|
|
|
## The npm repository endpoint
|
|
|
|
`GetRepositoryEndpoint` for `format=npm` returns `http://localhost:4566/codeartifact/npm/<domain>/<repository>/`.
|
|
Real npm clients (`npm publish`, `npm install`, and their `yarn`/`pnpm` equivalents) can publish to
|
|
and resolve from that URL directly; it speaks the real npm registry protocol (package metadata,
|
|
tarball fetch, publish), proxied straight through to a real [Verdaccio](https://verdaccio.org)
|
|
instance rather than reimplemented. Every request needs `Authorization: Bearer <token>`, using a
|
|
token from `GetAuthorizationToken` scoped to the domain being accessed; npm's own credential
|
|
configuration (`.npmrc`'s `//<registry-host>/<path>/:_authToken=...`) sets this the same way it
|
|
would against real AWS, and always as Bearer (unlike Maven's HTTP Basic). A missing, invalid,
|
|
expired, or wrong-domain token gets a 401 challenging `Bearer`.
|
|
|
|
Unlike Reposilite, which has a native concept of multiple named repositories inside one instance,
|
|
Verdaccio does not: each CodeArtifact repository gets its own Verdaccio container instead of
|
|
sharing one, started lazily on first use and identified internally by a fresh id generated at
|
|
`CreateRepository` time, so a repository deleted and recreated under the same name never inherits
|
|
the previous one's packages. `DeleteRepository` stops and removes that repository's container
|
|
immediately (the Maven proxy releases its own storage the same way, just through Reposilite's
|
|
settings API instead of a container stop, since Reposilite is one shared instance). Each container is
|
|
started with `VERDACCIO_PUBLIC_URL` set to that repository's own proxy URL, so package metadata it
|
|
returns (`dist.tarball`) points back through Floci instead of the container's own internal,
|
|
client-unreachable address; without this, `npm install` would try to fetch the tarball directly
|
|
from an address it cannot reach. One config knob, `FLOCI_SERVICES_CODEARTIFACT_NPM_IMAGE`, pins
|
|
the image version.
|
|
|
|
## The pypi repository endpoint
|
|
|
|
`GetRepositoryEndpoint` for `format=pypi` returns `http://localhost:4566/codeartifact/pypi/<domain>/<repository>/`.
|
|
Real pip and twine can install from and publish to that URL directly; it speaks the real PyPI
|
|
simple-repository protocol (simple index, package download, twine's multipart upload), proxied
|
|
straight through to a real [pypiserver](https://pypi.org/project/pypiserver/) instance rather than
|
|
reimplemented. Every request needs a token from `GetAuthorizationToken` scoped to the domain being
|
|
accessed, sent as HTTP Basic with the token as the password (any username) - AWS documents `pip`'s
|
|
index URL embedding `aws:$CODEARTIFACT_AUTH_TOKEN@` and twine's `.pypirc`/environment variables as
|
|
`username=aws, password=<token>`
|
|
([configure pip](https://docs.aws.amazon.com/codeartifact/latest/ug/python-configure-pip.html),
|
|
[configure twine](https://docs.aws.amazon.com/codeartifact/latest/ug/python-configure-twine.html)),
|
|
the same Basic convention Maven's HTTP wagon uses, not npm's Bearer-only `_authToken`; a Bearer
|
|
token is also accepted, matching npm, since accepting both costs nothing. A missing, invalid,
|
|
expired, or wrong-domain token gets a 401 challenging `Basic`.
|
|
|
|
Like Verdaccio, pypiserver has no native concept of multiple named indexes inside one instance, so
|
|
each CodeArtifact repository gets its own pypiserver container instead of sharing one, started
|
|
lazily on first use and identified internally by a fresh id generated at `CreateRepository` time,
|
|
so a repository deleted and recreated under the same name never inherits the previous one's
|
|
packages. `DeleteRepository` stops and removes that repository's container immediately, the same
|
|
as npm. Unlike Verdaccio, no public-URL environment variable is needed: pypiserver's simple-index
|
|
responses link to package files with a root-relative path (`/packages/<file>`), which pip and
|
|
twine resolve against whatever host they actually connected to, not an address the container
|
|
returns itself.
|
|
|
|
Unlike Reposilite (`redeployment: false`) and Verdaccio (which rejects a duplicate publish
|
|
natively, matching real npm), pypiserver has no overwrite protection of its own: publishing the
|
|
same package name, version, and filename twice with different content silently replaces the file
|
|
(confirmed by hand against a live instance with both twine and a raw multipart upload). Floci's
|
|
proxy closes this gap itself, matching AWS's own documented behavior for every format
|
|
("Overwriting package assets" in CodeArtifact's packages overview): before forwarding an upload, it
|
|
checks the target repository's own simple index for the exact filename being uploaded; if the
|
|
filename doesn't exist yet, the upload proceeds, if it exists with byte-identical content the
|
|
upload succeeds without touching pypiserver again (idempotent, so a client's retry after a dropped
|
|
response is never a spurious conflict), and only a name collision with genuinely different content
|
|
gets rejected with 409. One config knob, `FLOCI_SERVICES_CODEARTIFACT_PYPI_IMAGE`, pins the image
|
|
version.
|
|
|
|
## The nuget repository endpoint
|
|
|
|
`GetRepositoryEndpoint` for `format=nuget` returns `http://localhost:4566/codeartifact/nuget/<domain>/<repository>/`.
|
|
Real `nuget`/`dotnet` clients can publish to and resolve from that URL once `v3/index.json` is
|
|
appended to it, AWS's own documented requirement ("The source URL must end in /v3/index.json");
|
|
Floci authors that index itself rather than proxying one from the backing
|
|
[BaGetter](https://github.com/bagetter/bagetter) container, advertising only the `PackageBaseAddress/
|
|
3.0.0` (install) and `PackagePublish/2.0.0` (push) resources BaGetter's own flat container and
|
|
publish endpoints implement. Every request needs a token from `GetAuthorizationToken` scoped to
|
|
the domain being accessed, sent as HTTP Basic with the token as the password (any username),
|
|
the way AWS's own NuGet CLI configuration doc has the client authenticate
|
|
([configure the nuget or dotnet CLI](https://docs.aws.amazon.com/codeartifact/latest/ug/nuget-cli.html)),
|
|
the same Basic convention Maven's HTTP wagon and pip/twine use; a Bearer token is also accepted,
|
|
matching npm. A missing, invalid, expired, or wrong-domain token gets a 401 challenging `Basic`.
|
|
|
|
Like Verdaccio and pypiserver, BaGetter has no native concept of multiple named feeds inside one
|
|
instance, so each CodeArtifact repository gets its own BaGetter container instead of sharing one,
|
|
started lazily on first use and identified internally by a fresh id generated at
|
|
`CreateRepository` time, so a repository deleted and recreated under the same name never inherits
|
|
the previous one's packages. `DeleteRepository` stops and removes that repository's container
|
|
immediately, the same as npm and pypi.
|
|
|
|
A `nuget push`/`dotnet nuget push` has no separate `name`/`version` form field the way twine's
|
|
upload does; Floci reads both from the uploaded `.nupkg`'s own embedded `.nuspec` manifest (a
|
|
`.nupkg` is a plain ZIP, parsed with the JDK's own `java.util.zip`, matching the same no-new-
|
|
dependency approach already used elsewhere here). BaGetter's own `AllowPackageOverwrites: false`
|
|
default rejects even a byte-identical re-push, so Floci's proxy applies the same idempotent-retry
|
|
check as the pypi proxy: a re-push with content identical to what BaGetter already holds succeeds
|
|
without forwarding anything, and only a genuine content mismatch is rejected with `409`. One
|
|
config knob, `FLOCI_SERVICES_CODEARTIFACT_NUGET_IMAGE`, pins the image version.
|
|
|
|
`GetPackageVersionReadme` for `nuget` is answered live against the BaGetter container rather than
|
|
from a captured record: BaGetter keeps every version's own embedded readme file (if its nuspec
|
|
declared one with `<readme>`) addressable by exact version for as long as that version exists,
|
|
falling back to the nuspec's own `<description>` field when no readme file was embedded, matching
|
|
AWS's documented "the readme file or descriptive text" wording for this action exactly.
|
|
|
|
## The cargo repository endpoint
|
|
|
|
`GetRepositoryEndpoint` for `format=cargo` returns `http://localhost:4566/codeartifact/cargo/<domain>/<repository>/`.
|
|
A real `cargo` client reaches it through a `.cargo/config.toml` `[registries.<name>]` block whose
|
|
`index` is `sparse+<that URL>` and whose `credential-provider` runs `aws codeartifact
|
|
get-authorization-token` and feeds the token to Cargo via stdout (or, on Windows,
|
|
`~/.cargo/credentials.toml`), the way [AWS documents configuring Cargo for
|
|
CodeArtifact](https://docs.aws.amazon.com/codeartifact/latest/ug/configure-use-cargo.html). AWS's
|
|
own guide documents only `cargo add`/`cargo build` (resolution) and `cargo publish`/`cargo login`
|
|
against CodeArtifact; this proxy serves exactly that surface and no `yank`/`owner`/search routes,
|
|
since AWS's guide never mentions any of those three for Cargo.
|
|
|
|
Authentication is a bare `Authorization: <token>` header with no scheme prefix at all, confirmed
|
|
from the Cargo Book's own registry-authentication page (the real `cargo` wire protocol has no
|
|
named HTTP auth scheme, unlike Maven/pypi/nuget's Basic or npm's Bearer); a missing, invalid,
|
|
expired, or wrong-domain token gets a 401 with no `WWW-Authenticate` challenge, since naming a
|
|
scheme real Cargo doesn't send would be misleading.
|
|
|
|
It is backed by a shared registry server, [Kellnr](https://kellnr.io), the same per-repository
|
|
container pattern as npm/pypi/nuget: each CodeArtifact repository gets its own Kellnr container,
|
|
started lazily on first use and identified internally by a fresh id generated at
|
|
`CreateRepository` time, so a repository deleted and recreated under the same name never inherits
|
|
the previous one's crates. `DeleteRepository` stops and removes that repository's container
|
|
immediately, the same as npm/pypi/nuget. One config knob, `FLOCI_SERVICES_CODEARTIFACT_CARGO_IMAGE`,
|
|
pins the image version.
|
|
|
|
`GET .../config.json` is authored directly rather than proxied from Kellnr (whose own response
|
|
would self-report its own internal container address): `{"dl":"<endpoint>api/v1/crates",
|
|
"api":"<endpoint>","auth-required":true}`, `<endpoint>` being the exact same value
|
|
`GetRepositoryEndpoint` returns, matching how real CodeArtifact serves Cargo from one combined
|
|
endpoint for index, API, and downloads alike (unlike crates.io's own split between an index host
|
|
and an API host). The sparse HTTP registry index itself (RFC 2789: one newline-delimited-JSON file
|
|
per crate, bucketed by name length/prefix exactly as real crates.io buckets it) is proxied from
|
|
Kellnr close to verbatim, real `deps`/`cksum`/`features` fields included. A real `cargo publish`
|
|
(`PUT api/v1/crates/new`) forwards the client's own real binary wire body (the 4-byte
|
|
length-prefixed metadata, then the 4-byte length-prefixed `.crate` file, confirmed from the Cargo
|
|
Book's own spec text) to Kellnr verbatim, dependency list included, through the same
|
|
`publish:BLOCK` origin-configuration gate and Archived/Disposed-version gate every other
|
|
container-backed format already uses; `GET .../api/v1/crates/{name}/{version}/download` streams
|
|
the real `.crate` back, blocked (404) for an Archived/Disposed version the same way.
|
|
|
|
Unlike every other format's publish, a `cargo publish` of an already-existing name/version is
|
|
**rejected outright, even when the content is byte-identical**, not treated as an idempotent
|
|
no-op the way Maven/pypi/nuget's publish paths are. This matches real Cargo: the Cargo Book's own
|
|
documented rule is that "a publish is generally permanent. The version can never be overwritten,"
|
|
confirmed live against Kellnr, which answers such a republish with a real `400` carrying the Cargo
|
|
Book's own documented error shape (`{"errors":[{"detail":"..."}]}`); this proxy forwards that
|
|
status and body to the client verbatim rather than reinterpreting it.
|
|
|
|
## AWS-compatible failures
|
|
|
|
Domain and repository names, tags, pagination, duplicate names, missing upstreams, policy-revision
|
|
mismatches, and non-empty-domain deletes are validated. Every action also validates its required
|
|
identifiers (`domain`, `repository`, `package`, `packageVersion`, `asset`) are present, returning
|
|
`ValidationException` rather than a misleading `ResourceNotFoundException` for one that's simply
|
|
missing from the request. Floci returns `ValidationException`,
|
|
`ConflictException`, `ResourceNotFoundException`, and `ServiceQuotaExceededException` (tag limits)
|
|
for deterministic conditions represented by local state. `ConflictException`,
|
|
`ResourceNotFoundException`, and `ServiceQuotaExceededException` all carry the `resourceId`/
|
|
`resourceType` fields the wire model declares for them, matching the typed accessors the AWS SDK
|
|
exposes on those exceptions.
|
|
|
|
AWS also models `AccessDeniedException`, `InternalServerException`, and `ThrottlingException`.
|
|
Floci does not inject provider-side failures that cannot be derived from the request or emulator
|
|
state.
|
|
|
|
## Known limitations
|
|
|
|
- **`DeleteRepository` does not check whether other repositories still reference it as an
|
|
upstream.** Deleting a repository leaves any repository that named it as an upstream pointing at
|
|
one that no longer exists.
|
|
- **Cross-account `domainOwner` addressing has no authorization check.** Passing a `domainOwner`
|
|
that is not the caller's own account looks up that account's domain/repository with no
|
|
trust-policy or permissions-policy enforcement, consistent with Floci's IAM enforcement being
|
|
opt-in elsewhere, but worth knowing if you rely on domain-sharing semantics.
|
|
- **The native per-format download routes don't consult a container-backed version's status
|
|
override, for Maven, npm, pypi, and nuget.** `GetPackageVersionAsset` correctly blocks an
|
|
Archived/Disposed version, but a plain `mvn`/`npm install`/`pip install`/`nuget` fetch against
|
|
the Maven GAV, npm tarball, pypi filename, or nuget content route proxies straight to the
|
|
sidecar and never checks it, so that same version's bytes are still fetchable through those
|
|
routes. `cargo`'s own download route (`GET .../api/v1/crates/{name}/{version}/download`) is the
|
|
one exception: it calls the same `requireContainerBackedVersionDownloadable` check
|
|
`GetPackageVersionAsset` uses and correctly 404s an Archived/Disposed version. The sparse index
|
|
lookup (`GET .../{name}`) is not filtered this way, though: a real `cargo` client's own protocol
|
|
keeps a yanked version listed in the index with a `yanked` flag rather than removing it, and
|
|
mapping Floci's own Archived/Disposed status onto that field is a real design decision
|
|
deliberately deferred, not yet built either way.
|
|
- **A container-backed (`maven`/`npm`/`pypi`/`nuget`/`cargo`) version's status override does not
|
|
survive a Floci restart.** It's kept in memory only, for the same reason the byte-count and readme
|
|
bookkeeping those formats already need are: the sidecar content it describes doesn't survive a
|
|
restart either (no volume attached, removed on shutdown), so persisting the override alone would
|
|
leave it answering for a version that, after a restart, no longer exists anywhere real. A
|
|
restart effectively un-disposes/un-archives every container-backed version back to `Published`
|
|
(or, for one `DisposePackageVersions` already deleted the real assets of, back to not existing at
|
|
all once the sidecar itself restarts empty). `generic`'s status has no such gap: it's stored
|
|
directly on the version's own persisted record.
|
|
- **`CopyPackageVersions` has no full cross-call rollback on a mid-copy sidecar failure.**
|
|
(`generic`, `maven`, `npm`, `pypi`, `nuget`, and `cargo` are all supported — matching real AWS,
|
|
which places no `format` restriction on this action at all, unlike `PublishPackageVersion`'s own
|
|
restriction to `generic`; `generic` copies through its own `packageVersions` record, while
|
|
`maven`, `npm`, `pypi`, `nuget`, and `cargo` each bridge straight to their own sidecar's storage,
|
|
since none of the five keeps a `packageVersions` record this action could otherwise read from or
|
|
write to. Maven, npm, pypi, and nuget bridge through their sidecar's real wire protocol — `mvn
|
|
deploy`, `npm publish`, `twine upload`, and `nuget push` respectively, confirmed against a live
|
|
container for each. `cargo` is the one exception: there is no real client request to replay for
|
|
a copy, so this bridges through `KellnrSidecarClient`'s own asset-store path instead, which
|
|
synthesizes fresh, dependency-free metadata rather than forwarding a real client's own `deps`
|
|
list, since there is no real client involved to have sent one; a copied crate's sparse-index
|
|
entry therefore always reports an empty dependency list, unlike one reached through a real
|
|
`cargo publish`.) A container-backed copy retains byte-for-byte
|
|
source assets, and a best-effort compensating cleanup restores or removes whatever one version's
|
|
own write touched if a later step in that same version fails, preserving the original error, but
|
|
a sidecar outage mid-cleanup can still leave a version in an inconsistent state, the same
|
|
residual risk the generic path's own write-level failure handling already accepts. A single call
|
|
stages every fetched asset to disk, not memory, for the whole batch's duration (cleaned up when
|
|
the call returns, success or failure), so a batch of many large assets is bounded by available
|
|
disk, not heap. A copied `npm` or `pypi` version's
|
|
readme is propagated to the destination too, from this service's own record captured at publish
|
|
time, since neither sidecar can answer for one after the fact (`GetPackageVersionReadme`'s own
|
|
constraint, described earlier in this document); `nuget` needs no equivalent step, since
|
|
`GetPackageVersionReadme` already answers it live from the `.nupkg` this action already copies
|
|
in full. `includeFromUpstream` (default `false`) is real: on a miss against the literal source
|
|
repository, it searches that repository's own `upstreams` chain, transitively and in priority
|
|
order, for the first repository with a usable (not Archived, not Disposed) copy of the
|
|
version, and copies from there instead, for every format. A version resolved this way records
|
|
its real origin (the actual, possibly several-hops-deep source repository, not the one named in
|
|
the request) the same way the native-protocol upstream-repository retention below does; a
|
|
version found directly at the named source repository records no new claim.
|
|
- **`CopyPackageVersions` holds this service's one write lock for the whole call, including the
|
|
disk staging and sidecar streaming a large batch now needs.** Every package-mutating method
|
|
here (`CreateDomain`, `PublishPackageVersion`, `DeletePackageVersions`, ...) shares one lock, so
|
|
only one such call runs at a time across every domain and repository, not just the one being
|
|
touched; that has always been true and is fine as long as what runs under the lock is fast.
|
|
`PublishPackageVersion` was specifically restructured to stage and digest a large upload
|
|
*before* taking this lock, so a multi-GB publish doesn't serialize every other call for as long
|
|
as it takes to read; `CopyPackageVersions` was not given the same treatment, since its own
|
|
validation (`NOT_FOUND`/`Disposed`/`MISMATCHED_REVISION`/content-match/`ALREADY_EXISTS`, all-or-
|
|
nothing across up to 100 requested versions) would need to be re-derived against a staged-then-
|
|
committed shape to split safely, a real design task rather than a mechanical move. A single
|
|
call copying many large versions can therefore hold up every other CodeArtifact request for as
|
|
long as that whole batch takes, not just slow down the one call itself.
|
|
- **The 5 GB asset size quota is a real streaming limit for `generic`, Maven, pypi, nuget, and
|
|
cargo, with two exceptions.** Every upload and download path (direct publish, the native
|
|
Maven/pypi/nuget/cargo proxies, `GetPackageVersionAsset`, and `CopyPackageVersions`) stages an
|
|
asset to disk and
|
|
streams it rather than holding it as one JVM array, so none of them are bound by the ~2 GiB
|
|
`byte[]` limit that would otherwise sit well under AWS's own 5 GB quota. Two things still cap a
|
|
real upload below that:
|
|
- **Every request body is still capped by `FLOCI_PROTOCOLS_MAX_REQUEST_SIZE`, 2048 MB by
|
|
default** (the same global limit [S3](s3.md) documents): raise it past 5120 to accept a 5 GiB
|
|
asset, the same adjustment a 5 GiB S3 `PutObject` needs.
|
|
- **In `floci.storage.mode: memory` (the shipped default), a `generic` asset's bytes are a
|
|
single in-memory `byte[]`**, so one can hold at most about 2 GiB there, the same ~2 GiB
|
|
ceiling S3 documents for its own `memory` mode (see [S3](s3.md#storage)); past that, the
|
|
publish fails with an uncaught `OutOfMemoryError` rather than a clean rejection. Unlike S3,
|
|
CodeArtifact has no per-service storage-mode override (`FLOCI_STORAGE_SERVICES_S3_MODE`'s own
|
|
equivalent does not exist here): set the global `FLOCI_STORAGE_MODE=persistent` (or `hybrid`/
|
|
`wal`) to lift this. Maven, npm, pypi, nuget, and cargo assets are unaffected either way, since
|
|
their real bytes always live in their own sidecar container, never in this map.
|
|
- **npm has its own, separate, much lower ceiling that no Floci-side configuration changes:**
|
|
real npm's publish protocol embeds the whole tarball as one base64 string inside a JSON
|
|
document, and Verdaccio (the sidecar behind this proxy) converts the whole received body to a
|
|
single JavaScript string before parsing it. Past roughly a 500 MB asset (confirmed between
|
|
200 MB, which succeeds, and 500 MB, which does not), that conversion hits V8's own hard maximum
|
|
string length and crashes the Verdaccio process outright with an uncaught `RangeError: Invalid
|
|
string length`, not a clean rejection either. This is a limitation of real npm's own wire
|
|
protocol as Verdaccio implements it, not something this emulator's own code can stream around.
|
|
- **Maven artifacts, npm packages, pypi packages, NuGet packages, and cargo crates do not survive a
|
|
Floci restart, even under persistent storage.** The Reposilite instance and every per-repository
|
|
Verdaccio, pypiserver, BaGetter, and Kellnr container have no volume attached and are removed on
|
|
shutdown along with everything published to them. CodeArtifact repository/domain metadata (including each format's stored sidecar container
|
|
id) survives a restart the same way any other Floci state does under persistent storage mode; the
|
|
artifacts and packages themselves do not, so the first request after a restart re-provisions
|
|
empty storage and returns 404 for anything published before the restart.
|
|
- **`GetAuthorizationToken` tokens are not revocable and are not tied to any IAM identity.** Real
|
|
CodeArtifact tokens are scoped to the calling principal's permissions; Floci's are scoped only to
|
|
the domain named in the request; anyone who obtains one keeps the same domain-scoped access for
|
|
its full lifetime.
|
|
- **The Maven, npm, pypi, and nuget sidecar containers have no authentication of their own, and
|
|
anything else sharing their Docker network can reach them directly on their container port.**
|
|
Real CodeArtifact's token check happens once, at Floci's own proxy layer
|
|
(`CodeArtifactMavenController`/the npm data plane/`CodeArtifactPypiController`/
|
|
`CodeArtifactNuGetController`), before a request ever reaches Reposilite, Verdaccio, pypiserver,
|
|
or BaGetter; those containers' own auth is deliberately disabled since the proxy is meant to be the
|
|
only path in. Binding the published host port to loopback only keeps an outside host off that
|
|
port; it does not stop another container already on the same configured Docker network (for
|
|
example a Lambda, Batch, or ECS workload container) from reaching the sidecar on its
|
|
container-internal address, bypassing the proxy's token check entirely. Closing this for real
|
|
would mean isolating each sidecar on its own Docker network reachable only from Floci's own
|
|
process, a change that would need to apply uniformly across all five sidecar-backed formats, not
|
|
a one-off fix to any single proxy. Kellnr (cargo's own sidecar) is the one partial exception:
|
|
confirmed live, it always demands a valid token for its own publish endpoint regardless of its
|
|
`KELLNR_REGISTRY__AUTH_REQUIRED` setting, so reaching it directly on the Docker network still
|
|
doesn't permit a publish without also obtaining the internal token Floci mints and caches for it;
|
|
that token is never the real CodeArtifact token, but it is still a second, real barrier the other
|
|
four sidecars don't have. That barrier only holds because the admin account behind it is never
|
|
left at Kellnr's own shipped `admin`/`admin` default (which every Kellnr deployment shares
|
|
publicly): a fresh, random password is minted per container at creation
|
|
(`KELLNR_SETUP__ADMIN_PWD`, confirmed live to override that default) and read fresh on every
|
|
admin login rather than cached, so it also stays correct across a container silently restarted
|
|
under the same repository id.
|
|
- **Every native endpoint's own external connections, and now its own repository-to-repository
|
|
upstream chain too, resolve for Maven, npm, pypi, nuget, and cargo** (cargo's external
|
|
connection is `public:crates-io`, against the real `index.crates.io`/`static.crates.io`). A real
|
|
`cargo build`/`cargo add` needs more than a plain on-demand fetch to work at all: its own sparse
|
|
index for one crate name is a single file covering every version, so a cache miss on the
|
|
download route alone would leave an upstream-only version invisible to its resolver. The native
|
|
cargo endpoint's own sparse-index route merges in real version lines not already known locally,
|
|
from both its external connection and its own upstream repository chain (read-only, nothing
|
|
retained until a real download actually happens), the one thing none of the other four formats'
|
|
own importers need, since their own clients can always ask for one already-known version
|
|
directly. `cargo` is otherwise still a container-backed format like the other four
|
|
(`DescribePackageVersion`, `ListPackages`, `DeletePackage`, `CopyPackageVersions`, and byte
|
|
accounting all already work for it the same way). On real CodeArtifact, a repository with another repository
|
|
configured as an upstream (`UpdateRepository`'s `upstreams`) or with an
|
|
`AssociateExternalConnection` to a public repository serves packages from those sources too, not
|
|
just its own; a repository has one or the other, never both. Floci's Maven endpoint does this
|
|
for a direct external connection to one of the 5 real public Maven repositories
|
|
(`public:maven-central`, `public:maven-clojars`, `public:maven-commonsware`,
|
|
`public:maven-googleandroid`, `public:maven-gradleplugins`): a GET/HEAD miss fetches and
|
|
retains the package version from the real public repository, following AWS's own documented
|
|
rules (release versions only; the standard 4 assets imported together, a non-standard asset
|
|
name imported only on demand; a retained version's origin checked against any later asset
|
|
fetched for it, rejecting one from a different connection; `upstream: BLOCK` respected). A real
|
|
`mvn deploy` of a version already present in the external connection is also rejected (409),
|
|
matching AWS's documented publish-side behavior. NuGet's own `public:nuget-org` external
|
|
connection works the same way, against its own one real public connection and its own
|
|
single-asset-per-version shape; a real `nuget push`/`dotnet nuget push` of a version already
|
|
present in the connection is rejected the same way. npm's own `public:npmjs` external connection
|
|
works differently, since `npm install <pkg>@<version>` never names a single version on the wire
|
|
the way Maven's GAV layout or NuGet's content route do, only the bare package: a packument read
|
|
merges the real registry's own versions and dist-tags into whatever this repository already
|
|
knows (never written back to Verdaccio itself, since its publish protocol has no way to record a
|
|
version's metadata without that version's real tarball bytes in the same call), and a tarball
|
|
download for a version not yet genuinely retained triggers the real fetch and retention, using
|
|
the same claim/fence/origin-tracking machinery. pypi's own `public:pypi` external connection
|
|
works the same way again, importing every real asset of a resolved version together (AWS's own
|
|
documented "will import all the assets in that package version," unlike npm/NuGet's one-asset
|
|
rule), with the requested file imported synchronously and its siblings handed to a background
|
|
task so a popular package's first install doesn't risk outlasting a real `pip`/`twine` client's
|
|
own default read timeout.
|
|
|
|
A repository-to-repository upstream chain resolves the same way, for all five formats, reusing
|
|
the exact claim/fence/origin-tracking machinery above: a GET/HEAD/tarball-download/packument/
|
|
sparse-index miss searches the repository's own `upstreams`, transitively, for the first
|
|
repository with a usable copy. The order is AWS's documented priority order: depth-first, in each repository's
|
|
listed order, an upstream's own upstreams searched before the next one, so `my_repo` with
|
|
upstreams `A` and `B`, `A` with `C` and `D` and `D` with `E` is searched `A, C, D, E, B`. An
|
|
Archived or Disposed version *at the resolved upstream repository itself* is skipped, the walk
|
|
continuing to the next candidate, since a same-domain upstream has a real CodeArtifact-shaped
|
|
status to check that a public registry never does. A version no upstream holds is fetched
|
|
through an upstream's own external connection, the first in that same order that has one, and
|
|
retained both there and in the repository the request was made to, as AWS documents for a
|
|
downstream request chaining through an upstream's `public:*` connection; a packument, Simple
|
|
index, `maven-metadata.xml`, or cargo sparse-index read through such an upstream offers what its
|
|
connection has too (cargo's own sparse-index merge walks every reachable upstream in that same
|
|
priority order rather than stopping at the first one with anything to offer, since it is merging
|
|
real version lines across however many hops the chain has, not resolving a single target the way
|
|
the other four formats' own one-shot reads do).
|
|
A retained version's `origin.domainEntryPoint` names where it entered the domain: the external
|
|
connection it was fetched through, `EXTERNAL`, or the repository it was published to, however
|
|
many upstreams it was retained through. Since the copy from a same-domain upstream never leaves
|
|
this process (a fetch through an upstream's connection is that connection's own import), pypi's
|
|
and cargo's own copy here need none of the real external connection's PEP 691/cargo-index-cksum
|
|
re-verification or (pypi's own) background-thread split: every asset of the resolved version is
|
|
copied synchronously, in one pass.
|
|
- **Maven external-connection retention is the one place this emulator makes a real outbound
|
|
call to the public internet**, rather than only ever talking to a container it started itself.
|
|
An offline environment, or a real outage of the public repository being connected to, means a
|
|
miss simply 404s, exactly as AWS documents ("the only workaround is to try again later").
|
|
There is no caching of that failure, so a later retry against a recovered source works
|
|
immediately, but there is also no retry/backoff of its own beyond the client's own.
|
|
- **The npm repository endpoint does not enforce the 5 GB asset size quota.** Unlike
|
|
`PublishPackageVersion` and the Maven endpoint, it streams the request straight through to the
|
|
backing Verdaccio container rather than buffering it first, so there is nowhere in the request
|
|
path to check a byte count against the quota before forwarding it.
|
|
- **The pypi repository endpoint only serves the HTML Simple Repository API, not the PEP 691/700
|
|
JSON variant.** AWS documents both: pip/uv can request
|
|
`application/vnd.pypi.simple.v1+json` from `/simple/<project>/` and get a JSON index with
|
|
per-file hashes, `requires-python`, and `upload-time`. Floci's proxy only ever forwards
|
|
pypiserver's native HTML response regardless of the client's `Accept` header, since pypiserver
|
|
itself has no JSON index support to pass through. Low practical risk in itself, since PEP 691
|
|
requires clients to accept HTML as a fallback and pip/uv both do, but it is a real gap against
|
|
AWS's documented surface, not just a quirk of the sidecar.
|
|
- **`DescribePackageVersion` reports only format/namespace/packageName/version/revision/status/origin
|
|
for Maven, npm, pypi, nuget, and cargo, same as it does for generic.** Real CodeArtifact's `PackageVersionDescription`
|
|
can also carry `displayName`, `summary`, `homePage`, `sourceCodeRepository`, `licenses`, and
|
|
`publishedTime`, extracted from the package's own metadata; none of those are populated for any
|
|
format today, container-backed or generic. For all five, the version's existence is
|
|
confirmed directly against its sidecar (`RepositorySidecarManager.packageVersionExists`) rather
|
|
than through the generic-format-only `packageVersions` record `GetPackageVersionAsset`'s own
|
|
bridge also moved past, and the revision is synthesized the same deterministic way
|
|
`GetPackageVersionAsset`'s bridge already does, so describing a version and then fetching one of
|
|
its assets see the same revision. Every sidecar-backed version reports `Published`: none of
|
|
these five formats' native publish paths (`mvn deploy`, `npm publish`, `twine upload`, `nuget
|
|
push`, `cargo publish`) can leave a version in any other status the way a generic publish
|
|
deliberately can with `unfinished=true`.
|
|
- **The nuget repository endpoint advertises no `RegistrationsBaseUrl` or `SearchQueryService`
|
|
resource.** `nuget install`/`dotnet add package`/`dotnet restore` resolve a package's versions
|
|
and dependencies from `PackageBaseAddress` alone (each version's own `.nuspec`, fetched directly,
|
|
carries its dependency groups), which is what Floci implements, so this doesn't affect the
|
|
install/restore path; it does mean `nuget list` has no resource to work against, which matches
|
|
AWS's own documented restriction that only NuGet's V3 protocol works against CodeArtifact at all
|
|
and that `nuget list` specifically isn't supported.
|
|
- **`DescribePackage`'s origin controls default to `publish: ALLOW`/`upstream: BLOCK`** (the
|
|
default for a package whose first version was published directly) **until a caller sets them
|
|
explicitly with `PutPackageOriginConfiguration`, or until the package's first version is
|
|
retained from an external connection, which instead defaults it to `publish: BLOCK`/
|
|
`upstream: ALLOW`**, matching AWS's own documented "ingested from a public source" default
|
|
(the same default now applies to a cargo crate retained from `public:crates-io`, since
|
|
`ensureRetainedPackageOriginDefaultIfCurrentRepository` is already fully format-agnostic). For
|
|
Maven, npm, pypi, nuget, and cargo, `DescribePackage` asks the
|
|
repository's sidecar whether the package exists, which starts that sidecar if it is not already
|
|
running; a package that exists only because `PutPackageOriginConfiguration` created it (no
|
|
versions yet) is found without touching any sidecar.
|
|
- **`PutPackageOriginConfiguration`'s `publish: BLOCK` is enforced for every format.**
|
|
`PublishPackageVersion` is the direct-publish path for `generic`; Maven, npm, pypi, nuget, and
|
|
cargo each check the same `requireContainerBackedPackagePublishAllowed` gate from their own
|
|
native wire protocol (`mvn deploy`, `npm publish`, `twine upload`, `nuget push`, `cargo publish`)
|
|
directly against the repository endpoint. `upstream` is stored and reported faithfully for every
|
|
format, and gates every format's own external-connection retention and repository-to-repository
|
|
upstream retention, both of which now resolve for cargo too, alongside Maven, npm, pypi, and
|
|
nuget (see above).
|
|
`CopyPackageVersions`
|
|
deliberately does not check `publish: BLOCK`/`upstream: BLOCK` either, for any format, including
|
|
its own `includeFromUpstream` search: the User Guide's own definition of both controls scopes
|
|
them to direct publish/retention "using package managers or similar tools," a mechanism Copy is
|
|
not.
|
|
- **`DescribeDomain`'s `assetSizeBytes` only counts what was published after this field started
|
|
being computed.** Generic-format bytes are summed live from the still-existing
|
|
`PublishPackageVersion` records, so they're always current. Maven, npm, pypi, nuget, and cargo
|
|
have no such record to sum (the same absent generic-format record `DescribePackageVersion`'s own
|
|
bridge works around by asking the sidecar directly instead), so each proxy reports its own
|
|
successfully-written byte count directly; a package published through one of those five formats
|
|
before this accounting existed was never reported and is not retroactively counted. A genuine
|
|
conflict or an idempotent no-op retry (any of the four byte-identical-retry formats' own
|
|
duplicate-publish protection; cargo's own publish rejects any republish outright instead, see
|
|
above) correctly adds nothing either way. Both `DeleteRepository` and `DeletePackage` clean
|
|
up every format's own records and byte counts (and, for `DeleteRepository`, the per-version
|
|
asset content underneath them), so a repository or package recreated under the same name never
|
|
inherits a predecessor's bytes. Maven/npm/pypi/nuget/cargo byte counts live only in memory, the
|
|
same as the sidecar content they describe (see the restart limitation below), not through
|
|
`StorageFactory` like every durable store here: the content these bytes count does not survive a
|
|
restart either, so neither does the count.
|
|
- **A whole-package `npm unpublish` is accounted for; unpublishing a single version of a
|
|
multi-version package is not.** The pinned Verdaccio image is configured to honor `npm
|
|
unpublish` natively (`unpublish: $all`), bypassing `DeletePackage` entirely; the npm data plane
|
|
detects that one specific wire shape (`DELETE .../-rev/<revision>`) and cleans up this service's
|
|
own byte count and deletion fence once Verdaccio confirms it. Removing a single version from a
|
|
multi-version package is a different, harder-to-detect shape (a `PUT` carrying an updated
|
|
packument, indistinguishable at the wire level from an ordinary republish), and is not detected;
|
|
since this accounting is per-package, not per-version, there is no narrower count a single
|
|
version's removal could subtract from in the first place.
|
|
- **A `maven-metadata.xml` upload for a versioned snapshot (`.../<artifact>/<version>/
|
|
maven-metadata.xml`) is counted under a package name built from its version string, not its real
|
|
artifact name.** Every real `mvn deploy` writes a group/artifact-level `maven-metadata.xml`
|
|
too, which this correctly attributes to the real artifact; only the rarer, version-scoped
|
|
snapshot form gets a package name this way. The bytes are still counted toward the domain total
|
|
either way, just under an internal accounting bucket nothing else ever looks up by name.
|
|
- **Package groups enforce `PUBLISH`, `EXTERNAL_UPSTREAM`, and `INTERNAL_UPSTREAM`.** `PUBLISH` is
|
|
wired into the one package-level origin check every direct-publish path already shares
|
|
(`PublishPackageVersion`'s own `generic`-format path and every native proxy controller's own
|
|
publish guard, `mvn deploy`/`npm publish`/`twine upload`/`nuget push`/`cargo publish` alike);
|
|
`EXTERNAL_UPSTREAM` and `INTERNAL_UPSTREAM` only apply where a format has retention to gate in
|
|
the first place; cargo's own external-connection and repository-to-repository retention are both
|
|
gated the same way the other four formats' already are (`isUpstreamRetentionBlocked`'s own check
|
|
is fully format-agnostic). Every
|
|
format's external-connection retention (Maven, npm, pypi, NuGet, and now cargo) is wired to the
|
|
resolved `EXTERNAL_UPSTREAM` mode; and every format's repository-to-repository upstream retention
|
|
(`UpdateRepository`'s `upstreams`) is wired to the resolved `INTERNAL_UPSTREAM` mode the same
|
|
way. All three follow the "`BLOCK` always wins over `ALLOW`" interaction between a package's own
|
|
origin configuration and its associated group's, and all three block a weak pattern match
|
|
outright regardless of the group's configured mode (the User Guide's own pattern-matching page
|
|
states this generically, "pulled from upstreams or published," not scoped to one restriction
|
|
type by name).
|
|
- **Package group weak-match normalization does not model Unicode confusable characters.** The
|
|
User Guide's own "Additional variations" section mentions visually-similar characters from
|
|
different alphabets only in passing, with no concrete testable rule; this emulator's weak match
|
|
only casefolds and collapses runs of `-`/`.`/`_` into a single `.`, the part of that section with
|
|
an actual rule to implement. A package name that only a real Unicode confusables table would
|
|
catch is treated as a non-match rather than a weak one.
|
|
|
|
See the [CodeArtifact API Reference](https://docs.aws.amazon.com/codeartifact/latest/APIReference/Welcome.html).
|
|
|
|
## Configuration
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `FLOCI_SERVICES_CODEARTIFACT_ENABLED` | `true` | Enable or disable CodeArtifact |
|
|
| `FLOCI_SERVICES_CODEARTIFACT_MAVEN_IMAGE` | `dzikoysk/reposilite:3.6.3` | Reposilite image used to serve the `maven` format |
|
|
| `FLOCI_SERVICES_CODEARTIFACT_MAVEN_URL` | unset | When set, use this URL and skip Reposilite container management |
|
|
| `FLOCI_SERVICES_CODEARTIFACT_MAVEN_TOKEN` | unset | `name:secret` access token for a pre-configured `MAVEN_URL` |
|
|
| `FLOCI_SERVICES_CODEARTIFACT_NPM_IMAGE` | `verdaccio/verdaccio:6.10.4` | Verdaccio image used to serve the `npm` format |
|
|
| `FLOCI_SERVICES_CODEARTIFACT_PYPI_IMAGE` | `pypiserver/pypiserver:v2.4.2` | pypiserver image used to serve the `pypi` format |
|
|
| `FLOCI_SERVICES_CODEARTIFACT_NUGET_IMAGE` | `bagetter/bagetter:1.6.5` | BaGetter image used to serve the `nuget` format |
|
|
| `FLOCI_SERVICES_CODEARTIFACT_CARGO_IMAGE` | `ghcr.io/kellnr/kellnr:5.14.1` | Kellnr image used to serve the `cargo` format |
|