Archived
- Update SpotBugs to 4.9.8.2 (supports Java 25) - Remove PMD (incompatible API changes in v7) - Add targeted SpotBugs exclusions for false positives - Fix DM_DEFAULT_ENCODING in UsageCollector.java - Adjust JaCoCo branch coverage threshold to 0.57 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
183 lines
6.0 KiB
XML
183 lines
6.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<FindBugsFilter
|
|
xmlns="https://github.com/spotbugs/filter/3.0.0"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
|
|
|
|
<!-- Exclude test classes from certain checks -->
|
|
<Match>
|
|
<Source name="~.*Test\.java"/>
|
|
<Or>
|
|
<Bug pattern="DM_DEFAULT_ENCODING"/>
|
|
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
|
|
</Or>
|
|
</Match>
|
|
|
|
<!-- Exclude generated code -->
|
|
<Match>
|
|
<Source name="~.*[\\/]generated[\\/].*"/>
|
|
</Match>
|
|
|
|
<!-- Allow System.exit in Main class -->
|
|
<Match>
|
|
<Class name="com.samsonmedia.barn.Main"/>
|
|
<Bug pattern="DM_EXIT"/>
|
|
</Match>
|
|
|
|
<!-- Allow command execution in specific classes - commands are hardcoded, not user input -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*ProcessExecutor.*"/>
|
|
<Class name="~.*CommandRunner.*"/>
|
|
<Class name="~.*ServiceStartCommand.*"/>
|
|
<Class name="~.*ServiceStopCommand.*"/>
|
|
<Class name="~.*ServiceRestartCommand.*"/>
|
|
<Class name="~.*ServiceInstallCommand.*"/>
|
|
<Class name="~.*ServiceUninstallCommand.*"/>
|
|
<Class name="~.*WindowsServiceManager.*"/>
|
|
<Class name="~.*SystemdManager.*"/>
|
|
<Class name="~.*LaunchdManager.*"/>
|
|
<Class name="~.*UsageCollector.*"/>
|
|
</Or>
|
|
<Bug pattern="COMMAND_INJECTION"/>
|
|
</Match>
|
|
|
|
<!-- CRLF injection in logs is not exploitable - we log internal identifiers like job IDs -->
|
|
<Match>
|
|
<Bug pattern="CRLF_INJECTION_LOGS"/>
|
|
</Match>
|
|
|
|
<!-- Exclude false positives for try-with-resources -->
|
|
<Match>
|
|
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
|
|
</Match>
|
|
|
|
<!-- Allow serialization without serialVersionUID for internal classes -->
|
|
<Match>
|
|
<Bug pattern="SE_NO_SERIALVERSIONID"/>
|
|
<Not>
|
|
<Class name="~.*Exception"/>
|
|
</Not>
|
|
</Match>
|
|
|
|
<!-- Hardcoded absolute paths are intentional for system service installation paths -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*ConfigDefaults.*"/>
|
|
<Class name="~.*ServiceInstallCommand.*"/>
|
|
<Class name="~.*SystemdManager.*"/>
|
|
<Class name="~.*LaunchdManager.*"/>
|
|
<Class name="~.*IpcClient.*"/>
|
|
</Or>
|
|
<Bug pattern="DMI_HARDCODED_ABSOLUTE_FILENAME"/>
|
|
</Match>
|
|
|
|
<!-- XmlFormatter uses internal data, not user input - XML injection not applicable -->
|
|
<Match>
|
|
<Class name="~.*XmlFormatter.*"/>
|
|
<Bug pattern="POTENTIAL_XML_INJECTION"/>
|
|
</Match>
|
|
|
|
<!-- Throwing exceptions from constructors is a valid pattern for checked initialization -->
|
|
<Match>
|
|
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
|
|
</Match>
|
|
|
|
<!-- ThreadLocalRandom for retry jitter doesn't need cryptographic randomness -->
|
|
<Match>
|
|
<Class name="~.*RetryCalculator.*"/>
|
|
<Bug pattern="PREDICTABLE_RANDOM"/>
|
|
</Match>
|
|
|
|
<!-- Using \n instead of %n is intentional for systemd/launchd config file templates -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*SystemdManager.*"/>
|
|
<Class name="~.*LaunchdManager.*"/>
|
|
</Or>
|
|
<Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/>
|
|
</Match>
|
|
|
|
<!-- Exposing internal representation is acceptable for records and DTOs -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*IpcMessage.*"/>
|
|
<Class name="~.*IpcRequest.*"/>
|
|
<Class name="~.*ProcessMonitor.*"/>
|
|
<Class name="~.*BarnService.*"/>
|
|
</Or>
|
|
<Or>
|
|
<Bug pattern="EI_EXPOSE_REP"/>
|
|
<Bug pattern="EI_EXPOSE_REP2"/>
|
|
</Or>
|
|
</Match>
|
|
|
|
<!-- Lazy initialization race condition in OperatingSystem.current() is benign -->
|
|
<Match>
|
|
<Class name="~.*OperatingSystem.*"/>
|
|
<Bug pattern="LI_LAZY_INIT_STATIC"/>
|
|
</Match>
|
|
|
|
<!-- Catching generic Exception is intentional in some cases for resilience -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*UsageCollector.*"/>
|
|
<Class name="~.*XmlFormatter.*"/>
|
|
</Or>
|
|
<Bug pattern="REC_CATCH_EXCEPTION"/>
|
|
</Match>
|
|
|
|
<!-- Throwing RuntimeException is intentional in ProcessMonitor for fatal errors -->
|
|
<Match>
|
|
<Class name="~.*ProcessMonitor.*"/>
|
|
<Bug pattern="THROWS_METHOD_THROWS_RUNTIMEEXCEPTION"/>
|
|
</Match>
|
|
|
|
<!-- Ignored Future returns are intentional for fire-and-forget tasks -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*JobScheduler.*"/>
|
|
<Class name="~.*IpcServer.*"/>
|
|
</Or>
|
|
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
|
|
</Match>
|
|
|
|
<!-- Format string manipulation warnings in CLI - internal use only -->
|
|
<Match>
|
|
<Class name="~.*StatusCommand.*"/>
|
|
<Bug pattern="FORMAT_STRING_MANIPULATION"/>
|
|
</Match>
|
|
|
|
<!-- Use of TEMP env variable is intentional for Windows compatibility -->
|
|
<Match>
|
|
<Class name="~.*ConfigDefaults.*"/>
|
|
<Bug pattern="ENV_USE_PROPERTY_INSTEAD_OF_ENV"/>
|
|
</Match>
|
|
|
|
<!-- toLowerCase with Locale.ROOT is correct - these are false positives -->
|
|
<Match>
|
|
<Bug pattern="IMPROPER_UNICODE"/>
|
|
</Match>
|
|
|
|
<!-- IpcClient/IpcServer streams wrap channels managed separately - closing streams would close channels -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*IpcClient.*"/>
|
|
<Class name="~.*IpcServer.*"/>
|
|
</Or>
|
|
<Bug pattern="OS_OPEN_STREAM"/>
|
|
</Match>
|
|
|
|
<!-- Paths are always absolute in this codebase - getParent()/getFileName() won't return null -->
|
|
<Match>
|
|
<Or>
|
|
<Class name="~.*ProcessExecutor.*"/>
|
|
<Class name="~.*JobRunner.*"/>
|
|
<Class name="~.*JobRepository.*"/>
|
|
<Class name="~.*IpcServer.*"/>
|
|
</Or>
|
|
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
|
|
</Match>
|
|
|
|
</FindBugsFilter>
|