Adding text between <> characters renders an empty post. (Example in this post)

AI-generated summary

The discussion revolves around how Discourse handles posts containing < and > characters, which are interpreted as HTML tags and stripped for security, potentially rendering posts empty. fzngagan demonstrates the issue with a test post, and riking explains this is intentional behavior, suggesting using &amp;lt; to display < literally. fzngagan proposes enhancing validation in the Custom Wizard plugin (and possibly core Discourse) to reject posts whose rendered (cooked) content falls below the minimum character limit, even if raw text exceeds it. neounix suggests using Markdown code fences to safely display such characters. sam acknowledges the complexity, noting cheaters can exploit Unicode or edge cases to simulate empty posts, and suggests moderation as the current solution. He also mentions a potential hook in StrippedLengthValidator for plugin customization. jomaxro edits the original post to avoid schema validation issues. fzngagan reiterates the suggestion for core Discourse to validate cooked length, but sam remains hesitant, citing user experience concerns and legitimate cases where raw text is longer than cooked content.

Hidden text below:

<OnlyTwentyCharacters>

That turns into a disallowed HTML tag and is stripped out for safety. Not a bug.

Use &lt; if you want to start your post with a < .

Thanks for the explaination. I thought so too.

Is there a function in discourse which simply strips disallowed html ? The usecase is,

In the Custom Wizard plugin we want to disallow a user from submitting a post whose total number of characters excluding these stripped characters is less than the minimum character limit.

Also, now thinking about it, it is relevant to discourse too. Doesn’t it make sense to disallow submission if the rendered content is less than the min character limit? I know this is quite more complex than it sounds.

When we have seen the same issue, we simply fence them with MD.

<here is the good stuff>

<here is the sweet stuff>

```<here is the good stuff>```

`<here is the sweet stuff>`

Cheaters gonna cheaṱ̴̢̧͔͓̘̫̫̣͕̻͉̩̯͙̝͈̞̼̻̱͉̘̘̮̜̝̬̻͕̯̜̦̹̜̐̐͊͒̉̄́͑̋̎́̋̃̀̆̕͜͜ͅ unicode is a big monster and there are plenty edge cases people can find to simulate blank posts that are not blank.

That is where moderation kicks in.

I am not sure if we have a hook you could use, but I guess you could prepend into StrippedLengthValidator.

I am half open to adding a hook there so you can do it without monkey patching.

Edited the OP as it’s getting flagged as empty by QAPage schema validation.

@sam

We were able to get this explaination across to someone who had raised their concern, also, we’re skipping model validations in the context of Custom Wizard plugin.

But in terms of core discourse, how about disallowing submission of a post if its cooked version is less than min post length ?

I am not sure about this, it would not be intuitive to the user. There are going to be edge cases where raw is longer than cooked and it is legitimate.