Files
messaging-library/config/spotbugs/exclude.xml
T
DongHyeonka 2e9298ec33 build: 템플릿 밖에서 혼자 빌드·배포되는 Gradle 루트를 만든다
옮겨 온 메시징 19개 모듈은 템플릿의 src/settings.gradle·build-logic·
카탈로그·registry에 기대고 있어 이 repo만으로는 빌드되지 않는다.
repo 루트를 Gradle 루트로 하는 단독 빌드를 만든다.

- build-logic/: grpc-library main 2e880c7의 줄인 사본(템플릿
  22df3525에서 복사, 템플릿 2959eff0까지의 변경도 같은 내용)에서
  gRPC BOM 규칙(ca.grpc-platform-module)만 뺐다. 배포 플러그인
  ca.library-publishing과 서명 키 해석(SigningKeys)은 그대로다.
  출처·뺀 것·고친 것은 build-logic/UPSTREAM.md.
- settings.gradle·build.gradle·gradle.properties: group
  dev.cakit.messaging, 단계 태스크 ci·mainCheck·releaseCheck와
  배포(release·releaseRehearsal·verifySigningKey)는 grpc-library와
  같은 모양이다. 메시징만 다른 점: Buf가 없고, 성능 lane이 없고,
  mainCheck와 releaseCheck가 브로커 인증 증거 게이트
  (verifyMessagingCertificationEvidence)를 부른다. 템플릿은 이 게이트를
  따로 messaging-certification.yml로 돌렸다. 그 workflow는 지운다.
- config/: registry 19행(source_path만 messaging/<leaf>로), 메시징
  클래스만 남긴 SpotBugs 제외 목록, 이미지 셋(postgres-16, kafka,
  toxiproxy, 모두 digest 고정), checkstyle 사본.
- gradle/libs.versions.toml: 메시징이 쓰는 항목만(avro, cloudevents,
  protobuf 4.33.2, toxiproxy, jmh)과 kafka-clients가 끌고 오는 취약
  버전을 덮는 pinned-lz4-java·pinned-snappy-java.
- 저장소 계약 테스트: MessagingPublicSurfaceContractTest(템플릿
  app-bootstrap에서 이력째 옮김)와 새 MessagingSettingsOwnerContractTest
  (app.messaging 주인은 starter 하나)를 messaging-testkit의
  repositoryContractTest lane에 둔다. check에 들어가 PR 단계에서 돈다.
- messaging-kafka: 인증 manifest 경로를 새 배치로 고친다.

버린 대안: 계약 테스트를 build-logic 테스트로 두는 안. 빌드 플러그인
시험과 모듈 계약이 섞이고, 소스·build.gradle을 입력으로 선언하는
기존 lane 장치를 쓸 수 없다.

위험: 이 커밋 단독으로는 lockfile을 다시 쓰지 않았다(뒤 커밋에서
desktop에서 쓴다). 패키지는 아직 dev.caskeleton.messaging이다.

검증: desktop ./gradlew projects rc=0(19개 모듈 포함).

Refs: design-docs repo-structure/05-library-repos.md 4·10.3·13.1절
2026-11-08 16:11:52 +09:00

201 lines
11 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>
<!-- 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, an EntityManager, 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 (HttpClientProfileFactory and DynamicTargetAutoConfiguration Set.copyOf every list;
MessagingConfigurationCompiler copies into DestinationAccessPolicy and SchemaPolicy;
RedisRuntimeAutoConfiguration validates and maps; FileserverStartupValidator reads the
ancestors once). A settings record that validates a collection in its own constructor
copies it there instead (FileserverPlatformSettings.Security). -->
<Match>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
<Or>
<Class name="dev.caskeleton.messaging.autoconfigure.MessagingSettings"/>
<Class name="dev.caskeleton.messaging.autoconfigure.BrokerSecuritySettings$Access"/>
<Class name="dev.caskeleton.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.caskeleton.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.caskeleton.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. @RequiresPermission is enforced by a method-security advisor,
and Spring Boot proxies with CGLIB, which subclasses the bean
(RequiresPermissionProxyabilityTest fails the build if such a class is final). The
Annotation matcher covers every class annotated at class level, including ones added
later. A class that annotates only some methods is proxied all the same but is not matched
here; name it when one appears. A @Configuration class is CGLIB-subclassed for its @Bean
methods for the same reason. -->
<Match>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
<Or>
<Annotation name="dev.caskeleton.application.security.RequiresPermission"/>
<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 application-core and messaging values
also check the length (at most 64-256 characters) before the pattern runs; JsonPathName and SafeSortField
match developer-declared paths; the SNS host comes from a URI host. -->
<Match>
<Bug pattern="REDOS"/>
<Or>
<And><Class name="dev.caskeleton.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.caskeleton.messaging.outbox.JdbcOutboxRepository"/>
<Method name="~lambda\$transition(WithNextAttempt)?\$\d+"/>
</Match>
<!-- PREDICTABLE_RANDOM: log sampling (SamplingTurboFilter.decide) and retry jitter
(BackoffCalculator's default source, HttpClientProfileAutoConfiguration.jitterRandom) only
need spread, not unpredictability; nothing security-relevant is derived from any of these
values. 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.caskeleton.messaging.policy.BackoffCalculator"/><Method name="~lambda\$new\$\d+"/></And>
</Or>
</Match>
<!-- MS_EXPOSE_REP on a static that is already immutable: a Jackson 3 ObjectMapper cannot be
reconfigured after build() (NotificationJsonMapper), and CertifiedEvidence.RECORDED is a
Stream.toList() result. -->
<Match>
<Bug pattern="MS_EXPOSE_REP"/>
<Or>
<And><Class name="dev.caskeleton.messaging.testkit.CertifiedEvidence"/><Method name="recorded"/></And>
</Or>
</Match>
</FindBugsFilter>