Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1ab8ea2
Simplify e2e build-test image cleanup with per-test RAII ownership
johnstep Jul 14, 2026
a85aaeb
Add wslc image build --secret switch
johnstep Jul 14, 2026
2d9c24d
Error on bare --secret id with unset env var
ggarzia-MSFT Jul 17, 2026
f7cbe09
Reject empty secret id and track mounts before mounting
ggarzia-MSFT Jul 17, 2026
f17fdbb
Reject secret id starting with '-' client-side
ggarzia-MSFT Jul 17, 2026
6c5e119
Move --secret input validation into ValidateSecretSpec
ggarzia-MSFT Jul 17, 2026
af5dd73
Merge branch 'master' into user/johnstep/build-secret
ggarzia-MSFT Jul 17, 2026
9b34bc0
fix resource comment
ggarzia-MSFT Jul 17, 2026
0f77d44
Merge branch 'user/johnstep/build-secret' of https://github.com/micro…
ggarzia-MSFT Jul 17, 2026
c08a908
fix resource comment
ggarzia-MSFT Jul 20, 2026
1a7e353
Avoid null pointer arithmetic for empty build secret
ggarzia-MSFT Jul 20, 2026
f982ba0
Record VM mount only after it succeeds
ggarzia-MSFT Jul 20, 2026
0075638
Validate shared secret build context is a directory
ggarzia-MSFT Jul 20, 2026
58beb90
Merge branch 'master' into user/johnstep/build-secret
ggarzia-MSFT Jul 20, 2026
d0c41db
Pass Reporter to BuildImageCallback and TryInspectImage
ggarzia-MSFT Jul 20, 2026
143c246
Apply clang-format to secret build test lines
ggarzia-MSFT Jul 20, 2026
ebca58b
Revert "Apply clang-format to secret build test lines"
ggarzia-MSFT Jul 20, 2026
b0931e2
Format secret build test with pipeline clang-format
ggarzia-MSFT Jul 20, 2026
0a32bc0
Format ValidateSecretSpec with pipeline clang-format
ggarzia-MSFT Jul 20, 2026
8bf6243
Verify secret build success by exit code, not empty stderr
ggarzia-MSFT Jul 20, 2026
df88fb5
Read file secret by size to detect truncated reads
ggarzia-MSFT Jul 20, 2026
eb7726d
Pass nullptr for empty build secret value
ggarzia-MSFT Jul 20, 2026
f2b7756
Log build secret cleanup failures
ggarzia-MSFT Jul 20, 2026
81ec735
Merge branch 'master' into user/johnstep/build-secret
ggarzia-MSFT Jul 20, 2026
6a819c7
Merge secret spec validation and parsing into ParseSecretSpec
ggarzia-MSFT Jul 20, 2026
368cc13
Merge branch 'master' into user/johnstep/build-secret
ggarzia-MSFT Jul 21, 2026
3086946
Add secret parser unit tests and share env-read helper
ggarzia-MSFT Jul 21, 2026
6a7131c
Extract spec parsers into SpecParsing
ggarzia-MSFT Jul 21, 2026
fbdbd4b
Use ScopedEnvVariable in tests
ggarzia-MSFT Jul 21, 2026
ad8998c
Merge branch 'master' into user/johnstep/build-secret
ggarzia-MSFT Jul 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions localization/strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2327,6 +2327,10 @@ For privacy information about this product please visit https://aka.ms/privacy.<
<value>Image '{}' not found.</value>
<comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment>
</data>
<data name="MessageWslcSecretInvalidSpec" xml:space="preserve">
<value>Invalid --secret value '{}': {}</value>
<comment>{FixedPlaceholder="{}"}{Locked="--secret "}Command line arguments, file names and string inserts should not be translated</comment>
</data>
<data name = "MessageWslcMissingVolumeOption" xml:space = "preserve" >
<value>Missing required option: '{}'</value>
<comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment>
Expand Down Expand Up @@ -2868,6 +2872,10 @@ On first run, creates the file with all settings commented out at their defaults
<data name="WSLCCLI_BuildTargetArgDescription" xml:space="preserve">
<value>Set the target build stage to build</value>
</data>
<data name="WSLCCLI_SecretArgDescription" xml:space="preserve">
<value>Expose secret to the build (id=NAME[,type=env|file][,env=VAR|,src=PATH]; defaults to env var NAME)</value>
Comment thread
ggarzia-MSFT marked this conversation as resolved.
Comment thread
ggarzia-MSFT marked this conversation as resolved.
Comment thread
ggarzia-MSFT marked this conversation as resolved.
<comment>{Locked="id=NAME"}{Locked="type=env|file"}{Locked="env=VAR"}{Locked="src=PATH"}Command line arguments should not be translated</comment>
</data>
Comment thread
ggarzia-MSFT marked this conversation as resolved.
<data name="WSLCCLI_CommandArgDescription" xml:space="preserve">
<value>The command to run</value>
</data>
Expand Down
13 changes: 13 additions & 0 deletions src/windows/common/wslutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,19 @@ void wsl::windows::common::wslutil::PrintMessage(_In_ const std::wstring& messag
fwprintf(stream, L"%ls\n", message.c_str());
}

