`/eval` and `/eval/action` with an `application/x-www-form-urlencoded` body: a NullPointerException or parse errors at positions of a text that was never sent, instead of a message naming the content type

Open
#1,906 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start by locating the /eval and /eval/action request handlers and tracing how they read application/x-www-form-urlencoded bodies and the script parameter. Check the parameter parsing path for values without = as well. Done when a form request without script returns a 400 naming the content type and parameter, and a parameter without a value is handled as an empty NULL value.

Written by the indexing model from the issue text.

Description

bug
Description

The script of an /eval or /eval/action request can be passed as the whole request body with any content type other than application/x-www-form-urlencoded, or as the script parameter. Most HTTP clients send application/x-www-form-urlencoded by default (curl --data, many SDKs), and a caller who posts the raw script that way gets no hint about the cause:

curl -X POST --data "RETURN 'ok';" http://localhost:7651/eval/action
HTTP 500
lsfusion.interop.base.exception.RemoteInternalException Internal Server Error: java.lang.NullPointerException Cannot invoke "String.equals(Object)" because "value" is null

When the text contains =, the body is split at the first = into a parameter name and a value, and the value is compiled as the script, so the reported positions belong to a text the caller never sent:

curl -X POST --data "run() { EXPORT JSON FROM v = 1; }" http://localhost:7651/eval
HTTP 500
[error]:
	UNIQUE2NSNAME:1:1 extraneous input '1' expecting EOF
curl -X POST --data "EXPORT JSON FROM v = 1;" http://localhost:7651/eval/action
HTTP 500
[error]:
	UNIQUE3NSNAME:1:8 mismatched input '1' expecting '}'
	UNIQUE3NSNAME:2:1 missing EOF at '}'

The same requests with -H "Content-Type: text/plain; charset=utf-8" work. Reproduced on 7.0-SNAPSHOT (master, 2026-10-19), on the application server's HTTP port and through the web server alike.

Expected: a 400 response that names the cause — the body was read as form parameters and no script parameter was found (the raw script is sent with another content type or as the script parameter) — or the raw body accepted as the script when the form has no script parameter.

Fix

In the eval endpoints, when the content type is application/x-www-form-urlencoded and there is no script parameter, answer with a 400 whose message names the content type and the script parameter instead of taking the first body parameter as the script. Independently of that, a parameter without a value must not fail the request while it is parsed: treat it as an empty (NULL) value.

Reason

With a form-urlencoded body the parameters are parsed from the body (the documented behaviour) and the first body parameter is taken as the script. A text without = becomes a parameter with no value, and the value is dereferenced while it is parsed as a string. A text with = becomes a name and a value, and only the value reaches the compiler, which then reports positions inside that fragment. Neither path tells the caller that the content type is the problem, and finding it took trial and error.

Dominant language
Java
Stars
214
Forks
46
PR merge metrics
No merged PRs in 30d

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lsfusion/platform

All issues in lsfusion/platform

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.