Files
messaging-library/config/spotbugs/exclude.xml
DongHyeonka 31c517888a
pr / ci (pull_request) Successful in 3m58s
build(spotbugs): 제외 목록이 이 repo 클래스만 말하게 다듬는다
템플릿 제외 목록에서 메시징 줄을 골라 옮기면서, 묶음 Match의 주석이
템플릿 클래스(HttpClientProfileFactory, NotificationJsonMapper,
@RequiresPermission 등)를 계속 부른다. 이 repo에 없는 클래스를 읽고
제외 이유를 판단하게 된다. 템플릿의 생성 소스 제외(generated 폴더)도
빠졌다.

주석을 메시징 클래스만 말하게 고치고, 생성 소스 제외 Match를
템플릿과 같이 되살렸다. 클래스를 고르는 Match는 바뀌지 않았다.

위험: 생성 소스 제외는 지금 생성 소스가 없어 아무것도 빼지 않는다.

검증: 이 PR의 pr workflow(./gradlew ci, SpotBugs main·test 포함).
2026-11-08 16:34:02 +09:00

196 lines
10 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
feature-static-analysis-quality-contract D3/D4 — SpotBugs + FindSecBugs exclude filter.
SpotBugs (D3) and FindSecBugs (D4, via spotbugsPlugins) analyse bytecode. Inter-procedural
taint analysis has known limits (FindSecBugs false positives) and generated code carries
patterns the source author never wrote. Add ONLY confirmed false positives here, each as a
narrowly-scoped <Match> — never a blanket bug-pattern exclusion across all sources.
Reference: https://github.com/spotbugs/spotbugs / https://find-sec-bugs.github.io/
-->
<FindBugsFilter>
<!-- Generated sources (annotation processors): exclude from analysis. -->
<Match>
<Source name="~.*[\\/]generated[\\/].*"/>
</Match>
<!-- The messaging codec retention test measures whether a round trip retains per-message state.
Measuring retained memory requires forcing a collection first and again at the end;
without it the "after" reading is dominated by garbage that simply had not been collected
yet and the test could never distinguish a leak from ordinary allocation. Scoped to the
one test class, so an explicit gc anywhere else stays reportable. -->
<Match>
<Bug pattern="DM_GC"/>
<Source name="PlatformOverheadPerformanceTest.java"/>
</Match>
<!-- The outbox and inbox container tests apply the real shipped Flyway migration by reading it
from the classpath and executing it, which is the whole point: a test that re-declared the
schema inline would certify a schema nothing deploys. The SQL is a build artifact, not
input, and the database is a throwaway container. Scoped to these two classes so any other
dynamic SQL stays reportable. -->
<Match>
<Bug pattern="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE"/>
<Source name="~(Inbox|Outbox)PostgresIT.java"/>
</Match>
<!-- =========================================================================================
Confidence MEDIUM (review 2026-11-01 08-07). Everything below was added when the report
level went from HIGH to MEDIUM. Each entry was judged against the code it names; defects
were fixed in the code instead of listed here. Counts are in QualityConventionsPlugin.
========================================================================================= -->
<!-- EI_EXPOSE_REP / EI_EXPOSE_REP2, pattern 1 of 4 — references that are not values.
SpotBugs calls any field "mutable" whose type has a set/add/remove/delete/write-shaped
method, and asks for a copy whenever one is stored from a parameter or returned. For a
field that holds a collaborator (a port, a repository, a MeterRegistry,
an executor, a template, a settings bean), a handle (a channel, a future, a reflected
Method, an exception kept as a cause) or a nested setter-bound settings object, sharing the
reference is the design: constructor injection stores collaborators, and a copy would be a
different collaborator. The check stays on for the types where a copy IS the remedy —
collections, arrays, Date, ByteBuffer and JSON trees — so a value type that keeps a
caller's list or array is still reported. SpotBugs field types are exact names, not
patterns: an array of any other element type is not re-checked by this list. -->
<Match>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
<Not>
<Or>
<Field type="java.util.Collection"/>
<Field type="java.util.List"/>
<Field type="java.util.Set"/>
<Field type="java.util.SortedSet"/>
<Field type="java.util.NavigableSet"/>
<Field type="java.util.Queue"/>
<Field type="java.util.Deque"/>
<Field type="java.util.Map"/>
<Field type="java.util.SortedMap"/>
<Field type="java.util.NavigableMap"/>
<Field type="java.util.ArrayList"/>
<Field type="java.util.LinkedList"/>
<Field type="java.util.HashSet"/>
<Field type="java.util.LinkedHashSet"/>
<Field type="java.util.TreeSet"/>
<Field type="java.util.EnumSet"/>
<Field type="java.util.HashMap"/>
<Field type="java.util.LinkedHashMap"/>
<Field type="java.util.TreeMap"/>
<Field type="java.util.EnumMap"/>
<Field type="java.util.Date"/>
<Field type="java.nio.ByteBuffer"/>
<Field type="byte[]"/>
<Field type="char[]"/>
<Field type="short[]"/>
<Field type="int[]"/>
<Field type="long[]"/>
<Field type="float[]"/>
<Field type="double[]"/>
<Field type="boolean[]"/>
<Field type="java.lang.Object[]"/>
<Field type="java.lang.String[]"/>
<Field type="tools.jackson.databind.JsonNode"/>
<Field type="tools.jackson.databind.node.ObjectNode"/>
<Field type="tools.jackson.databind.node.ArrayNode"/>
<Field type="com.fasterxml.jackson.databind.JsonNode"/>
<Field type="com.fasterxml.jackson.databind.node.ObjectNode"/>
<Field type="com.fasterxml.jackson.databind.node.ArrayNode"/>
</Or>
</Not>
</Match>
<!-- EI pattern 3 of 4 — settings binding carriers. Setter-bound @ConfigurationProperties
JavaBeans are mutable by contract (a public setter opens more than the getter does), and
the constructor-bound records listed here have no invariant of their own: each is read
once at startup by the factory that compiles it into the runtime type, and that factory
copies (MessagingConfigurationCompiler copies into DestinationAccessPolicy and
SchemaPolicy). A settings record that validates a collection in its own constructor copies
it there instead. -->
<Match>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
<Or>
<Class name="dev.cakit.messaging.autoconfigure.MessagingSettings"/>
<Class name="dev.cakit.messaging.autoconfigure.BrokerSecuritySettings$Access"/>
<Class name="dev.cakit.messaging.autoconfigure.DestinationSettings$Schema"/>
</Or>
</Match>
<!-- EI pattern 4 of 4 — the collection is already an unmodifiable copy. Each field below is
assigned an unmodifiable collection at construction (List/Set/Map.copyOf,
Collectors.toUnmodifiable*, Stream.toList, Collections.unmodifiable* over a fresh copy),
but through a branch, a stream or a private constructor fed by a copying factory, which
SpotBugs does not follow; it recognises only a field assigned straight from copyOf. Listed
by class and field, so another collection added to the same class is still reported. -->
<Match>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
<Or>
<And><Class name="dev.cakit.messaging.api.header.MessageHeaders"/><Field name="values"/></And>
</Or>
</Match>
<!-- CredentialRuntime takes ownership of the secret array the registry resolved for it, so that
clear() overwrites the only copy. Copying in the constructor would leave the provider's
array behind, uncleared, which is the outcome the char[] field type exists to prevent. -->
<Match>
<Bug pattern="EI_EXPOSE_REP2"/>
<Class name="dev.cakit.messaging.security.CredentialRuntime"/>
<Method name="&lt;init&gt;"/>
</Match>
<!-- CT_CONSTRUCTOR_THROW (finalizer attack: a subclass's finalize() keeps a half-built object).
A final class cannot be attacked this way, and every class that could be made final was.
These three groups must stay subclassable. -->
<!-- CT group 1 — CGLIB proxies. A @Configuration class is CGLIB-subclassed for its @Bean
methods, so it must stay subclassable. The Annotation matcher covers every class annotated
at class level, including ones added later. -->
<Match>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
<Or>
<Annotation name="org.springframework.context.annotation.Configuration"/>
</Or>
</Match>
<!-- FindSecBugs REDOS, one Match per constructor or static initialiser. Every pattern flagged
is "segment (separator segment)*" where the separator is a character the segment class
cannot contain ('.', '-', ';', or a class of those), so each input splits exactly one way
and backtracking is linear, not exponential. The values also check the length (at most
64-256 characters) before the pattern runs. -->
<Match>
<Bug pattern="REDOS"/>
<Or>
<And><Class name="dev.cakit.messaging.api.ContentType"/><Method name="&lt;clinit&gt;"/></And>
</Or>
</Match>
<!-- SQL_INJECTION_JDBC: transition() and transitionWithNextAttempt() append a fixed WHERE clause
to a SET clause that every caller passes as a string literal from this class; every value
is a bound parameter. The method names are the lambdas javac generates inside them. -->
<Match>
<Bug pattern="SQL_INJECTION_JDBC"/>
<Class name="dev.cakit.messaging.outbox.JdbcOutboxRepository"/>
<Method name="~lambda\$transition(WithNextAttempt)?\$\d+"/>
</Match>
<!-- PREDICTABLE_RANDOM: retry jitter (BackoffCalculator's default source) only needs spread,
not unpredictability; nothing security-relevant is derived from it. Knowing the next jitter
tells a caller when a retry lands, which the retry policy already bounds. SecureRandom
would read as a security requirement that is not there. -->
<Match>
<Bug pattern="PREDICTABLE_RANDOM"/>
<Or>
<And><Class name="dev.cakit.messaging.policy.BackoffCalculator"/><Method name="~lambda\$new\$\d+"/></And>
</Or>
</Match>
<!-- MS_EXPOSE_REP on a static that is already immutable: CertifiedEvidence.RECORDED is a
Stream.toList() result. -->
<Match>
<Bug pattern="MS_EXPOSE_REP"/>
<Or>
<And><Class name="dev.cakit.messaging.testkit.CertifiedEvidence"/><Method name="recorded"/></And>
</Or>
</Match>
</FindBugsFilter>