forked from dense-analysis/ale
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gitleaks): add support for gitleaks
Closes dense-analysis#4588 feat(gitleaks): add gitleaks linter for sh fix(gitleaks): set lint_file for gitleaks feat(gitleaks): add gitleaks support for multiple file-types fix: add docs and support a few more filetypes docs: add gitleaks docs tests: add gitleaks handler & linter tests docs(gitleaks): add missing docs docs: fix toc & heading sorting docs: fix toc issue
- Loading branch information
Showing
81 changed files
with
864 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Ada files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('ada') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for ansible files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('ansible') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for ASCIIDoc files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('asciidoc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for C files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('c') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for C++ files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('cpp') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for C# files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('cs') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for CSS files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('css') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Dockerfiles. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('dockerfile') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Elixir files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('elixir') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Go files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('go') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Haskell files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('haskell') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for HTML files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Java files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('java') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for JavaScript files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('javascript') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for JSON files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('json') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Lua files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('lua') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Markdown files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('markdown') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for PHP files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('php') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for PowerShell files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('powershell') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Python files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('python') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
scriptencoding utf-8 | ||
" Description: gitleaks support for rego files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('rego') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for ReStructuredText files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('rst') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Ruby files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('ruby') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Rust files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('rust') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Scala files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('scala') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for terraform files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('sh') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for SQL files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('sql') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Swift files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('swift') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for terraform files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('terraform') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for TeX files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('tex') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for TeXInfo files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('texinfo') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for general text files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('text') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for TypeScript files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('typescript') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Vim files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('vim') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Vue files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('vue') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for XHTML files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('xhtml') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for YAML files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('yaml') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: gitleaks support for Zig files. | ||
|
||
call ale#handlers#gitleaks#DefineLinter('zig') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
scriptencoding utf-8 | ||
" Author: Peter Benjamin <https://github.com/pbnj> | ||
" Description: Define a handler function for gitleaks | ||
|
||
call ale#Set('gitleaks_executable', 'gitleaks') | ||
call ale#Set('gitleaks_options', '') | ||
|
||
function! ale#handlers#gitleaks#GetCommand(buffer) abort | ||
return '%e' | ||
\ . ' detect --no-git --no-color --no-banner --redact --verbose --source=%s' | ||
\ . ale#Pad(ale#Var(a:buffer, 'gitleaks_options')) | ||
endfunction | ||
|
||
function! ale#handlers#gitleaks#Handle(buffer, lines) abort | ||
" Look for lines like the following: | ||
" | ||
" Finding: ACCESS_KEY_ID=REDACTED | ||
" Secret: REDACTED | ||
" RuleID: generic-api-key | ||
" Entropy: 3.546594 | ||
" File: tmp/env | ||
" Line: 1 | ||
" Fingerprint: tmp/env:generic-api-key:1 | ||
let l:pattern = '\v^Fingerprint: .*:(.*):(\d+)$' | ||
let l:output = [] | ||
|
||
for l:match in ale#util#GetMatches(a:lines, l:pattern) | ||
call add(l:output, { | ||
\ 'lnum': l:match[2] + 0, | ||
\ 'text': l:match[1], | ||
\ 'type': 'E', | ||
\}) | ||
endfor | ||
|
||
return l:output | ||
endfunction | ||
|
||
function! ale#handlers#gitleaks#DefineLinter(filetype) abort | ||
call ale#Set('gitleaks_executable', 'gitleaks') | ||
call ale#Set('gitleaks_options', '') | ||
|
||
call ale#linter#Define(a:filetype, { | ||
\ 'name': 'gitleaks', | ||
\ 'executable': {b -> ale#Var(b, 'gitleaks_executable')}, | ||
\ 'command': function('ale#handlers#gitleaks#GetCommand'), | ||
\ 'callback': 'ale#handlers#gitleaks#Handle', | ||
\ 'lint_file': 1, | ||
\}) | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.