Repository navigation
Conversation
… preserved production lineage
…red portal baseline
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc182c58df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| || OciRouteParser.TryParse(request.HttpContext.Request.Path, out var route) | ||
| && (route.Kind == OciRouteKind.Catalog | ||
| ? request.Operation == FeedOperation.Pull && Allows(ticket, "catalog", request.Operation, "registry") | ||
| : route.RepositoryName is { } repository && Allows(ticket, repository, request.Operation))); |
There was a problem hiding this comment.
Bind scoped blob access to the authorized repository
When a bearer token grants pull access only to repository A, this check authorizes /v2/A/blobs/<digest-from-B> because it validates only the repository name in the request path. OciRegistryService.GetBlobAsync then returns any matching blob from the surface-wide digest store at lines 210-215 without verifying that the digest belongs to A, so knowledge of a digest bypasses the repository scope and exposes content from B. Require a repository-to-blob association before serving locally stored blobs.
Useful? React with 👍 / 👎.
| app.MapGet("v3/vulnerabilities/vulnerabilities-base.json", GetVulnerabilityPage) | ||
| .AllowAnonymous() | ||
| .WithTags(nameof(Vulnerability)); |
There was a problem hiding this comment.
Require feed authentication for vulnerability data
On a private feed where anonymous pulls are disabled, this new endpoint remains anonymously callable and returns every vulnerable package ID, advisory URL, severity, and affected range. Other NuGet endpoints use AuthorizedNuGetConsumerFilter after AllowAnonymous() to enforce feed credentials, but this route omits that filter, exposing private package inventory and security metadata to unauthenticated requests.
Useful? React with 👍 / 👎.
| CREATE UNIQUE INDEX "IX_Packages_CaseInsensitiveIdentity" | ||
| ON "Packages" (lower("Id"), "FeedId", lower("Version")); |
There was a problem hiding this comment.
Resolve case-colliding rows before creating the unique index
When upgrading a PostgreSQL feed that already contains IDs differing only by case at the same feed and normalized version, such as Foo and foo, the existing case-sensitive unique index permits both rows but this statement fails with a duplicate-key error and prevents the application from completing migrations or starting. Reconcile or explicitly migrate these pre-existing collisions before creating the case-insensitive unique index.
Useful? React with 👍 / 👎.
| { | ||
| continue; | ||
| } | ||
|
|
||
| UpsertDistTag(package, entry.Key, version, feedId); | ||
| var storagePath = $"{EncodePackagePath(normalizedName)}/-/{tarballFileName}"; |
There was a problem hiding this comment.
Give each mirrored npm version a unique tarball path
When an upstream packument gives two versions tarball URLs with the same basename, which npm permits because dist.tarball is an arbitrary URL, both rows receive this identical local path and their packument entries are rewritten to the same local URL. GetTarballAsync then selects a version by TarballPath alone, so caching or downloading either URL can return the other version's bytes and make installs fail integrity checks. Derive the local filename from the package version while retaining the original upstream URL in metadata.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db1348a6dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (await _packageAuthentication.AuthenticateForOperationAsync( | ||
| string.Empty, | ||
| FeedOperation.Pull, | ||
| cancellationToken)).Succeeded; |
There was a problem hiding this comment.
Restrict anonymous provider checks to read operations
When an operation-aware authentication provider permits an empty credential for Pull but denies Push, every unauthenticated OCI write is nevertheless accepted because this helper always checks Pull, and AuthenticateAsync uses its successful result before considering request.Operation. This allows anonymous blob uploads and manifest publication on providers that intentionally support anonymous reads; apply this shortcut only to pull/login requests or evaluate the actual requested operation.
Useful? React with 👍 / 👎.
| authentication is IOperationAwarePackageAuthenticationService operationAware | ||
| ? WithLoginFallbackAsync(op => operationAware.AuthenticateAsync(username, token, op, cancellationToken), operation) | ||
| : authentication.AuthenticateAsync(username, token, cancellationToken); |
There was a problem hiding this comment.
Preserve publisher checks for legacy Basic credentials
For a custom provider implementing only the legacy IPackageAuthenticationService, the username/token overload is the consumer check while the token-only overload is the publisher check. The NuGet and OCI adapters now pass Basic-authenticated pushes through this fallback, which always invokes the consumer overload regardless of FeedOperation.Push, so a read-only consumer credential can upload packages or OCI artifacts. Legacy push handling must use the token-only publisher overload or reject Basic credentials.
Useful? React with 👍 / 👎.
| using var stream = entry.Open(); | ||
| using var ms = new MemoryStream(); | ||
| stream.CopyTo(ms); | ||
| return ms.ToArray(); |
There was a problem hiding this comment.
Bound expanded NuGet entries before buffering
When a published or mirrored package contains a highly compressed DLL with a very large expanded size, opening its Diff tab calls ReadZipBytes for every assembly while building the tree, and this unbounded copy materializes the entire expanded entry in memory. A small zip bomb can therefore exhaust the server heap from a single comparison request; reject oversized entries and enforce cumulative expanded-size and entry-count limits before copying, as the npm and Helm inspectors already do.
Useful? React with 👍 / 👎.
| if (await _context.NpmVersions.IgnoreQueryFilters().AnyAsync(v => v.FeedId == feedId && v.PackageKey == package.Key && v.Version == version, cancellationToken)) | ||
| throw new NpmRegistryException(409, "EPUBLISHCONFLICT", "A package version is immutable. Publish a new version instead."); | ||
| await _blobStore.PutAsync(storagePath, bufferedTarball, cancellationToken); |
There was a problem hiding this comment.
Prevent losing publish transactions from writing package bytes
When two clients publish different tarballs for the same new version concurrently on PostgreSQL, both serializable transactions can pass the absence check before either commits, while this external blob write is neither serialized nor rolled back with the database transaction. The transaction that ultimately loses can still replace the object on S3, and stores that return Conflict are also unsafe because PathBlobStore discards that result, leaving the winning NpmVersion shasum and packument describing different bytes than the tarball served to clients. Use a per-attempt staging path or a conditional write whose result is tied to the winning catalog insert.
Useful? React with 👍 / 👎.
| Description = metadata.Description, | ||
| ReleaseNotes = metadata.ReleaseNotes, | ||
| HasReadme = false, | ||
| HasEmbeddedIcon = !string.IsNullOrWhiteSpace(metadata.IconFile), |
There was a problem hiding this comment.
Avoid advertising uncached embedded icons as local
When live upstream metadata describes an IconFile, this transient package is marked as having a local embedded icon even though its nupkg has not been cached. GetPackageInfo consequently emits the feed's local icon endpoint, which the package-detail browser requests automatically; that endpoint calls MirrorAsync, so merely viewing metadata downloads and caches the entire package, while a ProxyOnly source downloads it and still returns no icon because no local row was created. Do not mark transient upstream models as locally embedded, or expose an icon path that can proxy the asset without implicitly importing the package.
Useful? React with 👍 / 👎.
Restores the reviewed production portal source from restore/production-portal-source at 920d78b. PackageSearch.razor matches deployed SHA-256 c0124322597de179609ecae77a3fed88f6b5dd30aa14df6f1124dfb563999867. The provenance manifest documents eight matched Host/UI files and their limits. No private history, runtime configuration, credentials, binaries or local WIP is imported.
Reconciles dependency PR #735 at master 7508993, preserving newer OpenAPI versions, docs lockfile and MinIO qualification fixture. Generates required public CSS from the preserved npm lockfile. Supersedes #717's older layout/search scope without merging that branch.
Not ready to merge: the confirmed OCI repository/blob finding needs a complete repair and a legacy-availability decision. All original 19 test failures are resolved.
Validation:
Original failures were reconciled without weakening private provider decisions: restored provider-defined anonymous NuGet reads (five new controls), rejected malformed credentials and anonymous writes, corrected seeded vulnerability array-contract tests, asserted lazy/immutable npm behavior, exercised trusted forwarded headers, corrected OCI service identities and token permission-intersection assertions, and fixed missing-credential OCI issuance.
Review findings validated against source:
Collision preflight for review (not run on production):
Separate scoped bug PRs #739 (Closes #736) and #740 (Closes #737) target this integration branch. #740 also preserves generic anonymous readiness while restricting detailed Host feed health/metrics; its documented monitoring compatibility change needs consumer coordination before rollout.
Adding the existing component project to solution CI with a logger reference was rejected by automatic approval review under the separate dependency-owner restriction; no dependency change was made. Existing master automation publishes internal NuGet artifacts and docs Pages after merge. No manual deployment, production migration, live configuration, credential, access-grant or recovery release change is performed.
Latest source head: db1348a; exact-head CI is pending. No production migration or retained-data repair was attempted.
OCI legacy compatibility decision: reconstructing layer/config membership from old manifest references would reintroduce disclosure. Pre-fix Published manifests could contain foreign references; mirrored manifests prove only their own fetched bytes. Origin metadata cannot establish edge provenance. Safe default: retain direct tagged-manifest access, establish blob ownership through verified requested-repository upstream retrieval or reupload, and leave other unmapped legacy bytes stored but unavailable through repository blob endpoints. A separately reviewed ownership import could restore specified historical associations; no automatic graph import or general trust switch is proposed. This can affect legacy image layers, not only unreferenced uploads.
Read-only deployed monitoring inventory could not be completed from this cloud environment: no AWS/Azure/Kubernetes credential context, no deployment connector, and only a local Docker socket are available. Repository samples/documentation are evidence of intended consumers, not proof of deployed scrapers. No access or credential reconfiguration was attempted.