You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Use OrdinalIgnoreCase for command name comparison.
- Log with Warn or Error where appropriate and emit to log file only as
needed.
- Use explicitly named parameters instead of true/false.
- Remove comment that's no longer valid.
@@ -103,17 +101,18 @@ public static IEnumerable<string> DecryptPackageArgumentsFile(
103
101
catch(Exceptionex)
104
102
{
105
103
varfirstMessage="There was an error attempting to decrypt the contents of the .arguments file for version '{0}' of package '{1}'. See log file for more information.".FormatWith(version,id);
106
-
varsecondMessage="We failed to decrypt {0}. Error from decryption: {1}".FormatWith(argumentsFile,ex.Message);
107
-
104
+
varsecondMessage="We failed to decrypt '{0}'. Error from decryption:{1} '{2}'".FormatWith(argumentsFile,Environment.NewLine,ex.Message);
Copy file name to clipboardExpand all lines: tests/pester-tests/features/ArgumentsDecryption.Tests.ps1
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -77,12 +77,13 @@
77
77
@{
78
78
ErrorType='Base64 invalid'
79
79
DecryptionError='The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.'
80
+
# `!` is an invalid Base64 character: https://en.wikipedia.org/wiki/Base64#Base64_table_from_RFC_4648
80
81
FileContents='InvalidBase64!'
81
82
}
82
83
@{
83
84
ErrorType='Invalid decryption'
84
85
DecryptionError='Key not valid for use in specified state.'
85
-
# The contents of this was taken from a throw away VM.
86
+
# The contents of this was taken from a throw away VM. As such, DPAPI will not be able to decrypt it, and will error.
$Output.Lines| Should -Not:$shouldContain-Contain "We failed to decrypt $($env:ChocolateyInstall)\.chocolatey\upgradepackage.1.0.0\.arguments. Error from decryption: $DecryptionError"-Because $Output.String
114
+
$Output.Lines| Should -Not:$shouldContain-Contain "We failed to decrypt '$($env:ChocolateyInstall)\.chocolatey\upgradepackage.1.0.0\.arguments'. Error from decryption:"-Because $Output.String
115
+
$Output.Lines| Should -Not:$shouldContain-Contain "'$DecryptionError'"-Because $Output.String
0 commit comments