Skip to content

cannot add scalar value without an associeted key #1618

Closed
@mrahmatellah

Description

@mrahmatellah

Hello everyone,

I have deployed a waf on cloud (azure) app gateway waf,

I have a false positive ( CANNOT ADD SCALAR VALUE WITHOUT AN ASSOCIETED KEY)

I don't know why waf detect a request as a bad traffic,
this is the totaly request:
`
POST https://edu-pp.tactileo.fr/profile/internal/permissions HTTP/1.1
cache-control: no-cache
Accept: application/json
Content-Type: application/json
Authorization: Bearer
Host: edu-pp.tactileo.fr
cookie: ARRAffinity=e66763d6606203ca589c508b2ec0185c5b193bb84d15f36169a81d20ed13dc09
accept-encoding: gzip, deflate
content-length: 13

[ "teacher" ]

the rule id generated is 0

@victorhora was telling me that:
"
The error message you mentioned "Cannot add scalar value without an associated key" usually happens when the JSON parser can't associate a key to a given JSON value as the code normally expects a key/value format (e.g. [profession: "teacher"]) data for JSON and your request only contains the value ([ "teacher" ]).

#1576 might be related so maybe you could retry with the current proposed solution for v2 at #1577.

Still, as far as I can remember this error message shouldn't be causing a false positive... Unless maybe if this issue is causing the request body parser to fail and triggering rule 200002..."

I have seen in: https://fossies.org/linux/modsecurity/apache2/msc_json.c
<
"int json_add_argument(modsec_rec *msr, const char *value, unsigned length)
20 {
21 msc_arg arg = (msc_arg ) NULL;
22
23 /

24 * If we do not have a prefix, we cannot create a variable name
25 * to reference this argument; for now we simply ignore these
26 */
27 if (!msr->json->current_key) {
28 msr_log(msr, 3, "Cannot add scalar value without an associated key");
29 return 1;
30 }

thhis information but i'm not sure if the request is really ignored or not (because on logs the waf blocked the request)

But the application works fine, (no error)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions