Commit 115b673
committed
fix: prevent jscpd and secretlint report-folder race (#3979)
TextReporter runs per linter the moment it finishes, so JsCpdLinter's
rmtree of megalinter-reports/copy-paste fired while secretlint was still
scanning the workspace in project mode. secretlint had already globbed
the jscpd report into its target set, crashed with ENOENT reading it, and
its stack trace was then parsed as SARIF and counted as a finding.
jscpd now writes its report to a temp folder outside the workspace and
copies it in only when clones are found, so MegaLinter never deletes files
other linters are scanning. secretlint gets a generated ignore file in the
report folder that merges the user's patterns with an exclusion for that
folder alone; narrowing a secrets scanner further would hide credentials
baked into build artifacts.
- fix: report a linter with unparsable SARIF as a warning, not a success
- A linter exiting 0 while emitting a stack trace instead of SARIF was
counted as zero findings and shown green; affects linters declaring
can_output_sarif (REPOSITORY_SECRETLINT, REPOSITORY_SEMGREP,
REPOSITORY_TRIVY). A linter that dies before producing SARIF now fails
with its raw output instead of a phantom finding.
- fix(secretlint): honor ignore patterns when REPORT_OUTPUT_FOLDER is off
- The generated ignore file was only written when reports could be
written; otherwise it fell back to passing a base name, so a
.secretlintignore under LINTER_RULES_PATH silently applied nothing. It
now goes to a temp folder outside the workspace, and the
--secretlintignore=<value> argument form is parsed too.
- fix(secretlint): stop falling back to .gitignore for a missing ignore file
- A typo in --secretlintignore used to promote .gitignore patterns to
authoritative status, excluding the very files a secrets scanner exists
to inspect. It now degrades with a warning and applies no fallback.
- fix(config): always exclude REPORT_OUTPUT_FOLDER from linted directories
- An EXCLUDED_DIRECTORIES override could drop it, making MegaLinter lint
its own output while reporters were still writing to it.
- test: cover jscpd report wiring and isolate ambient env in unit tests
- docs: document the secretlint ignore model and report-folder exclusion
Fixes: #3979
Assisted-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Trevor Vaughan <peiriannydd@gmail.com>1 parent 08af457 commit 115b673
14 files changed
Lines changed: 1527 additions & 64 deletions
File tree
- mega-linter-runner/lib
- megalinter
- descriptors
- schemas
- linters
- tests/test_megalinter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1135 | 1135 | | |
1136 | 1136 | | |
1137 | 1137 | | |
1138 | | - | |
| 1138 | + | |
1139 | 1139 | | |
1140 | 1140 | | |
1141 | 1141 | | |
| |||
1265 | 1265 | | |
1266 | 1266 | | |
1267 | 1267 | | |
| 1268 | + | |
| 1269 | + | |
1268 | 1270 | | |
1269 | 1271 | | |
1270 | 1272 | | |
| |||
1533 | 1535 | | |
1534 | 1536 | | |
1535 | 1537 | | |
1536 | | - | |
| 1538 | + | |
1537 | 1539 | | |
1538 | 1540 | | |
1539 | 1541 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7840 | 7840 | | |
7841 | 7841 | | |
7842 | 7842 | | |
7843 | | - | |
| 7843 | + | |
7844 | 7844 | | |
7845 | 7845 | | |
7846 | 7846 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
937 | 940 | | |
938 | 941 | | |
939 | 942 | | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
940 | 955 | | |
941 | 956 | | |
942 | 957 | | |
| |||
1667 | 1682 | | |
1668 | 1683 | | |
1669 | 1684 | | |
1670 | | - | |
1671 | | - | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
1672 | 1699 | | |
1673 | 1700 | | |
1674 | 1701 | | |
| |||
1711 | 1738 | | |
1712 | 1739 | | |
1713 | 1740 | | |
1714 | | - | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1715 | 1744 | | |
1716 | | - | |
1717 | | - | |
1718 | | - | |
1719 | | - | |
| 1745 | + | |
| 1746 | + | |
1720 | 1747 | | |
1721 | | - | |
| 1748 | + | |
| 1749 | + | |
1722 | 1750 | | |
1723 | 1751 | | |
1724 | 1752 | | |
| |||
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
893 | 902 | | |
894 | 903 | | |
895 | 904 | | |
| |||
909 | 918 | | |
910 | 919 | | |
911 | 920 | | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
918 | 924 | | |
919 | 925 | | |
920 | 926 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9261 | 9261 | | |
9262 | 9262 | | |
9263 | 9263 | | |
9264 | | - | |
| 9264 | + | |
9265 | 9265 | | |
9266 | 9266 | | |
9267 | 9267 | | |
| |||
0 commit comments