Skip to content

Commit fdc3d36

Browse files
authored
TIKA-4764 and TIKA-4763 merge conflicts (#2910)
1 parent a1a582a commit fdc3d36

24 files changed

Lines changed: 360 additions & 118 deletions

File tree

docs/modules/ROOT/pages/using-tika/grpc/index.adoc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,16 @@ the server's defaults for that request. Because this can reconfigure any pipelin
6767
component (fetcher, parser, timeouts, ...), it is off by default. When `false`, a
6868
request carrying either field is rejected with `PERMISSION_DENIED`.
6969

70-
|`allowComponentModifications`
71-
|When `true`, callers may add, modify, or delete fetchers and pipes iterators at
72-
runtime (`SaveFetcher`, `DeleteFetcher`, `SavePipesIterator`,
73-
`DeletePipesIterator`). Because this changes what the server can reach for all
74-
subsequent requests (for example, adding a fetcher that escapes a configured base
75-
path), it is off by default. When `false`, those RPCs are rejected with
76-
`PERMISSION_DENIED`.
70+
|`allowComponentManagement`
71+
|When `true`, callers may manage fetchers and pipes iterators at runtime: add,
72+
modify, or delete them (`SaveFetcher`, `DeleteFetcher`, `SavePipesIterator`,
73+
`DeletePipesIterator`), and read their stored configuration back (`GetFetcher`,
74+
`ListFetchers`, `GetPipesIterator`). It is off by default for two reasons:
75+
mutations change what the server can reach for all subsequent requests (for
76+
example, adding a fetcher that escapes a configured base path), and the stored
77+
configs returned by the read RPCs may contain secrets (passwords, access keys,
78+
tokens). When `false`, the mutating RPCs are rejected with `PERMISSION_DENIED`,
79+
and the read RPCs return only component identity (id and class), never the config.
7780
|===
7881

7982
Enable these only for trusted callers over a secured channel:
@@ -83,7 +86,7 @@ Enable these only for trusted callers over a secured channel:
8386
{
8487
"grpc": {
8588
"allowPerRequestConfig": true,
86-
"allowComponentModifications": true
89+
"allowComponentManagement": true
8790
}
8891
}
8992
----
@@ -149,8 +152,9 @@ automatically. Two distinct controls are involved, and both matter:
149152
Mesh mTLS authenticates *who opened the connection*; it does not authorize *what
150153
that caller may do*, so an authenticated-but-untrusted pod can still invoke
151154
whatever RPC surface is enabled — at minimum `FetchAndParse` against your
152-
configured fetchers, and the runtime-mutation RPCs too if you have set
153-
`allowComponentModifications`. Restricting reachability with a `NetworkPolicy` is
155+
configured fetchers, and the runtime component-management RPCs too (including the
156+
config reads that can expose stored secrets) if you have set
157+
`allowComponentManagement`. Restricting reachability with a `NetworkPolicy` is
154158
therefore required, not optional — running in Kubernetes without one leaves
155159
tika-grpc reachable by every pod in the cluster.
156160

tika-e2e-tests/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@
123123
<version>3.15.0</version>
124124
<configuration>
125125
<release>17</release>
126+
<!-- maven-compiler-plugin 3.15 no longer auto-discovers classpath
127+
annotation processors; declare Lombok explicitly so @Slf4j runs. -->
128+
<annotationProcessorPaths>
129+
<path>
130+
<groupId>org.projectlombok</groupId>
131+
<artifactId>lombok</artifactId>
132+
<version>${lombok.version}</version>
133+
</path>
134+
</annotationProcessorPaths>
126135
</configuration>
127136
</plugin>
128137
<plugin>

tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/FileSystemFetcherTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void testFileSystemFetcher() throws Exception {
6464
SaveFetcherReply saveReply = blockingStub.saveFetcher(SaveFetcherRequest
6565
.newBuilder()
6666
.setFetcherId(fetcherId)
67-
.setFetcherClass("org.apache.tika.pipes.fetcher.fs.FileSystemFetcher")
67+
.setFetcherType("file-system-fetcher")
6868
.setFetcherConfigJson(configJson)
6969
.build());
7070

tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/HandlerTypeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void testParseContextJson() throws Exception {
297297

298298
SaveFetcherReply saveReply = blockingStub.saveFetcher(SaveFetcherRequest.newBuilder()
299299
.setFetcherId(fetcherId)
300-
.setFetcherClass("org.apache.tika.pipes.fetcher.fs.FileSystemFetcher")
300+
.setFetcherType("file-system-fetcher")
301301
.setFetcherConfigJson(ExternalTestBase.OBJECT_MAPPER.writeValueAsString(config))
302302
.build());
303303
log.info("Fetcher created: {}", saveReply.getFetcherId());

tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ignite/IgniteConfigStoreTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void testIgniteConfigStore() throws Exception {
409409
SaveFetcherReply saveReply = blockingStub.saveFetcher(SaveFetcherRequest
410410
.newBuilder()
411411
.setFetcherId(fetcherId)
412-
.setFetcherClass("org.apache.tika.pipes.fetcher.fs.FileSystemFetcher")
412+
.setFetcherType("file-system-fetcher")
413413
.setFetcherConfigJson(configJson)
414414
.build());
415415

tika-grpc/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ This server will manage a pool of Tika Pipes clients.
1111
* Delete
1212
* Fetch + Parse a given Fetch Item
1313

14-
> **Security note:** runtime fetcher/iterator mutations (Create/Update/Delete) and
15-
> per-request parse configuration are **disabled by default**. Enable them
16-
> explicitly via `allowComponentModifications` / `allowPerRequestConfig` in the
17-
> `grpc` section of your tika-config. See the
14+
> **Security note:** runtime fetcher/iterator management — mutations (Create/Update/Delete)
15+
> and reading stored configs back (Read), which may contain secrets — plus per-request parse
16+
> configuration are **disabled by default**. Enable them explicitly via
17+
> `allowComponentManagement` / `allowPerRequestConfig` in the `grpc` section of your
18+
> tika-config; with management off, the Read RPCs return only component id and class, never
19+
> the config. See the
1820
> [Tika gRPC security configuration docs](../docs/modules/ROOT/pages/using-tika/grpc/index.adoc).
1921
2022
## Distribution and Maven Artifact

tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcConfig.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
* <ul>
3333
* <li>{@link #isAllowPerRequestConfig()} lets a client reconfigure any
3434
* pipeline component for a single request.</li>
35-
* <li>{@link #isAllowComponentModifications()} lets a client change which
36-
* fetchers and iterators the server has at all.</li>
35+
* <li>{@link #isAllowComponentManagement()} lets a client change which
36+
* fetchers and iterators the server has, and read their stored configs.</li>
3737
* </ul>
3838
*/
3939
public class TikaGrpcConfig {
4040

4141
private boolean allowPerRequestConfig = false;
4242

43-
private boolean allowComponentModifications = false;
43+
private boolean allowComponentManagement = false;
4444

4545
/**
4646
* Loads {@link TikaGrpcConfig} from the {@code "grpc"} section of the JSON
@@ -81,22 +81,26 @@ public void setAllowPerRequestConfig(boolean allowPerRequestConfig) {
8181
}
8282

8383
/**
84-
* Whether clients may add, modify, or delete fetchers and pipes iterators at
85-
* runtime (the SaveFetcher, DeleteFetcher, SavePipesIterator and
86-
* DeletePipesIterator RPCs).
84+
* Whether clients may manage fetchers and pipes iterators at runtime: add,
85+
* modify, or delete them (the SaveFetcher, DeleteFetcher, SavePipesIterator
86+
* and DeletePipesIterator RPCs), and read their stored configuration back
87+
* (the GetFetcher, ListFetchers and GetPipesIterator RPCs).
8788
* <p>
88-
* This is dangerous because it changes what the server can reach for all
89-
* subsequent requests and clients (for example, adding a fetcher that
90-
* escapes a configured base path or points at an internal host). Defaults
91-
* to {@code false}; when {@code false}, those RPCs are rejected.
89+
* This is dangerous on two counts. Writes change what the server can reach
90+
* for all subsequent requests and clients (for example, adding a fetcher
91+
* that escapes a configured base path or points at an internal host). Reads
92+
* return stored component configs verbatim, which may include secrets
93+
* (passwords, access keys, tokens). Defaults to {@code false}; when
94+
* {@code false}, the mutating RPCs are rejected and the read RPCs return
95+
* only component identity (id and class), never the config.
9296
*
93-
* @return true if runtime component modifications are permitted
97+
* @return true if runtime component management is permitted
9498
*/
95-
public boolean isAllowComponentModifications() {
96-
return allowComponentModifications;
99+
public boolean isAllowComponentManagement() {
100+
return allowComponentManagement;
97101
}
98102

99-
public void setAllowComponentModifications(boolean allowComponentModifications) {
100-
this.allowComponentModifications = allowComponentModifications;
103+
public void setAllowComponentManagement(boolean allowComponentManagement) {
104+
this.allowComponentManagement = allowComponentManagement;
101105
}
102106
}

0 commit comments

Comments
 (0)