Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f9c95f6
[automation] Auto-update linters version, help and documentation
nvuillam Apr 25, 2025
6e175bc
[MegaLinter] Apply linters fixes
nvuillam Apr 25, 2025
0570ea2
Sanitize all linter outputs by default
nvuillam Apr 26, 2025
01c5672
Merge remote-tracking branch 'origin/main' into fixes/sanitize-logs-b…
nvuillam Apr 26, 2025
b36f404
fix
nvuillam Apr 26, 2025
31ae042
Merge remote-tracking branch 'origin/main' into fixes/sanitize-logs-b…
nvuillam Apr 26, 2025
1f73587
fix
nvuillam Apr 26, 2025
1d70306
fixes regex patterns
nvuillam Apr 26, 2025
59bb841
Fixes
nvuillam Apr 26, 2025
1bde829
cspell
nvuillam Apr 26, 2025
d9de77e
mypy
nvuillam Apr 26, 2025
8839376
gl
nvuillam Apr 26, 2025
a7027a6
cfg
nvuillam Apr 26, 2025
21c8305
fix
nvuillam Apr 26, 2025
364437f
try again
nvuillam Apr 26, 2025
b87a8f3
trufflehogignore
nvuillam Apr 26, 2025
a9ffe77
TrufflehogLinter
nvuillam Apr 27, 2025
1042dea
cspell
nvuillam Apr 27, 2025
a982342
rename method
nvuillam Apr 27, 2025
41ef6dc
try to fix regex pattern
nvuillam Apr 27, 2025
37ab697
Fix sanitization to not break json
nvuillam Apr 27, 2025
36f4dff
fix test
nvuillam Apr 27, 2025
cf12255
[MegaLinter] Apply linters fixes
nvuillam Apr 27, 2025
8488485
Merge remote-tracking branch 'origin/fixes/sanitize-logs-by-default' …
nvuillam Apr 27, 2025
128bb33
fix test case
nvuillam Apr 27, 2025
33cf552
Improve test cases perfs
nvuillam Apr 27, 2025
e8907d2
fix
nvuillam Apr 27, 2025
0cdfc41
fix
nvuillam Apr 27, 2025
c81b2a4
move get_descriptor_dir to utils
nvuillam Apr 27, 2025
98a3b43
change replacement expression
nvuillam Apr 27, 2025
58b1025
[MegaLinter] Apply linters fixes
nvuillam Apr 27, 2025
c96dca5
Fix
nvuillam Apr 27, 2025
f4d44ec
Merge remote-tracking branch 'origin/fixes/sanitize-logs-by-default' …
nvuillam Apr 27, 2025
e4ba547
[MegaLinter] Apply linters fixes
nvuillam Apr 27, 2025
9051c48
Merge remote-tracking branch 'origin/fixes/sanitize-logs-by-default' …
nvuillam Apr 27, 2025
64353d7
Merge remote-tracking branch 'origin/fixes/sanitize-logs-by-default' …
nvuillam Apr 27, 2025
40f7f0f
Fix test
nvuillam Apr 27, 2025
d2c068e
Do not sanitize formatters to improve perfs
nvuillam Apr 27, 2025
01478c2
py
nvuillam Apr 27, 2025
0f28058
[MegaLinter] Apply linters fixes
nvuillam Apr 27, 2025
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
6 changes: 3 additions & 3 deletions .automation/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2887,8 +2887,8 @@ def collect_linter_previews():
logging.error(str(e))
if title is not None:
item = {
"title": megalinter.utils.decode_utf8(title),
"description": megalinter.utils.decode_utf8(description),
"title": megalinter.utils.clean_string(title),
"description": megalinter.utils.clean_string(description),
"image": image,
}
data[linter.linter_name] = item
Expand Down Expand Up @@ -3378,7 +3378,7 @@ def reformat_markdown_tables():
shell=True,
executable=None if sys.platform == "win32" else which("bash"),
)
stdout = utils.decode_utf8(process.stdout)
stdout = utils.clean_string(process.stdout)
logging.info(f"Format table results: ({process.returncode})\n" + stdout)


