Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

armstrong credscan - fix error message #99

Merged
merged 2 commits into from
Apr 24, 2024
Merged
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
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
Loading