missing formspec escapes #5925

Closed
opened 2024-01-06 22:31:37 +00:00 by tour · 11 comments

seeing #5921 & #5920 I remember that I once found a missing formspec escape.
I showed Alias, but forgot to report it here.

I later did a grep for bad formspec patterns (which produced lots of false positives) and can add some more:

  • locks
  • mobs_core and mobs_redo nametag
  • moremesecons craftable command block
  • petz christmas present
seeing #5921 & #5920 I remember that I once found a missing formspec escape. I showed Alias, but forgot to report it here. I later did a grep for bad formspec patterns (which produced lots of false positives) and can add some more: - locks - mobs_core and mobs_redo nametag - moremesecons craftable command block - petz christmas present
AliasAlreadyTaken added the
1. kind/bug
3. source/mod upstream
labels 2024-01-06 22:49:53 +00:00

Mind to share your grep, so we (and other servers) can reproduce it on their code?

Mind to share your grep, so we (and other servers) can reproduce it on their code?
Author

Forgot the exact command. Was on my old laptop.
I might find it in the bash history there, but I won't have access to that machine before tomorrow night.

Forgot the exact command. Was on my old laptop. I might find it in the bash history there, but I won't have access to that machine before tomorrow night.
flux added the
2. prio/critical
label 2024-01-07 02:27:45 +00:00
Member

i don't think this sort of bug is easily grep-able, though it could be detected with good integration testing. "wishes for 2024"

i don't think this sort of bug is easily grep-able, though it could be detected with good integration testing. "wishes for 2024"
Author

i don't think this sort of bug is easily grep-able

very true, around >90% of my grep are false-positive...

first attemp: grep -r -n ";\"[\n ]*\.\." (eg. grep for ;" .. since that's what most people use to create formspecs)
Note that this won't catch formspecs build with string.format (I sometimes use this methods, but I haven't seen it somewhere else).
doesn't work if someone starts their concatenation without a ; in the end of their formspec strings.

But this pattern creates way too much false-positives.
From looking into the result, I noticed that many modders formspec-escape while building the fs-string, so I changed the pattern to
grep -r -n ";\"[\n ]*\.\.[^(]*]"
Note that there are still tons of false positives (As mentioned in my first comment)
this pattern might also let some bad boys through, but will therefore remove many false positives.

Soo...
I don't really see a good way to find missing formspec escapes.
some patterns might help to find places where formspecs are build.
bad boys might still not be found by this pattern, but I've never seen such a bad boy (eg. I'm quite sure they don't exist / The cost/benefit ratio is not worth looking for them)

The grep output to find the examples in my first comment was around 100-200 lines. (But I used the first pattern, which included way more false positves (learned a lot about patterns since these days)
If the grep output from YL is <1k <500 lines, I would volunteer to check them out and document my results here.

> i don't think this sort of bug is easily grep-able very true, around >90% of my grep are false-positive... first attemp: `grep -r -n ";\"[\n ]*\.\."` (eg. grep for `;" ..` since that's what most people use to create formspecs) Note that this won't catch formspecs build with `string.format` (I sometimes use this methods, but I haven't seen it somewhere else). doesn't work if someone starts their concatenation without a ; in the end of their formspec strings. But this pattern creates **way too much** false-positives. From looking into the result, I noticed that many modders formspec-escape while building the fs-string, so I changed the pattern to `grep -r -n ";\"[\n ]*\.\.[^(]*]"` Note that there are still tons of false positives (As mentioned in my first comment) this pattern might also let some bad boys through, but will therefore remove many false positives. Soo... I don't really see a good way to find missing formspec escapes. some patterns might help to find places where formspecs are build. bad boys might still not be found by this pattern, but I've never seen such a bad boy (eg. I'm quite sure they don't exist / The cost/benefit ratio is not worth looking for them) The grep output to find the examples in my first comment was around 100-200 lines. (But I used the first pattern, which included way more false positves (learned a lot about patterns since these days) If the grep output from YL is <~~1k~~ <500 lines, I would volunteer to check them out and document my results here.
Author

started to fix some of the known problems:

started to fix some of the known problems: - petz (already merged while writing this): https://github.com/runsy/petz/pull/207 - moremesecons (craftable command block): https://github.com/minetest-mods/MoreMesecons/pull/34 - mobs redo: https://codeberg.org/tenplus1/mobs_redo/pulls/9 not sure about mobs_core (according to /mods it's on YL): https://content.minetest.net/packages/mt-mods/mob_core/ says it is no longer supported. Their mobs_core:nametag is also affected. But I guess they are not obtainable on YL? (at least I can't find them in the crafting grid...)

We're throwing out mob_core, don't bother

We're throwing out mob_core, don't bother
flux added the
4. step/ready to QA test
4. step/partially fixed
labels 2024-01-21 23:14:02 +00:00
Member

petz upstream is merged

petz upstream is merged
Author

mobs redo is fixed too.

mobs redo is fixed too.
Author

Had to fix my PR to moremesecons bc. I made it before I saw #6038 and therefore made the same mistake... But now it's fixed too...

Had to fix my PR to moremesecons bc. I made it before I saw #6038 and therefore made the same mistake... But now it's fixed too...
AliasAlreadyTaken added this to the 1.1.123 milestone 2024-01-24 04:51:47 +00:00

QA

All three mentioned mods have their fs escaped properly, I can't add funny stuff :)

QA All three mentioned mods have their fs escaped properly, I can't add funny stuff :)
AliasAlreadyTaken added the
ugh/QA OK
label 2024-01-28 12:50:33 +00:00
flux added
5. result/fixed
and removed
4. step/ready to QA test
4. step/partially fixed
labels 2024-03-28 20:18:20 +00:00
Member

live

live
flux closed this issue 2024-03-28 20:18:43 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: your-land/bugtracker#5925
No description provided.