Thanks to visit codestin.com
Credit goes to github.com

Skip to content

v8.28.0

Choose a tag to compare

@zricethezav zricethezav released this 20 Jul 16:18
· 7 commits to master since this release
4fb4382

Changelog

Optimizations

#1909 waits to find newlines until a match. This ends up saving a boat load of time since before we were finding newlines for every fragment regardless if a rule matched or not.
#1908 promoted @rgmz excellent stopword optimization

Composite Rules (Multi-part or required Rules) #1905

In v8.28.0 Gitleaks introduced composite rules, which are made up of a single "primary" rule and one or more auxiliary or required rules. To create a composite rule, add a [[rules.required]] table to the primary rule specifying an id and optionally withinLines and/or withinColumns proximity constraints. A fragment is a chunk of content that Gitleaks processes at once (typically a file, part of a file, or git diff), and proximity matching instructs the primary rule to only report a finding if the auxiliary required rules also find matches within the specified area of the fragment.

Proximity matching: Using the withinLines and withinColumns fields instructs the primary rule to only report a finding if the auxiliary required rules also find matches within the specified proximity. You can set:

  • withinLines: N - required findings must be within N lines (vertically)
  • withinColumns: N - required findings must be within N characters (horizontally)
  • Both - creates a rectangular search area (both constraints must be satisfied)
  • Neither - fragment-level matching (required findings can be anywhere in the same fragment)

Here are diagrams illustrating each proximity behavior:

p = primary captured secret
a = auxiliary (required) captured secret
fragment = section of data gitleaks is looking at


    *Fragment-level proximity*               
    Any required finding in the fragment
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”                       
   β”Œβ”€β”€β”€β”€β”€β”€β”€fragmentβ”œβ”€β”€β”€β”€β”€β”                 
   β”‚      └──────┬──     β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”       
   β”‚             β”‚aβ”‚β—€β”€β”€β”€β”€β”Όβ”€β”‚βœ“ MATCHβ”‚       
   β”‚          β”Œβ”€β”β””β”€β”˜     β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”˜       
   β”‚β”Œβ”€β”       β”‚pβ”‚        β”‚                 
   β”‚β”‚aβ”‚    β”Œβ”€β”β””β”€β”˜        β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”       
   β”‚β””β”€β”˜    β”‚aβ”‚β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”‚βœ“ MATCHβ”‚       
   β””β”€β–²β”€β”€β”€β”€β”€β”΄β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”˜       
     β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”                        
     β””β”€β”€β”€β”€β”‚βœ“ MATCHβ”‚                        
          β””β”€β”€β”€β”€β”€β”€β”€β”˜                        
                                           
                                           
   *Column bounded proximity*
   `withinColumns = 3`                    
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”                       
   β”Œβ”€β”€β”€β”€β”¬β”€β”€fragmentβ”œβ”€β”¬β”€β”€β”€β”                 
   β”‚      └──────┬──     β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   
   β”‚    β”‚        β”‚a│◀┼───┼─│+1C βœ“ MATCHβ”‚   
   β”‚          β”Œβ”€β”β””β”€β”˜     β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   
   β”‚β”Œβ”€β” β”‚     β”‚pβ”‚    β”‚   β”‚                 
β”Œβ”€β”€β–Άβ”‚aβ”‚  β”Œβ”€β”  β””β”€β”˜        β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   
β”‚  β”‚β””β”€β”˜ β”‚β”‚a│◀────────┼───┼─│-2C βœ“ MATCHβ”‚   
β”‚  β”‚       β”˜             β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   
β”‚  └── -3C ───0C─── +3C β”€β”˜                 
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             
β”‚  β”‚ -4C βœ— NOβ”‚                             
└──│  MATCH  β”‚                             
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                             
                                           
                                           
   *Line bounded proximity*
   `withinLines = 4`                      
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”                        
   β”Œβ”€β”€β”€β”€β”€β”€fragmentβ”œβ”€β”€β”€β”€β”€β”                  
  +4L─ ─ β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”€ ─ ─│                  
   β”‚                    β”‚                  
   β”‚              β”Œβ”€β”   β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   
   β”‚         β”Œβ”€β”  β”‚a│◀──┼─│+1L βœ“ MATCH β”‚   
   0L  β”Œβ”€β”   β”‚pβ”‚  β””β”€β”˜   β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   
   β”‚   β”‚a│◀──┴─┴────────┼─│-1L βœ“ MATCH β”‚   
   β”‚   β””β”€β”˜              β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   
   β”‚                    β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”      
  -4L─ ─ ─ ─ ─ ─ ─ β”€β”Œβ”€β”β”€β”‚ β”‚-5L βœ— NO β”‚      
   β”‚                β”‚a│◀┼─│  MATCH  β”‚      
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”΄β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      
                                           
                                           
   *Line and column bounded proximity*
   `withinLines = 4`                      
   `withinColumns = 3`                    
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”                        
   β”Œβ”€β”€β”€β”€β”€β”€fragmentβ”œβ”€β”€β”€β”€β”€β”                  
  +4L   β”Œβ””β”€β”€β”€β”€β”€β”€β”€β”€β”΄ ┐   β”‚                  
   β”‚            β”Œβ”€β”     β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚    β”‚       β”‚a│◀┼───┼─│+2L/+1C βœ“ MATCHβ”‚
   β”‚         β”Œβ”€β”β””β”€β”˜     β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   0L   β”‚    β”‚pβ”‚    β”‚   β”‚                  
   β”‚         β””β”€β”˜        β”‚                  
   β”‚    β”‚           β”‚   β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   
  -4L    ─ ─ ─ ─ ─ β”€β”Œβ”€β” β”‚ β”‚-5L/+3C βœ— NOβ”‚   
   β”‚                β”‚a│◀┼─│   MATCH    β”‚   
   └───-3C────0L───+3Cβ”΄β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