`/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
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 67/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- backend-api-design
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 214
- Fork
- 46
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lsfusion/platform
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
Tutte le issue di lsfusion/platform
Issue simili
-
account assessment course feature lecture
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
app:learninggoalhub enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyForse già presa @vaibhavgupta443 l’ha presa oggi. Apertagood first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
apache/wicket#1991 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100