-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-563) Warn/Log Environment Variable Changes
Detect environment variable changes during install/upgrade and uninstall. Log all of the changes. Do not log the actual environment variable values by default as they could contain sensitive data. Instead inform the user about the need to flip a feature if they want the value changes logged with a warning that it could disclose sensitive data. Also provide SET type information if the feature is turned on. When environment variables have changed, inform the user they need to take action to see the changes as Windows doesn't automatically update command shells like PowerShell.exe and cmd.exe. Inform cmd.exe users that they can simply type a single command to get their environment updated.
- Loading branch information
1 parent
79353e7
commit fe640fb
Showing
10 changed files
with
301 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/chocolatey/infrastructure.app/domain/GenericRegistryKey.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright © 2011 - Present RealDimensions Software, LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace chocolatey.infrastructure.app.domain | ||
{ | ||
using System.Collections.Generic; | ||
using Microsoft.Win32; | ||
|
||
public class GenericRegistryKey | ||
{ | ||
public string Name { get; set; } | ||
public IEnumerable<GenericRegistryKey> Keys { get; set; } | ||
public IEnumerable<GenericRegistryValue> Values { get; set; } | ||
public RegistryView View { get; set; } | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright © 2011 - Present RealDimensions Software, LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace chocolatey.infrastructure.app.domain | ||
{ | ||
using System; | ||
|
||
public class GenericRegistryValue : IEquatable<GenericRegistryValue> | ||
{ | ||
public string ParentKeyName { get; set; } | ||
public string Name { get; set; } | ||
public string Value { get; set; } | ||
public RegistryValueKindType Type { get; set; } | ||
|
||
public override int GetHashCode() | ||
{ | ||
return ParentKeyName.GetHashCode() | ||
& Name.GetHashCode() | ||
& Value.GetHashCode() | ||
& Type.GetHashCode(); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
return Equals(obj as GenericRegistryValue); | ||
} | ||
|
||
bool IEquatable<GenericRegistryValue>.Equals(GenericRegistryValue other) | ||
{ | ||
if (other == null) return false; | ||
|
||
return ParentKeyName.is_equal_to(other.ParentKeyName) | ||
&& Name.is_equal_to(other.Name) | ||
&& Value.is_equal_to(other.Value) | ||
&& Type.to_string().is_equal_to(other.Type.to_string()) | ||
; | ||
} | ||
|
||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/chocolatey/infrastructure.app/domain/RegistryValueKindType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright © 2011 - Present RealDimensions Software, LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace chocolatey.infrastructure.app.domain | ||
{ | ||
public enum RegistryValueKindType | ||
{ | ||
None = -1, | ||
Unknown = 0, | ||
String = 1, | ||
ExpandString = 2, | ||
Binary = 3, | ||
DWord = 4, | ||
MultiString = 7, | ||
QWord = 11, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.