You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "dschmidt (via GitHub)" <gi...@apache.org> on 2026/08/31 17:21:17 UTC
[PR] TIKA-4864: resolve the default plugins dir against the install layout and make it absolute [tika]
dschmidt opened a new pull request, #3107:
URL: https://github.com/apache/tika/pull/3107
Fixes https://issues.apache.org/jira/browse/TIKA-4864
In the docker image (and any unpacked distribution) TikaServerProcess is loaded from lib/tika-server-core-4.0.0.jar, so the code-source probe looks for lib/plugins, which does not exist. The fallback then returns the relative literal "plugins", which the forked PipesServer resolves against its own working directory. As soon as an orchestrator starts the container with a different workdir (docker run -w, CI systems like Woodpecker do this for service containers), the plugin registry comes up empty and every parse fails with "Unknown fetcher type: 'file-system-fetcher' ... Available types: []".
The fix keeps the code-source heuristic but also probes the parent of the jar directory (covers the lib/ layout) and always returns an absolute path, so parent and forked process agree on the same directory regardless of CWD.
Note: the CWD fallback is an untrusted-search-path pattern (CWE-427 class): the server loads and instantiates jars from whatever directory it happens to be started in. This change narrows the exposure by preferring the install directory and absolutizing, but keeps the fallback since it is documented behavior. An explicit override (CLI flag or env var) might be a good follow-up.
Adds unit tests for all three probe locations plus the absolute-path guarantee.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4864: resolve the default plugins dir against the install layout and make it absolute [tika]
Posted by "dschmidt (via GitHub)" <gi...@apache.org>.
dschmidt commented on PR #3107:
URL: https://github.com/apache/tika/pull/3107#issuecomment-5482279594
Done: `DefaultPluginsDir` sits in tika-pipes-core next to ConfigMerger, with the probe order (jar dir, its parent for the lib/ layout, cwd) and the absolute-path guarantee in one place, plus the unit tests moved there. TikaServerProcess, PipesForkParser and TikaAsyncCLI/PluginsWriter route through it; their copies are gone.
I left tika-grpc out: it has no dependency on tika-pipes-core, and its fallback only runs after a TikaConfigException from a config that named plugin-roots, where guessing a directory the config did not name seems wrong anyway. If you want it covered, the helper could move one level down into tika-plugins-core (grpc already uses TikaPluginManager); happy to do that instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4864: resolve the default plugins dir against the install layout and make it absolute [tika]
Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison merged PR #3107:
URL: https://github.com/apache/tika/pull/3107
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4864: resolve the default plugins dir against the install layout and make it absolute [tika]
Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison commented on PR #3107:
URL: https://github.com/apache/tika/pull/3107#issuecomment-5482180068
I _think_ I now get why you'd want this. There are actually four places where this should be fixed.
Could you hoist your resolveDefaultPluginsDir(codeSourceDir, cwd) into tika-pipes-core next to ConfigMerger, maybe?
||Module / class||Current default resolution||Bug||Action||
||{{TikaServerProcess}} (tika-server-core)|jar dir only, then CWD-relative|misses lib/ layout
(TIKA-4864)|fixed by PR #3107; route through shared helper|
||{{PipesForkParser}} (tika-pipes-fork-parser)|jar dir only, then CWD-relative|same miss of lib/
layout|replace copy with shared helper|
||{{TikaAsyncCLI}} (tika-async-cli)|parent of jar dir only, then CWD-relative|misses jar-adjacent layout;
also used by {{PluginsWriter}}|replace copy with shared helper|
||{{TikaGrpcServerImpl}} (tika-grpc)|none — requires config/--plugin-roots; on missing plugin-roots falls
back to bare pf4j {{DefaultPluginManager}} (CWD-relative)|fallback contradicts its own WARN text ("next to
tika-grpc.jar")|optional: use shared helper in the fallback|
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4864: resolve the default plugins dir against the install layout and make it absolute [tika]
Posted by "dschmidt (via GitHub)" <gi...@apache.org>.
dschmidt commented on PR #3107:
URL: https://github.com/apache/tika/pull/3107#issuecomment-5482205217
I mainly want to make sure the tika image comes up in Woodpecker CI without specifying an explicit working directory.
Obviously it can be worked around easily, but I'd like it to work out of the box :)
Checking...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4864: resolve the default plugins dir against the install layout and make it absolute [tika]
Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison commented on PR #3107:
URL: https://github.com/apache/tika/pull/3107#issuecomment-5482318384
LOL, my agent also noted we should probably change this comment...
```
Bonus confirmation while in there — the Dockerfile already knew about this bug and papered over it:
# WORKDIR sets the CWD so tika-server's plugin-root fallback resolves
# `plugins/` relative to /opt/tika-server (its `getCodeSource()` returns a
# lib/* path, not the top-level jar, so the "next-to-jar" resolution misses).
WORKDIR /opt/tika-server
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org