Hi, I have a pipe for secret scanning like this :
- step: name: Secret Scanning script:
- pipe: atlassian/git-secrets-scan:0.4.3
variables:
FILES: "**/*.json ."
I am expecting it to scan my appSettings.json file for exposed secrets, which is placed in my project directory, but it does not. Is there a way I can check what all files it scanned? And does it generate a default report that I can use later in my step?
Hi @Sachin Kaushik . Thanks for your feedback.
This pipe is based on gitleaks tool.
I also tested your case with using gitleaks:
appSettings.json
{
"ConnectionStrings": {
"TestConn": "Data Source=my-test-db;Password=AKIAKEGEYJSDOHQYTEST;Initial Catalog=MyCat;Integrated Security=False;MultiSubnetFailover=true"
}
}
And gitleaks found a secret inside a file.
○
│╲
│ ○
○ ░
░ gitleaks
10:57AM INF scan completed in 1.17ms
10:57AM WRN leaks found: 1
But here was used AWS pattern, that presented in gitleaks default config.
In case the tool does not scan your secret, you could extend gitleaks config with a required pattern and use it in pipe:
script: - pipe: atlassian/git-secrets-scan:3.0.0 variables: DEBUG: "true" GITLEAKS_COMMAND: "dir" GITLEAKS_EXTRA_ARGS: - "./path_to_directory_or_file" - "--config=my-gitleaks-config.toml"
Regards, Igor
Thanks for looking further into this, Igor! I was hoping that it would detect the text "password" in the JSON file and flag a violation, whatever format the password string might be. Looking at the default gitleaks config, I wonder why it did not fall under rule id = "generic-api-key" (line 535).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sachin Kaushik you could try https://regex101.com/ and see
that selected pattern is not match with content of the appSettings.json.
Also, i think, you could ask here about your case.
Regards, Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sachin Kaushik. Thanks for your question.
First of all try to update git-secrets-scan pipe to the latest version, so the reports feature will be enabled in this pipe.
I suggest to try basic example so your full repository will be scanned by the tool.
script: - pipe: atlassian/git-secrets-scan:3.0.0
In case you want some specific folder to be scanned you could try this example:
script: - pipe: atlassian/git-secrets-scan:3.0.0 variables: GITLEAKS_COMMAND: "dir" GITLEAKS_EXTRA_ARGS: "./path_to_directory_or_file"
Regards, Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.