@@ -251,6 +251,62 @@ for instantiation.
251251}
252252----
253253
254+ === Untrusted (Wire) Input: Restricted Mode
255+
256+ Configuration files loaded at startup via `TikaLoader` are treated as trusted.
257+ Per-request configuration arriving over the wire — tika-server request bodies
258+ and pipes `FetchEmitTuple`s — is deserialized in *restricted mode*
259+ (`ParseContextDeserializer.readParseContext(node, true)`), which adds a second,
260+ fail-closed gate on top of the registry:
261+
262+ * Only context-key types confined to shaping this request's metadata or output
263+ may be instantiated from the wire: `MetadataFilter`, `ContentHandlerFactory`,
264+ `ContentHandlerDecoratorFactory`, `DigesterFactory`,
265+ `MetadataWriteLimiterFactory`, `UnpackSelector`
266+ * Types with exec/IO/network capability or control over which components run
267+ are blocked: `Parser`, `Detector`, `EncodingDetector`, `Renderer`,
268+ `Translator`, `EmbeddedDocumentExtractorFactory`
269+ * The check is fail-closed: a newly added context-key interface is blocked until
270+ it is consciously allow-listed
271+ * The whole tree is scanned *before* any component is constructed
272+
273+ The allowlist/blocklist lives in `ComponentNameResolver`
274+ (`WIRE_INSTANTIABLE_CONTEXT_KEYS` / `WIRE_BLOCKED_CONTEXT_KEYS`); an
275+ exhaustiveness test asserts every context-key interface is classified as
276+ exactly one of the two. Plain config DTOs (non-component keys) are never
277+ blocked.
278+
279+ == Framework Directives
280+
281+ Some JSON keys are consumed by the loading framework itself rather than by the
282+ component whose config object they appear in. When such a directive shares a
283+ JSON object with a component's own properties, it carries a leading underscore
284+ to avoid namespace collisions with legitimate component config keys:
285+
286+ [source,json]
287+ ----
288+ {
289+ "parsers": [
290+ {
291+ "pdf-parser": {
292+ "_mime-include": ["application/pdf"],
293+ "_mime-exclude": ["application/pdf+fdf"],
294+ "extractInlineImages": true
295+ }
296+ }
297+ ]
298+ }
299+ ----
300+
301+ `_mime-include`/`_mime-exclude` are stripped before the component sees its
302+ config and are applied by the framework as a MIME-filtering decorator around
303+ the parser. New framework directives must follow the underscore convention.
304+
305+ Marker entries that have no component-config namespace of their own are the
306+ exception: `"exclude"` on `default-parser`/`default-detector`/
307+ `default-encoding-detector` needs no prefix because those markers carry only
308+ framework keys.
309+
254310== Creating a Custom Component
255311
256312Complete example of a custom metadata filter:
0 commit comments