Expand Down
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
".lycheeignore"
],
"ignoreWords": [
"AKIAIOSFODNN",
"ARGTOP",
"AROA47DSWDEZA3",
"ASPM",
Expand Down Expand Up @@ -1500,6 +1501,7 @@
"trivyignore",
"trollface",
"trufflehog",
"trufflehogignore",
"trufflesecurity",
"tsql",
"tsqllint",
Expand Down
3 changes: 2 additions & 1 deletion .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ DISABLE_ERRORS_LINTERS:
- REPOSITORY_DEVSKIM
- REPOSITORY_GRYPE
- REPOSITORY_SEMGREP
- REPOSITORY_TRUFFLEHOG
- SPELL_LYCHEE
PRINT_ALL_FILES: false
FILTER_REGEX_EXCLUDE: '(\.automation/test|\.automation/generated|\.venv|\.github/workflows|docs/javascripts|docs/overrides|docs/json-schemas|flavors|clj-kondo|TEMPLATES)'
Expand All @@ -46,6 +45,8 @@ REPOSITORY_TRIVY_ARGUMENTS:
- ".automation/test"
- "--skip-dirs"
- ".venv"
REPOSITORY_TRUFFLEHOG_ARGUMENTS:
- --exclude-paths=.trufflehogignore
SHOW_ELAPSED_TIME: true
FLAVOR_SUGGESTIONS: false
EMAIL_REPORTER: false
Expand Down
3 changes: 2 additions & 1 deletion .secretlintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.automation/test
megalinter-reports
**/tests/test_megalinter/utils_test.py
**/updated_dev_sources/**
2 changes: 2 additions & 0 deletions .trufflehogignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git/
.automation/test/gitleaks/bad
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l

- Linters enhancements
- [editorconfig_checker](https://megalinter.io/latest/descriptors/editorconfig_editorconfig_checker/) Changes default EditorConfig-Checker config filename by @llaville in <https://github.com/oxsecurity/megalinter/issues/5061>
- [TruffleHog](https://megalinter.io/latest/descriptors/repository_trufflehog/): Ignore .git by default if not already done using --exclude-paths option

- Fixes
- Sanitize all linter outputs by default

- Reporters

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1132,11 +1132,11 @@ You may see **github permission errors**, or workflows not run on the new commit
To solve these issues, you can apply one of the following solutions.

- Method 1: The most secured
- [Create Fine Grained Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-fine-grained-personal-access-token), scoped only on your repository and then copy the PAT value
- [Create Fine Grained Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-fine-grained-personal-access-token), scoped only on your repository and with **Contents: Read/Write** and then copy the PAT value
- [Define environment secret variable](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-an-environment) named **PAT** on your repository, and paste the PAT value
- Update your Github Actions Workflow to add the environment name

- Method 2: Easier, but any contributor with write access can see your Personal Access Token
- Method 2: Easier, but any contributor with write access can see your Personal Access Token, so use it only on private repositories.
- [Create Classic Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token#creating-a-token), then copy the PAT value
- [Define secret variable](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) named **PAT** on your repository, and paste the PAT value

Expand Down
1 change: 1 addition & 0 deletions TEMPLATES/.trufflehogignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git/
10 changes: 6 additions & 4 deletions megalinter/Linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ def execute_lint_command(self, command):
),
)
return_code = process.returncode
return_stdout = utils.decode_utf8(process.stdout)
return_stdout = utils.clean_string(process.stdout, not self.is_formatter)
else:
# Use full executable path if we are on Windows
if sys.platform == "win32":
Expand All @@ -1081,7 +1081,9 @@ def execute_lint_command(self, command):
cwd=cwd,
)
return_code = process.returncode
return_stdout = utils.decode_utf8(process.stdout)
return_stdout = utils.clean_string(
process.stdout, not self.is_formatter
)
except FileNotFoundError as err:
return_code = 999
return_stdout = (
Expand Down Expand Up @@ -1198,7 +1200,7 @@ def get_linter_version_output(self):
env=subprocess_env,
)
return_code = process.returncode
output = utils.decode_utf8(process.stdout)
output = utils.clean_string(process.stdout)
logging.debug("Linter version result: " + str(return_code) + " " + output)
except FileNotFoundError:
logging.warning("Unable to call command [" + " ".join(command) + "]")
Expand Down Expand Up @@ -1246,7 +1248,7 @@ def get_linter_help(self):
env=subprocess_env,
)
return_code = process.returncode
output += utils.decode_utf8(process.stdout)
output += utils.clean_string(process.stdout)
logging.debug("Linter help result: " + str(return_code) + " " + output)
except FileNotFoundError:
logging.warning("Unable to call command [" + " ".join(command) + "]")
Expand Down
10 changes: 1 addition & 9 deletions megalinter/MegaLinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,7 @@ def __init__(self, params=None):
manage_upgrade_message()
display_header(self)
# MegaLinter default rules location
self.default_rules_location = (
"/action/lib/.automation"
if os.path.isdir("/action/lib/.automation")
else os.path.relpath(
os.path.relpath(
os.path.dirname(os.path.abspath(__file__)) + "/../TEMPLATES"
)
)
)
self.default_rules_location = utils.get_default_rules_location()
# User-defined rules location
self.linter_rules_path = self.github_workspace + os.path.sep + ".github/linters"

Expand Down
Loading