Skip to content

Commit

Permalink
Merge pull request #99 from teowa/fix_errmessage
Browse files Browse the repository at this point in the history
`armstrong credscan` - fix error message
  • Loading branch information
ms-henglu committed Apr 24, 2024
2 parents 109e9a4 + c5987a8 commit 67fe406
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions commands/credential_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (c CredentialScanCommand) Execute() int {
if !strings.HasPrefix(v, "$") || strings.HasPrefix(v, "$local.") {
credScanErr := makeCredScanError(
azapiResource,
"cannot use plain text or 'local' for secret, use 'variable' instead",
"cannot use plain text or 'local' for secret, please follow https://github.com/Azure/armstrong/blob/main/docs/guidance-for-api-test.md#4-q-i-have-some-sensitive-information-in-the-test-case-how-to-hide-it to hide the secret values",
k,
)
credScanErrors = append(credScanErrors, credScanErr)
Expand All @@ -314,7 +314,7 @@ func (c CredentialScanCommand) Execute() int {
if !ok {
credScanErr := makeCredScanError(
azapiResource,
fmt.Sprintf("variable %q was not found", varName),
fmt.Sprintf("variable %q was not found, please follow https://github.com/Azure/armstrong/blob/main/docs/guidance-for-api-test.md#4-q-i-have-some-sensitive-information-in-the-test-case-how-to-hide-it to set the variable for secret values", varName),
k,
)
credScanErrors = append(credScanErrors, credScanErr)
Expand All @@ -326,7 +326,7 @@ func (c CredentialScanCommand) Execute() int {
if theVar.HasDefault {
credScanErr := makeCredScanError(
azapiResource,
fmt.Sprintf("variable %q (%v:%v) used in secret field but has a default value, please remove the default value", varName, theVar.FileName, theVar.LineNumber),
fmt.Sprintf("variable %q (%v:%v) used in secret field but has a default value, please follow https://github.com/Azure/armstrong/blob/main/docs/guidance-for-api-test.md#4-q-i-have-some-sensitive-information-in-the-test-case-how-to-hide-it to set the variable for secret values", varName, theVar.FileName, theVar.LineNumber),
k,
)
credScanErrors = append(credScanErrors, credScanErr)
Expand All @@ -336,7 +336,7 @@ func (c CredentialScanCommand) Execute() int {
if !theVar.IsSensitive {
credScanErr := makeCredScanError(
azapiResource,
fmt.Sprintf("variable %q (%v:%v) used in secret field but is not marked as sensitive, please add \"sensitive=true\" for the variable", varName, theVar.FileName, theVar.LineNumber),
fmt.Sprintf("variable %q (%v:%v) used in secret field but is not marked as sensitive, please follow https://github.com/Azure/armstrong/blob/main/docs/guidance-for-api-test.md#4-q-i-have-some-sensitive-information-in-the-test-case-how-to-hide-it to set the variable for secret values", varName, theVar.FileName, theVar.LineNumber),
k,
)
credScanErrors = append(credScanErrors, credScanErr)
Expand Down Expand Up @@ -461,7 +461,7 @@ func checkAzureProviderSecret(azureProvider hcl.AzureProvider, propertyName, pro
if !ok {
credScanErr := makeCredScanErrorForProvider(
azureProvider,
fmt.Sprintf("variable %q was not found", varName),
fmt.Sprintf("variable %q was not found, please follow https://github.com/Azure/armstrong/blob/main/docs/guidance-for-api-test.md#4-q-i-have-some-sensitive-information-in-the-test-case-how-to-hide-it to set the variable for secret values", varName),
propertyName,
)
credScanErrors = append(credScanErrors, credScanErr)
Expand All @@ -473,7 +473,7 @@ func checkAzureProviderSecret(azureProvider hcl.AzureProvider, propertyName, pro
if theVar.HasDefault {
credScanErr := makeCredScanErrorForProvider(
azureProvider,
fmt.Sprintf("variable %q (%v:%v) used in secret field but has a default value, please remove the default value", varName, theVar.FileName, theVar.LineNumber),
fmt.Sprintf("variable %q (%v:%v) used in secret field but has a default value, please follow https://github.com/Azure/armstrong/blob/main/docs/guidance-for-api-test.md#4-q-i-have-some-sensitive-information-in-the-test-case-how-to-hide-it to set the variable for secret values", varName, theVar.FileName, theVar.LineNumber),
propertyName,
)
credScanErrors = append(credScanErrors, credScanErr)
Expand All @@ -483,7 +483,7 @@ func checkAzureProviderSecret(azureProvider hcl.AzureProvider, propertyName, pro
if !theVar.IsSensitive {
credScanErr := makeCredScanErrorForProvider(
azureProvider,
fmt.Sprintf("variable %q (%v:%v) used in secret field but is not marked as sensitive, please add \"sensitive=true\" for the variable", varName, theVar.FileName, theVar.LineNumber),
fmt.Sprintf("variable %q (%v:%v) used in secret field but is not marked as sensitive, please follow https://github.com/Azure/armstrong/blob/main/docs/guidance-for-api-test.md#4-q-i-have-some-sensitive-information-in-the-test-case-how-to-hide-it to set the variable for secret values", varName, theVar.FileName, theVar.LineNumber),
propertyName,
)
credScanErrors = append(credScanErrors, credScanErr)
Expand Down

0 comments on commit 67fe406

Please sign in to comment.