Skip to content

Add registry authentication in runtime#40123

Open
kvega005 wants to merge 47 commits intomicrosoft:feature/wsl-for-appsfrom
kvega005:user/kevinve/registry
Open

Add registry authentication in runtime#40123
kvega005 wants to merge 47 commits intomicrosoft:feature/wsl-for-appsfrom
kvega005:user/kevinve/registry

Conversation

@kvega005
Copy link
Copy Markdown

@kvega005 kvega005 commented Apr 6, 2026

Summary of the Pull Request

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings April 6, 2026 21:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds registry authentication support to the WSLC runtime Docker HTTP layer (X-Registry-Auth + /auth) and introduces a local-registry helper + tests to validate authenticated pull/push flows.

Changes:

  • Add PushImage and Authenticate session APIs and plumb optional X-Registry-Auth through DockerHTTPClient for pull/push.
  • Refactor image streaming logic into a shared StreamImageOperation() path with progress callback support.
  • Add Windows tests that stand up a local registry container with basic auth and validate failure/success cases.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/windows/WSLCTests.cpp Adds an authenticated registry E2E test and supporting helpers.
test/windows/CMakeLists.txt Links Crypt32 for base64 support used by new auth helpers.
src/windows/wslcsession/WSLCSession.h Adds new COM method declarations and shared streaming helper.
src/windows/wslcsession/WSLCSession.cpp Implements PushImage/Authenticate and refactors pull/push streaming + auth header plumbing.
src/windows/wslcsession/WSLCContainer.cpp Avoids sending empty Cmd/Entrypoint (supports default entrypoint behavior).
src/windows/wslcsession/DockerHTTPClient.h Extends pull request API to accept registry auth; adds push/auth APIs; supports custom headers.
src/windows/wslcsession/DockerHTTPClient.cpp Sets X-Registry-Auth on pull/push and adds /auth implementation.
src/windows/service/inc/wslc.idl Extends IWSLCSession with PushImage and Authenticate.
src/windows/inc/docker_schema.h Adds auth request/response schema; makes Entrypoint optional in create-container schema.
src/windows/common/WSLCLocalRegistry.h / .cpp Adds helper to start a local registry container (optionally with htpasswd auth).
src/windows/common/WslcCredentialStore.h / .cpp Adds helper to build base64 X-Registry-Auth payloads.
src/windows/common/WSLCContainerLauncher.h Exposes FormatResult for use in new registry helper.
src/windows/common/CMakeLists.txt Adds new helper sources/headers and links Crypt32 into common.

Copilot AI review requested due to automatic review settings April 6, 2026 22:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Copilot AI review requested due to automatic review settings April 6, 2026 23:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings April 7, 2026 00:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings April 7, 2026 01:09
Copilot AI review requested due to automatic review settings April 8, 2026 02:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings April 8, 2026 16:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Copy link
Copy Markdown
Collaborator

@OneBlue OneBlue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}
CATCH_RETURN();

STDAPI WslcTagSessionImage(_In_ WslcSession session, _In_ const WslcTagImageOptions* options, _Outptr_opt_result_z_ PWSTR* errorMessage)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnMcPMS to review the SDK changes

Copilot AI review requested due to automatic review settings April 9, 2026 18:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/windows/wslcsession/WSLCSession.cpp:534

  • StreamImageOperation hard-codes HTTP 404 → WSLC_E_IMAGE_NOT_FOUND for all operations. For PushImage, a 404 from dockerd commonly represents “no such image (locally)” rather than a registry lookup miss, and the tests in this PR expect a different HRESULT for that scenario. Consider making the 404 mapping operation-specific (e.g., let the caller decide which HRESULT to surface for 404) so Push/Pull can return semantically correct errors.
        if (httpResponse->result == boost::beast::http::status::not_found)
        {
            THROW_HR_WITH_USER_ERROR(WSLC_E_IMAGE_NOT_FOUND, errorMessage);
        }
        else if (httpResponse->result == boost::beast::http::status::bad_request)
        {
            THROW_HR_WITH_USER_ERROR(E_INVALIDARG, errorMessage);
        }
        else
        {
            THROW_HR_WITH_USER_ERROR(E_FAIL, errorMessage);
        }

Copilot AI review requested due to automatic review settings April 9, 2026 18:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings April 9, 2026 21:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Apply clang-format (VS 2022 / v19.1.5) to fix formatting check failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@benhillis benhillis force-pushed the user/kevinve/registry branch from 8732599 to baabcd9 Compare April 9, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants