Files
grpc-library/config/spotbugs/exclude.xml
T
DongHyeonka 414666cfc7 build: 템플릿 밖에서 혼자 빌드·배포되는 Gradle 루트를 만든다
옮겨 온 gRPC 모듈은 템플릿의 두 번째 빌드(optional build)였다. 그 빌드는
템플릿 build-logic·카탈로그·registry·config를 상대 경로로 읽었고,
grpc-operation-ledger-jpa는 템플릿 persistence-jpa의 testFixtures 파일
셋을 빌드 때 복사해 왔다. 별도 repo에는 그 경로가 없다.

repo 루트를 Gradle 루트로 둔다.
- build-logic: 템플릿 22df3525의 src/build-logic을 복사하고 쓰지 않는
  플러그인(bootrun-dotenv, redis topology, config contract,
  spring-library, optional registry, purity 태스크)을 뺐다. 출처와 고친
  곳은 build-logic/UPSTREAM.md에 적었다(설계 10.3절 L1).
- registry config/architecture/modules.json: 템플릿의 optional-grpc 9행,
  source_path는 Gradle 루트 기준.
- 카탈로그·config: 이 repo가 쓰는 항목만. SpotBugs 제외는 이 repo
  클래스와 일반 규칙만 남겼다.
- group은 gradle.properties의 libraryGroup(com.hyeonworks.grpc)에서
  읽는다. 버전은 -PreleaseVersion 말고 RELEASE_TAG(vX.Y.Z)에서도 읽고,
  다른 모양의 태그는 빌드 전에 거부한다.
- 배포: 새 ca.library-publishing이 모듈마다 Maven publication(sources·
  javadoc jar, versionMapping으로 해석된 버전)과 저장소 gitea·staging,
  SIGNING_KEY가 있으면 PGP 서명을 단다. 루트는 SBOM artifact
  grpc-library와 단계 태스크 ci·mainCheck·releaseCheck·release·
  releaseRehearsal을 가진다. Trivy·Buf는 scripts/tool.sh가 SHA-256으로
  고정해 받는다.
- testFixtures 결합(설계 4.6절 2번)은 integrationTest 안 사본으로 끊었다.
- Buf lint·breaking은 Gradle 태스크(scripts/buf.sh)로 ci에 넣었다.

버린 대안: build-logic을 템플릿이 배포(L2, 순환), 공통 repo(L3, repo가
하나 더), 표준 플러그인만으로 새로 쓰기(L4, strict lane과 방향 검사를
잃음). SBOM은 CycloneDX Gradle 플러그인 대신 이미 고정해 쓰는 Trivy로
만든다(도구를 늘리지 않는다).

위험: strictlane 단계 검사는 included build 태스크를 따라가다 실패해서
그 태스크를 건너뛰게 고쳤다(UPSTREAM.md). Gitea에 실제로 올리는 경로는
비밀 값이 없어 이 커밋에서는 시험하지 못했다.

검증(desktop, 이 트리): ./gradlew ci rc=0, 테스트 739개(build-logic
포함) 중 첫 실행 실패 1개(템플릿 경로를 찾던 GrpcPackageOwnershipTest)를
고친 뒤 통과. ./gradlew verifyStrictLaneStages --dry-run rc=0.

Refs: design-docs repo-structure/05-library-repos.md 4.6·7·10절
2026-11-08 11:10:21 +09:00

176 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 (MapStruct / annotation processors): exclude from analysis. -->
<Match>
<Source name="~.*[\\/]generated[\\/].*" />
</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>
<!-- 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>
<!-- CT group 2 — designed for extension. Exception hierarchy roots (HttpClientException,
JpaPersistenceException, RedisOperationException, FileserverException and the optional
gRPC build's GrpcPlatformException, which GrpcDeadlineExceededException extends, each have
subclasses), ClientRuntime (BlockingClientRuntime extends it) and the abstract
JpaRepositoryFragmentSupport, which service repository fragments extend. -->
<Match>
<Bug pattern="CT_CONSTRUCTOR_THROW" />
<Or>
<Class name="dev.caskeleton.grpc.api.error.GrpcPlatformException" />
</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, and so do the
gRPC identifiers (GrpcIdentifiers.requireBounded, 256); 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.grpc.core.GrpcChannelProfileName" />
<Method name="&lt;clinit&gt;" />
</And>
<And>
<Class name="dev.caskeleton.grpc.core.GrpcServiceName" />
<Method name="&lt;clinit&gt;" />
</And>
</Or>
</Match>
<!-- FindSecBugs REDOS, the "x([class]*x)?" shape: GrpcMetadataKey.CANONICAL and
GrpcResolverSafetyPolicy.AUTHORITY. The only unbounded quantifier sits in a group that
repeats at most once, so a failing match gives back one character at a time from a single
star — n steps, not 2^n. Measured with java.util.regex on 1k/10k/100k-unit inputs built to
fail late ("a.a"... + "!"): time grows tenfold per tenfold input, 300k characters in under
7 ms. The metadata key is also capped at 64 characters before the pattern runs; the
resolver authority has no cap, and a linear match costs no more than reading the update. -->
<Match>
<Bug pattern="REDOS" />
<Or>
<And>
<Class name="dev.caskeleton.grpc.api.context.GrpcMetadataKey" />
<Method name="&lt;clinit&gt;" />
</And>
<And>
<Class name="dev.caskeleton.grpc.advanced.discovery.GrpcResolverSafetyPolicy" />
<Method name="&lt;clinit&gt;" />
</And>
</Or>
</Match>
<!-- FindSecBugs UNSAFE_HASH_EQUALS asks for a constant-time compare so that timing cannot leak a
secret digest. None of these digests is a secret: content SHA-256 the uploader supplied or
can compute (ContentPublishVerification, MetadataPointerContentPublisher,
FinalizeUploadApplicationUseCase), an integrity digest of the record's own policy snapshot
(ObjectOperationRecord), idempotency request/response digests the caller's own replay
produces (PostgreSqlIdempotencyStore), and a configured worker identity used as a lease
owner (PosterImageUploadIntent), and the gRPC channel profile fingerprints that
GrpcPlatformSnapshotService.driftAgainstRelease compares between two snapshots it was
handed — a configuration hash, published in the snapshot itself, compared offline with no
caller to time it. A comparison that leaks what the caller already knows leaks nothing. -->
<Match>
<Bug pattern="UNSAFE_HASH_EQUALS" />
<Or>
<And>
<Class name="dev.caskeleton.grpc.admin.GrpcPlatformSnapshotService" />
<Method name="~lambda\$driftAgainstRelease\$\d+" />
</And>
</Or>
</Match>
<!-- COMMAND_INJECTION: GrpcTlsTestMaterial.runKeytool starts the running JDK's own keytool
(java.home/bin) through ProcessBuilder with an argument list — no shell, so no argument is
parsed as a command. Its callers pass fixed flags, paths of a temporary directory the
fixture created, and the hostname a test names for its certificate. It lives in
grpc-testkit, which no production leaf depends on. -->
<Match>
<Bug pattern="COMMAND_INJECTION" />
<Class name="dev.caskeleton.grpc.testkit.netty.GrpcTlsTestMaterial" />
<Method name="runKeytool" />
</Match>
</FindBugsFilter>