Disabled CUSTOM types still serialize through OJSONWriter
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/OJSONWriter.java around line 173 and compare its CUSTOM handling with the other serializers’ checks for DB_CUSTOM_SUPPORT. Start with the existing OJsonWithCustom.testCustomFieldDisabled test and add coverage for ODocument.toJSON() with custom support disabled. Done when the write path rejects or skips the CUSTOM value and no longer emits its u marker and Base64 payload.
Written by the indexing model from the issue text.
Description
OrientDB Version: 3.2.55 (build 5a42e4f47183a1db1fa00186bd817dda57e24eeb)
Java Version: OpenJDK 1.8.0_492 (jdk8u492-b09)
OS: Linux x86_64 (official orientdb:latest image, Docker)
Expected behavior
When DB_CUSTOM_SUPPORT / db.custom.support is false, CUSTOM types should be disabled consistently. The JSON write path (ODocument.toJSON() / OJSONWriter) should not emit a CUSTOM @fieldTypes marker (u) and a Java-serialized Base64 payload; it should reject the write with the same kind of error as the other serializers, or skip the value.
Actual behavior
With custom support disabled, ODocument.toJSON() still produces the custom representation:
{"@type":"d","@version":0,"@fieldTypes":"customField=u","customField":"rO0..."}
The PoC reports HAS_FIELD_TYPES=true, HAS_CUSTOM_TYPE_MARKER=true, HAS_JAVA_SERIALIZED_PAYLOAD=true.
Deserializing that same JSON while support is disabled then fails with:
ODatabaseException: OType CUSTOM used with serializable types, is not enabled...
So the write path produces data that the same configuration refuses to read.
Steps to reproduce
This is a Java API-level reproduction using the runtime jars from the official image.
- Start the container (the image provides
javacand/orientdb/lib/*):
docker run -d --name orient-custom -p 127.0.0.1:32480:2480 \
-e ORIENTDB_ROOT_PASSWORD=auditpass orientdb:latest
- Compile and run a small PoC inside the container:
// outline
OGlobalConfiguration.DB_CUSTOM_SUPPORT.setValue(true);
ODocument doc = new ODocument("CustomDoc");
doc.field("customField", new MySerializableValue(...)); // OType.CUSTOM
OGlobalConfiguration.DB_CUSTOM_SUPPORT.setValue(false);
String json = doc.toJSON();
System.out.println(json);
-
Observe the output contains
"@fieldTypes":"customField=u"and a Base64 Java-serializedcustomFieldvalue. -
Feed the same JSON back to the deserializer while support is disabled; it throws
OType CUSTOM used with serializable types, is not enabled....
The PoC creates the field while support is enabled and then flips it off, so the failure is isolated to the write path.
Additional context
core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/OJSONWriter.java:173— thevalueType == OType.CUSTOMbranch creates anObjectOutputStream, serializes the object and writes Base64, but never reads or checksDB_CUSTOM_SUPPORT.OGlobalConfiguration.DB_CUSTOM_SUPPORTis documented as “Enables or disables use of custom types”.ODocument.field(...)/ODocument.setFieldType(...)and the JSON/binary/network serializers already check the flag and throw when CUSTOM is used while disabled.- The existing
OJsonWithCustom.testCustomFieldDisabledtest covers deserialization, but it does not assert thattoJSON()also refuses to write custom content.
I re-checked current develop on 2026-11-17: OJSONWriter.java still has the CUSTOM branch without a DB_CUSTOM_SUPPORT check.
Suggested fix: check DB_CUSTOM_SUPPORT in the OJSONWriter CUSTOM branch and throw the same ODatabaseException (or skip the value with a diagnostic) used by the other serializers; add a test that calls toJSON() with the flag off and asserts it throws/skips instead of emitting u + Base64.
Scope note: this is a local Java API reproduction, not an HTTP/SQL surface. The PoC uses the runtime jars from the 3.2.55 image.
- Dominant language
- Java
- Stars
- 5k
- Forks
- 871
- Avg merge
- 17h 38m
- Merged PRs (30d)
- 40
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from orientechnologies/orientdb
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
orientechnologies/orientdb#11015 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
orientechnologies/orientdb#11013 ·
Maintainers usually reply within 1 day
-
Finalized promises remain in promisedById, so isPromised() keeps returning true and the map leaksOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
orientechnologies/orientdb#11012 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
orientechnologies/orientdb#11011 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
orientechnologies/orientdb#10999 ·
Maintainers usually reply within 1 day
All issues in orientechnologies/orientdb
Similar issues
-
mobile prio:39 type:graphics-bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
HMCL-dev/HMCL#7339 · 5 comments · 6 reactions ·
Maintainers usually reply within 1 day
-
needs-format
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Niko1221/Strata#6475 · 1 comment ·
Maintainers usually reply within 6 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 74/100
zeweihan/aiworkdeck#1643 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
DIGI-UW/OpenELIS-Global-2#5149 ·
Maintainers usually reply within 1 day