std::optional<std::wstring> wsl::windows::common::wslutil::ReadEnvironmentVariable(_In_ LPCWSTR Name)
{
std::wstring value;
const HRESULT hr = wil::GetEnvironmentVariableW(Name, value);
if (hr == HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))
{
return std::nullopt;
}

THROW_IF_FAILED(hr);
return value;
}

void wsl::windows::common::wslutil::SetCrtEncoding(int Mode)
{
// Configure the CRT to manipulate text as the specified mode.
Expand Down
4 changes: 4 additions & 0 deletions src/windows/common/wslutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ void PrintMessage(_In_ const std::wstring& message, _Inout_ FILE* const stream =
PrintMessageImpl(message, stream, std::forward<Args>(args)...);
}

// Reads an environment variable. Returns nullopt iff the variable is not defined; an engaged
// (possibly empty) string otherwise.
std::optional<std::wstring> ReadEnvironmentVariable(_In_ LPCWSTR Name);

void SetCrtEncoding(int Mode);

void SetThreadDescription(LPCWSTR Name);
Expand Down
17 changes: 17 additions & 0 deletions src/windows/service/inc/wslc.idl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,22 @@ typedef struct _WSLCStringArray
ULONG Count;
} WSLCStringArray;

typedef struct _WSLCBuildSecret
{
[string] LPCSTR Id; // Value for docker's --secret id= field.
// Raw secret bytes (never cross into argv). Carried as a counted byte array so arbitrary binary
// content - including embedded NULs - round-trips losslessly; the server materializes it into a
// root-only tmpfs file inside the VM and references it with docker's --secret src=.
[unique, size_is(ValueSize)] const byte* Value;
ULONG ValueSize;
} WSLCBuildSecret;

typedef struct _WSLCBuildSecretArray
{
[unique, size_is(Count)] const WSLCBuildSecret* Values;
ULONG Count;
} WSLCBuildSecretArray;

typedef struct _WSLCProcessOptions
{
[unique] LPCSTR CurrentDirectory;
Expand Down Expand Up @@ -523,6 +539,7 @@ typedef struct _WSLCBuildImageOptions
LPCSTR Target; // Target build stage name passed as --target to docker.
WSLCBuildImageFlags Flags; // WSLCBuildImageFlags
WSLCStringArray Labels; // KEY=VALUE pairs passed as --label to docker.
WSLCBuildSecretArray Secrets; // --secret entries; the server writes each secret's bytes to a root-only tmpfs file in the VM and emits the corresponding id=...,src=... spec.
} WSLCBuildImageOptions;

typedef struct _WSLCTagImageOptions
Expand Down
1 change: 1 addition & 0 deletions src/windows/wslc/arguments/ArgumentDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ _(PublishAll, "publish-all", L"P", Kind::Flag, L
_(Quiet, "quiet", L"q", Kind::Flag, Localization::WSLCCLI_QuietArgDescription()) \
_(Remove, "rm", NO_ALIAS, Kind::Flag, Localization::WSLCCLI_RemoveArgDescription()) \
/*_(Scheme, "scheme", NO_ALIAS, Kind::Value, Localization::WSLCCLI_SchemeArgDescription())*/ \
_(Secret, "secret", NO_ALIAS, Kind::Value, Localization::WSLCCLI_SecretArgDescription()) \
_(Server, "server", NO_ALIAS, Kind::Positional, Localization::WSLCCLI_LoginServerArgDescription()) \
_(Session, "session", NO_ALIAS, Kind::Value, Localization::WSLCCLI_SessionIdArgDescription()) \
_(ShmSize, "shm-size", NO_ALIAS, Kind::Value, Localization::WSLCCLI_ShmSizeArgDescription()) \
Expand Down
Loading
Loading