Conversation
Repin script/download_tika_data.rb from the 2026-05-11 snapshot (c2972478) to the commit the 4.0.0 tag dereferences to (514e1b3d) and regenerate lib/marcel/tables.rb with rake update. Upstream's diff is confined to five types, classified as follows: * application/vnd.android.axml: new type with working magic (RES_XML_TYPE header + string-pool chunk). Additive; previously application/octet-stream. * application/pdf: a new priority-40 regex fallback for %PDF headers behind long print-job-ticket comment preambles (TIKA-4782). The generator's regex subset can't express it, so it joins the pinned unsupported-rule manifest (59 -> 60 rules, sha and warning-line counts updated in generate_tables.rb and generate_tables_test.rb). PDF detection is unchanged. * application/pkcs7-signature, application/pkcs7-mime, application/x-pkcs12: Tika rebuilt these DER magics on typeless <match value="0x..."> elements. Tika defaults an absent type to "string" and hex-decodes the value, but the generator only decodes when type="string" is explicit, so both the old rules (five 0x3080-0x3084 branches) and the new ones generate as inert literal-text matchers. No behavior change: dead before, dead after. The PEM pkcs7-signature branch still works. * application/timestamped-data: the one live behavior change. The pre-4.0 magic was a working byte match on 30 80 06 0B 2A 86 48 86 F7; the 4.0.0 rewrite nests the OID under a typeless 0x30 match, which would have silently killed content detection marcel 2.0 shipped. data/custom.xml now carries upstream's rule with the match types spelled out: same shape and priority, requiring the full id-ct-timestampedData OID (.9.16.1.31) across the DER length forms. Net effect is a fix in both directions: definite long-form encodings are now detected (previously only indefinite 30 80), and sibling CMS content types in the 1.2.840.113549.1.9.16.1.* arc (compressedData, authData, ...) are no longer misdetected as timestamped-data, which the loose 9-byte prefix allowed. New fixtures pin timestamped-data (both DER length forms) and AXML detection, and a regression test pins the CMS false-positive fix. Follow-up worth its own change: teach the generator to decode typeless matches the way Tika does (or count them as unsupported) instead of emitting silent literal-text matchers; that would enliven the CMS/DER magics carried dead in the tables today.
The fixture encoded a 35-byte body with the two-byte long form (30 82 00 23), which DER forbids: lengths must use the shortest encoding. Grow the payload past 255 bytes so the 30 82 header is legitimately required, keeping the OID at offset 4 that the fixture exists to exercise.
Merged
jeremy
added a commit
that referenced
this pull request
Aug 22, 2026
Tika 4.0.0 data refresh (#177): new Android binary XML detection is additive, and the timestamped-data change is a bug fix — correct definite-length DER detection, no more misidentifying sibling CMS content types. No API, Ruby requirement, canonical type, alias, or extension changes: minor release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repins
script/download_tika_data.rbfrom the 2026-05-11 snapshot (c2972478) to the commit the4.0.0release tag dereferences to (514e1b3d), regenerateslib/marcel/tables.rbviarake update, and classifies every resulting behavior change.Classified behavior diff
Upstream's data diff since our pin is confined to five types.
(a) Additive
application/vnd.android.axml— new type with working magic (RES_XML_TYPEheader03 00 08 00+RES_STRING_POOL_TYPEat offset 8). Previouslyapplication/octet-stream. Fixture added.application/pdf— a new priority-40 regex fallback for%PDFheaders behind long print-job-ticket comment preambles (TIKA-4782). The generator's regex subset can't express it, so it joins the pinned unsupported-rule manifest (59 → 60 rules; sha + warning-line counts updated). PDF detection is unchanged.Inert (dead before, dead after)
application/pkcs7-signature(DER branches),application/pkcs7-mime,application/x-pkcs12— Tika rebuilt these DER magics on typeless<match value="0x...">elements. Tika defaults an absenttypetostringand hex-decodes; our generator only decodes whentype="string"is explicit, so both the old rules (five0x3080–0x3084branches) and the new ones generate as inert literal-text matchers. No behavior change either direction. The PEM-----BEGIN PKCS7branch still works.(b) The one live flip:
application/timestamped-dataThe pre-4.0 magic was a working byte match on
30 80 06 0B 2A 86 48 86 F7(type="string", hex-decoded). The 4.0.0 rewrite nests the OID under a typeless0x30parent, which — via the generator gap above — would have silently killed the content detection marcel 2.0 shipped.data/custom.xmlnow carries upstream's rule with the match types spelled out: same shape and priority 60, requiring the full id-ct-timestampedData OID (1.2.840.113549.1.9.16.1.31) scanned across the DER length forms (offset="2:6"). Net effect is a correctness fix in both directions, each pinned by a test:30 82 …) are now detected — previously only the indefinite30 80form matched;1.2.840.113549.1.9.16.1.*arc (compressedData.9, authData.2, …) are no longer misdetected astimestamped-data, which the loose 9-byte prefix allowed. Upstream's own comments confirm the intent: the masked.9.16.1.*magic belongs topkcs7-mime, withtimestamped-datawinning only on its exact OID at higher priority.(c) Canonical names / aliases / extensions
None. The tables diff outside MAGIC is empty.
Verification
rakegreen (668 runs), includingtables:checkand the pinned unsupported-rule manifest.rake updateis idempotent — re-running leaves the tree unchanged.timestamped-datain both DER length forms, AXML; new regression test for the CMS-arc false positive.Follow-up (not this PR)
Teach the generator to decode typeless matches the way Tika does — or count them as unsupported — instead of emitting silent literal-text matchers. That would enliven the CMS/DER magics carried dead in the tables today (~14 entries), each needing individual review.
Review notes
timestamped-datamatcher carried in the tables is near-inert rather than fully dead: a file beginning with the literal ASCII text0x30and carrying the binary TSD OID within bytes 2–6 would still match. Any such collision necessarily contains the full id-ct-timestampedData OID, so the detection it produces is the same one the live rule gives real TSD files; not worth adding suppression machinery to the generator for. Goes away with the typeless-decode follow-up.30 82long form is legitimately required.