secretlint

Secretlint CLI that scan secret/credential data.

MIT 126 个版本
安装
npm install secretlint
yarn add secretlint
pnpm add secretlint
bun add secretlint
README

secretlint

Secretlint CLI that scan secret/credential data.

Install

Install with npm:

npm install secretlint

Usage

Usage
  $ secretlint [file|glob*]

Note
  supported glob syntax is based on picomatch (the engine used by micromatch)
  https://github.com/micromatch/picomatch#globbing-features
  https://github.com/micromatch/micromatch#matching-features

Options
  --init             setup config file. Create .secretlintrc.json file from your package.json
  --format           [String] formatter name. Default: "stylish". Available Formatter: ${getFormatterList()
      .map((item) => item.name)
      .join(", ")}
  --output           [path:String] output file path that is written of reported result.
  --secretlintrc     [path:String] path to .secretlintrc config file. Default: .secretlintrc.*
  --secretlintignore [path:String] path to .secretlintignore file. Default: .secretlintignore
  --stdinFileName    [String] filename to process STDIN content. Some rules depend on filename to check content.
  --no-color         disable ANSI-color of output.
  --no-terminalLink  disable terminalLink of output.
  --no-maskSecrets   disable masking of secret values; secrets are masked by default.
  --no-glob          disable glob pattern interpretation; treat all inputs as literal file paths.
  --no-gitignore     disable .gitignore cascade respect; .gitignore files are
                     respected by default (since v13).

Options for Developer
  --profile          Enable performance profile. 
  --secretlintrcJSON [String] a JSON string of .secretlintrc. use JSON string instead of rc file.

Experimental Options
  --locale            [String] locale tag for translating message. Default: en

Examples
  # Scan a single file
  $ secretlint ./README.md

  # Scan all files (wrap glob in double quotes to avoid shell expansion)
  $ secretlint "**/*"
  $ secretlint "source/**/*.ini"

  # Treat inputs as literal paths (for SvelteKit (group) / Next.js [param] etc.)
  $ secretlint --no-glob "src/(auth)/login.ts"

  # Lint STDIN content (filename hint affects which rules apply)
  $ echo "SECRET" | secretlint --stdinFileName=secret.txt

  # Use a custom config file
  $ secretlint "**/*" --secretlintrc=.secretlintrc.custom.json

  # Scan files ignored by .gitignore (e.g. to verify build artifacts)
  $ secretlint --no-gitignore "dist/**/*"

  # Mask secrets in a file in-place
  $ secretlint .zsh_history --format=mask-result --output=.zsh_history

  # Output JSON for programmatic parsing
  $ secretlint "**/*" --format=json --output=secretlint-report.json

  # Output GitHub Actions annotations in CI
  $ secretlint "**/*" --format=github

Exit Status
  Secretlint exits with the following values:

  - 0: 
    - Linting succeeded, no errors found. 
    - Found lint error but --output is specified.
  - 1: 
    - Linting failed, errors found.
  - 2: 
    - Unexpected error occurred, fatal error.

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

版本列表
13.0.2 2026-05-15
13.0.0 2026-05-04
12.3.1 2026-04-26
12.3.0 2026-04-26
12.2.0 2026-04-21
12.1.0 2026-04-20
12.0.1 2026-04-19
12.0.0 2026-04-19
11.7.1 2026-04-13
11.6.0 2026-04-06
11.4.1 2026-03-29
11.4.0 2026-03-21
11.3.1 2026-01-28
11.3.0 2026-01-13
11.2.5 2025-10-11
11.2.4 2025-09-08
11.2.3 2025-09-06
11.2.2 2025-09-06
11.2.0 2025-08-25
11.1.0 2025-08-24
11.0.2 2025-08-11
11.0.1 2025-08-10
11.0.0 2025-08-10
10.2.2 2025-08-04
10.2.1 2025-07-16
10.2.0 2025-07-06
10.1.1 2025-06-24
10.1.0 2025-06-14
10.0.0 2025-06-14
9.3.4 2025-06-03
9.3.3 2025-05-22
9.3.2 2025-05-01
9.3.1 2025-04-14
9.3.0 2025-04-01
9.2.1 2025-03-31
9.2.0 2025-02-23
9.1.0 2025-02-23
9.0.0 2024-10-14
8.5.0 2024-10-14
8.4.0 2024-10-06
8.3.3 2024-10-06
8.3.2 2024-10-05
8.3.1 2024-10-05
8.3.0 2024-10-05
8.2.4 2024-04-29
8.2.3 2024-04-07
8.2.2 2024-04-07
8.2.1 2024-04-06
8.2.0 2024-04-06
8.1.2 2024-02-17
8.1.1 2024-01-30
8.1.0 2023-12-28
8.0.0 2023-11-29
7.2.0 2023-11-27
7.1.0 2023-11-12
7.0.8 2023-11-12
7.0.7 2023-08-07
7.0.6 2023-08-06
7.0.5 2023-08-06
7.0.4 2023-08-05
7.0.3 2023-07-08
7.0.2 2023-07-03
7.0.1 2023-07-03
7.0.0-beta.68 2023-07-02
7.0.0-beta.66 2023-07-02
7.0.0-beta.65 2023-07-02
7.0.0-beta.64 2023-07-02
7.0.0 2023-07-02
6.2.4 2023-06-30
6.2.3 2023-02-11
6.2.2 2023-02-11
6.2.1 2023-02-11
6.2.0 2023-02-03
6.1.0 2023-02-02
6.0.2 2023-01-03
6.0.1 2023-01-02
5.3.0 2022-10-30
5.2.4 2022-08-24
5.2.3 2022-06-28
5.2.2 2022-06-28
5.2.1 2022-06-26
5.2.0 2022-04-11
5.1.3 2022-04-04
5.1.2 2022-04-04
5.1.1 2022-03-24
5.1.0 2022-03-08
5.0.1 2022-03-05
5.0.0 2022-03-05
4.2.0 2022-03-02
4.1.4 2022-01-13
4.1.3 2021-10-13
4.1.1 2021-10-11
4.1.0 2021-09-25
4.0.0 2021-09-15
3.3.1-next.19 2021-09-15
3.3.0 2021-07-05
3.2.0 2021-06-27
3.1.0 2021-06-24
3.0.0 2021-05-29
2.2.0 2021-05-27
2.1.1 2020-11-04
2.1.0 2020-06-16
2.0.0 2020-04-29
1.1.0 2020-04-04
1.0.5 2020-04-03
1.0.4 2020-03-31
1.0.3 2020-03-30
1.0.1 2020-03-29
1.0.0 2020-03-19
0.10.1 2020-03-18
0.10.0 2020-03-18
0.9.2 2020-03-16
0.8.1 2020-03-11
0.8.0 2020-03-08
0.7.3 2020-03-01
0.7.2 2020-03-01
0.7.0 2020-03-01
0.6.0 2020-02-29
0.5.0 2020-02-28
0.4.2 2020-02-28
0.4.1 2020-02-28
0.4.0 2020-02-28
0.2.0 2020-02-23
0.1.2 2020-02-16
0.1.1 2020-02-16
0.1.0 2020-02-16