Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions config/rules/ccnumber.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# permissions and limitations under the License.

---
description: This module identifies potential American Express credit card numbers in files. It uses a regular expression to match patterns that resemble American Express card numbers, which typically start with 34 or 37 and are 15 digits long. The rule also includes a post-processing step to validate the matched numbers using the Luhn algorithm (mod10). If a potential credit card number is found, it will be redacted in the output to protect sensitive information.
Searcharea: body
rules:
- Code: 2001
Expand Down
1 change: 1 addition & 0 deletions config/rules/content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# permissions and limitations under the License.

---
description: This module check for the presence of potential sensitive information in files. It uses a variety of regular expressions to identify patterns that may indicate the presence of sensitive data, such as keys, passwords, phone numbers, email addresses, IP addresses, social security numbers, national IDs, passport numbers, and deprecated cryptographic methods. The rules are designed to help identify potential security risks and protect sensitive information from being exposed. Each rule includes a post-processing step to further analyze the matched data and determine if it is indeed sensitive information.
Searcharea: body
rules:
- Code: 3009
Expand Down
1 change: 1 addition & 0 deletions config/rules/filename.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# permissions and limitations under the License.

---
description: This module check for the presence of sensitive files and cryptographic keys based on filename patterns. It uses regular expressions to identify filenames that are commonly associated with private keys, configuration files, log files, database dumps, and other sensitive information. The rules in this module can help identify potential security risks where sensitive files may have been inadvertently included in a code repository or exposed in a file system. Each rule includes a severity level and confidence score to help prioritize findings.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'checks' maybe?
Same with the other file too.

Searcharea: filename
rules:
- Code: 4001
Expand Down
1 change: 1 addition & 0 deletions config/rules/inclusivity-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# permissions and limitations under the License.

---
description: This module checks for the presence of the terms "whitelist", "blacklist", "master", and "slave" in code, which are considered oppressive metaphors. The use of these terms can perpetuate harmful stereotypes and contribute to an unwelcoming environment. The rules in this module aim to promote inclusivity by encouraging developers to use more neutral language in their coding practices.
Searcharea: body
rules:
- Code: 20001
Expand Down
1 change: 1 addition & 0 deletions config/rules/password-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# permissions and limitations under the License.

---
description: This module checks for passwords and secrets in files. It includes rules for identifying potential default passwords, as well as patterns that may indicate the presence of sensitive information such as API keys, access tokens, and database connection strings. The rules use regular expressions to match common naming conventions for passwords and secrets, and they also include post-processing steps to extract the relevant information for further analysis or redaction.
Searcharea: body
rules:
- Code: 1002
Expand Down
2 changes: 2 additions & 0 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ Usage of go-earlybird:
Set number of workers. (default 100)
-worksize int
Set Line Wrap Length. (default 2500)
-list-available-modules
List available scanning modules. This is useful when inporting configurations from a file and you want to know the module available to configure.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing.. spell check pls.

-module-config-file string
Absolute path to a json or yaml file for per module level config -- {"modules": { "aModule": { "display_severity": "medium" } } }
```
Expand Down
1 change: 1 addition & 0 deletions pkg/config/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type EarlybirdConfig struct {
ShowFullLine bool
FailScan bool
RulesOnly bool
ModuleOnly bool
ExtensionsToSkipScan []string
AnnotationsToSkipLine []string
SkipComments bool
Expand Down
1 change: 1 addition & 0 deletions pkg/core/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
ptrShowFullLine = flag.Bool("show-full-line", false, "Display the full line where the pattern match was found (warning: this can be dangerous with minified script files)")
ptrConfigDir = flag.String("config", utils.GetConfigDir(), "Directory where configuration files are stored")
ptrRulesOnly = flag.Bool("show-rules-only", false, "Display rules that would be run, but do not execute a scan")
ptrAvailableModules = flag.Bool("list-available-modules", false, "Display modules that are available, but do not execute a scan")
ptrSkipComments = flag.Bool("skip-comments", false, "Skip scanning comments in files -- applies only to the 'content' module")
ptrIgnoreFPRules = flag.Bool("ignore-fp-rules", false, "Ignore the false positive post-process rules")
ptrShowSolutions = flag.Bool("show-solutions", false, "Display recommended solution for each finding")
Expand Down
1 change: 1 addition & 0 deletions pkg/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func (eb *EarlybirdCfg) ConfigInit() {
eb.Config.IgnoreFailure = *ptrIgnoreFailure
eb.Config.GitStream = *ptrGitStreamInput
eb.Config.RulesOnly = *ptrRulesOnly
eb.Config.ModuleOnly = *ptrAvailableModules
eb.Config.SkipComments = *ptrSkipComments
eb.Config.IgnoreFPRules = *ptrIgnoreFPRules
eb.Config.ShowSolutions = *ptrShowSolutions
Expand Down
18 changes: 18 additions & 0 deletions pkg/scan/ruleCfgReader.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ func Init(cfg cfgreader.EarlybirdConfig) {
fmt.Println("Max file size to scan: ", cfg.MaxFileSize, " bytes")
}

if cfg.ModuleOnly {
fmt.Println("\n\nAvailable Module List")
for moduleName, fileName := range cfg.EnabledModulesMap {
// Load the module config file to get the description
var moduleConfig struct {
Description string `json:"description"`
}
modulePath := path.Join(cfg.RulesConfigDir, fileName)
err := cfgreader.LoadConfig(&moduleConfig, modulePath)
if err != nil {
log.Println("Failed to load module file for description:", err)
} else {
fmt.Printf("\n%s: \n%s \n", moduleName, moduleConfig.Description)
}
}
os.Exit(0)
}

// Init rule set for modules
for moduleName, fileName := range cfg.EnabledModulesMap {
log.Println("loading module: ", moduleName)
Expand Down
Loading