Skip to content

TIKA-4974: enforce @OperatorOnly wherever a request builds a component - #3352

Merged
tballison merged 11 commits into
apache:mainfrom
tballison:TIKA-4974
Oct 20, 2026
Merged

tballison merged 11 commits into
apache:mainfrom
tballison:TIKA-4974

Conversation

@tballison

Copy link
Copy Markdown
Contributor

Thanks for your contribution to Apache Tika! Your help is appreciated!

Before opening the pull request, please verify that

  • there is an open issue on the Tika issue tracker which describes the problem or the improvement. We cannot accept pull requests without an issue because the change wouldn't be listed in the release notes.
  • the issue ID (TIKA-XXXX)
    • is referenced in the title of the pull request
    • and placed in front of your commit messages surrounded by square brackets ([TIKA-XXXX] Issue or pull request title)
  • commits are squashed into a single one (or few commits for larger changes)
  • Tika builds and unit tests pass with ./mvnw clean install (clean test alone cannot resolve the pipes plugin zips)
  • if you used a generative AI tool: follow the ASF Generative Tooling Guidance (Generated-by: <tool> in the commit message), and consider running the pre-flight in .skills/devs/pr-review/SKILL.md — fix what it finds; don't paste its report here
  • there should be no conflicts when merging the pull request branch into the recent main branch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulled main branch
  • if you add new module that downstream users will depend upon add it to relevant group in tika-bom/pom.xml.

We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Tika in general, please sign up for the Tika mailing list. Thanks!

@tballison

Copy link
Copy Markdown
Contributor Author

This is based on the point made here: #3351 We should make this easier not to get wrong.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Cross-module trust enforcement and configuration compatibility changes warrant human review and integration-test validation.

1 open issue
What changed in this PR

Extends Tika’s @OperatorOnly enforcement across request-driven component construction while preserving explicit trust for operator configuration.

Changes:

  • Propagates trust through component loading and nested deserialization.
  • Adds inherited class-level restrictions and explicit trusted JSON configuration.
  • Adds regression tests and documents configuration compatibility changes.
File Description
tika-server/​tika-server-core/​src/​main/​java/​org/​apache/​tika/​server/​core/​resource/​TikaResource.java Preserves trust when merging configuration.
tika-serialization/​src/​test/​java/​org/​apache/​tika/​serialization/​WireRestrictedParseContextTest.java Updates tests for construction-time enforcement.
tika-serialization/​src/​test/​java/​org/​apache/​tika/​serialization/​OperatorOnlyComponentTest.java Tests trusted and restricted construction paths.
tika-serialization/​src/​test/​java/​org/​apache/​tika/​metadata/​filter/​OperatorOnlySetterTestFilter.java Adds restricted-setter fixture.
tika-serialization/​src/​test/​java/​org/​apache/​tika/​metadata/​filter/​OperatorOnlyJsonConfigTestFilter.java Adds JSON-constructor fixture.
tika-serialization/​src/​test/​java/​org/​apache/​tika/​metadata/​filter/​OperatorOnlyClassTestFilter.java Adds restricted-class fixture.
tika-serialization/​src/​test/​java/​org/​apache/​tika/​metadata/​filter/​NestingTestFilter.java Adds nested-component fixture.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​serialization/​TikaModule.java Passes trust into nested construction.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​serialization/​serdes/​ParseContextDeserializer.java Replaces name blocking with class checks.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​serialization/​ParseContextUtils.java Enforces trust during context resolution.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​serialization/​OperatorOnlyGuard.java Exposes the typed guard publicly.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​serialization/​ComponentNameResolver.java Adds class-based request restrictions.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​config/​loader/​TikaObjectMapperFactory.java Adds guarded configuration reading.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​config/​loader/​InferenceLoader.java Marks operator-loaded components trusted.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​config/​loader/​FrameworkConfig.java Marks extracted operator JSON trusted.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​config/​loader/​EngineLoader.java Marks operator-loaded engines trusted.
tika-serialization/​src/​main/​java/​org/​apache/​tika/​config/​loader/​ComponentInstantiator.java Enforces restrictions and propagates trust.
tika-parsers/​tika-parsers-ml/​tika-inference/​src/​main/​java/​org/​apache/​tika/​inference/​AbstractEmbeddingFilter.java Blocks request construction through annotation.
tika-core/​src/​main/​java/​org/​apache/​tika/​config/​OperatorOnly.java Supports inherited class-level restrictions.
tika-core/​src/​main/​java/​org/​apache/​tika/​config/​JsonConfig.java Adds explicit trusted configuration factory.
tika-core/​src/​main/​java/​org/​apache/​tika/​config/​ConfigDeserializer.java Requires guarded serialization support.
docs/​modules/​ROOT/​pages/​developers/​serialization.adoc Documents enforcement and trust requirements.
CHANGES.txt Records enforcement and compatibility changes.

Review effort: Balanced

@tballison
tballison merged commit 439c13c into apache:main Oct 20, 2026
4 checks passed
@tballison
tballison deleted the TIKA-4974 branch October 20, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants