Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ gitter
glachancecmaisonneuve
globbing
GoogleTest
GUIs
gzip
hackathons
hashtable
Expand Down Expand Up @@ -611,7 +610,6 @@ repo
reportgenerator
resgen
responseheaders
REST
rest.ps1
restart-apachehttpserver
resx
Expand Down
4 changes: 0 additions & 4 deletions ADOPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ This is a list of adopters of using PowerShell in production or in their product
* [PowerShell Universal Dashboard](https://ironmansoftware.com/powershell-universal-dashboard) is a cross-platform web framework for PowerShell.
It provides the ability to create robust, interactive websites, REST APIs, and Electron-based desktop apps with PowerShell script.
More information about PowerShell Universal Dashboard is available at the [PowerShell Universal Dashboard Docs](https://docs.universaldashboard.io).
* [System Frontier](https://systemfrontier.com/solutions/powershell/) provides dynamically generated web GUIs and REST APIs for PowerShell and other scripting languages.
Enable non-admins like help desk and tier 1 support teams to execute secure web based tools on any platform `without admin rights`.
Configure flexible RBAC permissions from an intuitive interface, without a complex learning curve.
Script output along with all actions are audited. Manage up to 5,000 nodes for free with the [Community Edition](https://systemfrontier.com/solutions/community-edition/).
734 changes: 295 additions & 439 deletions assets/files.wxs

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function Get-EnvironmentInformation

if ($Environment.IsLinux) {
$LinuxInfo = Get-Content /etc/os-release -Raw | ConvertFrom-StringData
$lsb_release = Get-Command lsb_release -Type Application -ErrorAction Ignore | Select-Object -First 1
$lsb_release = Get-Command lsb_release -Type Application -ErrorAction Ignore
if ($lsb_release) {
$LinuxID = & $lsb_release -is
}
Expand All @@ -145,8 +145,6 @@ function Get-EnvironmentInformation
$environment += @{'LinuxInfo' = $LinuxInfo}
$environment += @{'IsDebian' = $LinuxInfo.ID -match 'debian' -or $LinuxInfo.ID -match 'kali'}
$environment += @{'IsDebian9' = $Environment.IsDebian -and $LinuxInfo.VERSION_ID -match '9'}
$environment += @{'IsDebian10' = $Environment.IsDebian -and $LinuxInfo.VERSION_ID -match '10'}
$environment += @{'IsDebian11' = $Environment.IsDebian -and $LinuxInfo.PRETTY_NAME -match 'bullseye'}
$environment += @{'IsUbuntu' = $LinuxInfo.ID -match 'ubuntu' -or $LinuxID -match 'Ubuntu'}
$environment += @{'IsUbuntu16' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '16.04'}
$environment += @{'IsUbuntu18' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '18.04'}
Expand Down Expand Up @@ -501,17 +499,13 @@ Fix steps:
$psVersion = git --git-dir="$PSSCriptRoot/.git" describe
}

if ($Environment.IsRedHatFamily -or $Environment.IsDebian) {
if ($Environment.IsRedHatFamily -or $Environment.IsDebian9) {
# add two symbolic links to system shared libraries that libmi.so is dependent on to handle
# platform specific changes. This is the only set of platforms needed for this currently
# as Ubuntu has these specific library files in the platform and macOS builds for itself
# against the correct versions.

if ($Environment.IsDebian10 -or $Environment.IsDebian11){
$sslTarget = "/usr/lib/x86_64-linux-gnu/libssl.so.1.1"
$cryptoTarget = "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1"
}
elseif ($Environment.IsDebian9){
if ($Environment.IsDebian9){
# NOTE: Debian 8 doesn't need these symlinks
$sslTarget = "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.2"
$cryptoTarget = "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2"
Expand Down
2 changes: 1 addition & 1 deletion docs/debugging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ process named `powershell`, and will attach to it. If you need more fine-grained
control, replace `processName` with `processId` and provide a PID. (Please be
careful not to commit such a change.)

[core-debug]: https://devblogs.microsoft.com/devops/experimental-net-core-debugging-in-vs-code/
[core-debug]: https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/
[vscode]: https://code.visualstudio.com/
[OmniSharp]: https://github.com/OmniSharp/omnisharp-vscode
[vscclrdebugger]: https://aka.ms/vscclrdebugger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,15 +663,8 @@ internal virtual void PrepareSession()
{
foreach (string key in Headers.Keys)
{
var value = Headers[key];

// null is not valid value for header.
// We silently ignore header if value is null.
if (!(value is null))
{
// add the header value (or overwrite it if already present)
WebSession.Headers[key] = value.ToString();
}
// add the header value (or overwrite it if already present)
WebSession.Headers[key] = Headers[key].ToString();
}
}

Expand Down Expand Up @@ -1267,24 +1260,21 @@ internal virtual void FillRequestStream(HttpRequestMessage request)

foreach (var entry in WebSession.ContentHeaders)
{
if (!string.IsNullOrWhiteSpace(entry.Value))
if (SkipHeaderValidation)
{
if (SkipHeaderValidation)
request.Content.Headers.TryAddWithoutValidation(entry.Key, entry.Value);
}
else
{
try
{
request.Content.Headers.TryAddWithoutValidation(entry.Key, entry.Value);
request.Content.Headers.Add(entry.Key, entry.Value);
}
else
catch (FormatException ex)
{
try
{
request.Content.Headers.Add(entry.Key, entry.Value);
}
catch (FormatException ex)
{
var outerEx = new ValidationMetadataException(WebCmdletStrings.ContentTypeException, ex);
ErrorRecord er = new ErrorRecord(outerEx, "WebCmdletContentTypeException", ErrorCategory.InvalidArgument, ContentType);
ThrowTerminatingError(er);
}
var outerEx = new ValidationMetadataException(WebCmdletStrings.ContentTypeException, ex);
ErrorRecord er = new ErrorRecord(outerEx, "WebCmdletContentTypeException", ErrorCategory.InvalidArgument, ContentType);
ThrowTerminatingError(er);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/PSGalleryModules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<ItemGroup>
<PackageReference Include="PowerShellGet" Version="2.2.3" />
<PackageReference Include="PackageManagement" Version="1.4.6" />
<PackageReference Include="Microsoft.PowerShell.Archive" Version="1.2.4.0" />
<PackageReference Include="Microsoft.PowerShell.Archive" Version="1.2.3.0" />
<PackageReference Include="PSReadLine" Version="2.0.0-rc1" />
<PackageReference Include="ThreadJob" Version="2.0.3" />
<PackageReference Include="ThreadJob" Version="2.0.2" />
<PackageReference Include="PSDesiredStateConfiguration" Version="2.0.5" />
</ItemGroup>

Expand Down
14 changes: 0 additions & 14 deletions src/System.Management.Automation/engine/Modules/AnalysisCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ private static ConcurrentDictionary<string, CommandTypes> AnalyzeManifestModule(
var moduleManifestProperties = PsUtils.GetModuleManifestProperties(modulePath, PsUtils.FastModuleManifestAnalysisPropertyNames);
if (moduleManifestProperties != null)
{
if (!Configuration.PowerShellConfig.Instance.IsImplicitWinCompatEnabled() && ModuleIsEditionIncompatible(modulePath, moduleManifestProperties))
{
ModuleIntrinsics.Tracer.WriteLine($"Module lies on the Windows System32 legacy module path and is incompatible with current PowerShell edition, skipping module: {modulePath}");
return null;
}

Version version;
if (ModuleUtils.IsModuleInVersionSubdirectory(modulePath, out version))
{
Expand Down Expand Up @@ -491,14 +485,6 @@ internal static void CacheModuleExports(PSModuleInfo module, ExecutionContext co
{
ModuleIntrinsics.Tracer.WriteLine("Requested caching for {0}", module.Name);

// Don't cache incompatible modules on the system32 module path even if loaded with
// -SkipEditionCheck, since it will break subsequent sessions
if (!Configuration.PowerShellConfig.Instance.IsImplicitWinCompatEnabled() && !module.IsConsideredEditionCompatible)
{
ModuleIntrinsics.Tracer.WriteLine($"Module '{module.Name}' not edition compatible and not cached.");
return;
}

DateTime lastWriteTime;
ModuleCacheEntry moduleCacheEntry;
GetModuleEntryFromCache(module.Path, out lastWriteTime, out moduleCacheEntry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2363,58 +2363,18 @@ internal PSModuleInfo LoadModuleManifest(
bool isConsideredCompatible = ModuleUtils.IsPSEditionCompatible(moduleManifestPath, inferredCompatiblePSEditions);
if (!BaseSkipEditionCheck && !isConsideredCompatible)
{
if (PowerShellConfig.Instance.IsImplicitWinCompatEnabled())
if (importingModule)
{
if (importingModule)
{
IList<PSModuleInfo> moduleProxies = ImportModulesUsingWinCompat(new string [] {moduleManifestPath}, null, new ImportModuleOptions());
IList<PSModuleInfo> moduleProxies = ImportModulesUsingWinCompat(new string [] {moduleManifestPath}, null, new ImportModuleOptions());

// we are loading by a single ManifestPath so expect max of 1
if(moduleProxies.Count > 0)
{
return moduleProxies[0];
}
else
{
return null;
}
}
}
else
{
containedErrors = true;
if (writingErrors)
// we are loading by a single ManifestPath so expect max of 1
if(moduleProxies.Count > 0)
{
message = StringUtil.Format(
Modules.ImplicitWinCompatDisabled,
moduleManifestPath,
string.Join(',', inferredCompatiblePSEditions));

ErrorRecord er = new ErrorRecord(
new InvalidOperationException(message),
nameof(Modules) + "_" + nameof(Modules.ImplicitWinCompatDisabled),
ErrorCategory.ResourceUnavailable,
moduleManifestPath);

WriteError(er);
return moduleProxies[0];
}

if (bailOnFirstError)
else
{
// If we're trying to load the module, return null so that caches
// are not polluted
if (importingModule)
{
return null;
}

// If we return null with Get-Module, a fake module info will be created. Since
// we want to suppress output of the module, we need to do that here.
return new PSModuleInfo(moduleManifestPath, context: null, sessionState: null)
{
HadErrorsLoading = true,
IsConsideredEditionCompatible = false,
};
return null;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public object PrivateData
/// Gets or sets whether or not the module requires explicit user acceptance for install/update/save.
/// </summary>
[Parameter]
public SwitchParameter RequireLicenseAcceptance { get; set; }
public SwitchParameter RequireLicenseAcceptance { get; set; } = true;

/// <summary>
/// Gets or sets the external module dependencies.
Expand Down
13 changes: 0 additions & 13 deletions src/System.Management.Automation/engine/PSConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ internal sealed class PowerShellConfig
{
private const string ConfigFileName = "powershell.config.json";
private const string ExecutionPolicyDefaultShellKey = "Microsoft.PowerShell:ExecutionPolicy";
private const string DisableImplicitWinCompatKey = "DisableImplicitWinCompat";

// Provide a singleton
internal static readonly PowerShellConfig Instance = new PowerShellConfig();
Expand Down Expand Up @@ -215,18 +214,6 @@ internal void SetExperimentalFeatures(ConfigScope scope, string featureName, boo
}
}

internal bool IsImplicitWinCompatEnabled()
{
bool? settingValue = ReadValueFromFile<bool?>(ConfigScope.CurrentUser, DisableImplicitWinCompatKey);
if (!settingValue.HasValue)
{
// if the setting is not mentioned in configuration files, then the default DisableImplicitWinCompat value is False
settingValue = ReadValueFromFile<bool?>(ConfigScope.AllUsers, DisableImplicitWinCompatKey, defaultValue: false);
}

return !settingValue.Value;
}

/// <summary>
/// Corresponding settings of the original Group Policies.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,6 @@ public SwitchParameter HideComputerName
[Parameter(ParameterSetName = InvokeCommandCommand.FilePathUriParameterSet)]
[Parameter(ParameterSetName = InvokeCommandCommand.ContainerIdParameterSet)]
[Parameter(ParameterSetName = InvokeCommandCommand.FilePathContainerIdParameterSet)]
[Parameter(ParameterSetName = InvokeCommandCommand.SSHHostHashParameterSet)]
[Parameter(ParameterSetName = InvokeCommandCommand.SSHHostParameterSet)]
public string JobName
{
get
Expand Down
Loading