r/ModSupport • u/CitoyenEuropeen • 27d ago
Admin Replied I was told mods are tasked with migrating their automod config someplace.
This is r/YUROP automod config.
From the look of it, rules 2.4.α, 3.1.α, 3.1.β, 3.6.θ, 5.4.ζ and 5.5 α may be eligible to Rules Hub.
I don’t have one single slot left in automations.
Automod Neo doesn’t want it (invalid regex pattern).
What do I do.
18
Upvotes
34
u/thepottsy 💡 Top 10% Helper 💡 27d ago
I applaud the use of github, but what in the crack cocaine is going on with that automod code?
27
u/fsv 27d ago •
Automod Neo developer here. It will work with your ruleset but you will need to tweak some of your regexes due to the strict YAML and Regex engines I'm using.
For example, take the first validation error with the regex
b(u\/)?remindme(bot)?|u\/((pixel\-counter\-|bot\-sleuth\-|audd)bot|recognizesong|savevideo|spambotswatter|thesunflowerseeds|whynotcollegeboard)\b.The escapes on the hyphens are unnecessary and cause it to break. If you replace the
\-with simply-it will be fine with that regex. You need to do the same with the_and\"too. A find-replace on the whole yaml document fixed a lot.Then there are UNICODE character classes that differ between Python and JS regex. For example this check:
~body(regex): ['(\p{Armenian}|\p{Georgian}|\p{Greek}|[¡ªº¿ÀÁÂÃÄÆÇÈÉÊËĞÌÍÎÏÐÑÒÓÔÕÖØŞÙÚÛÜÝÞßàáâãäæçèéêëğìíîïðñòóôõöøşùúûüýþÿŒœŸ])']You need to include
Script=e.g.\p{Script=Armenian}.Next, there's a regex that's included a really rather high number of times that's vulnerable to Regex Denial of Servicethat will need to be fixed. Not sure why it's in your ruleset around 20 times. It's the one that starts
((?=.*\bchocolate\b)(?=.*\b(cup)?cake\b)(?=.*\brecipes?\b).*|. This is also vulnerable to ReDoS:(?=.*count)(?=.*\bthree\b).*The one that starts
\U0001F1FA\U0001F1F8|\b(2a|(2|seco)nd(also included many many times) needs to be reworked because Python and JS regex uses different syntax for Unicode escapes.This is invalid JS regex - remove the
?at the end:\b(time ?['‘’i]?s an? illusion)\b?`I think that's about it. But I am noticing that there's a performance issue validating the (stupendously big) ruleset beyond that that I will look to address in the next version.
14
u/Sephardson 27d ago
The regex can most likely be fixed, it's just needs some translation from python to javascript.
I'd offer some help, but i'm booked through for the next 3 weeks.
5
u/AssassinOfSouls 27d ago
I love that automod config, please leave the post up, it is absolutely glorious.
4
u/lift_ticket83 Reddit Admin: Community 26d ago
These configs really are something special (literal works of art). Thanks for sharing them.
As for those six rules, they sound like good candidates to explore with Rules Hub. For now, I'd hang on to your existing Automod setup. Early next year, we're giving Rules Hub more flexibility, including ways to bring in context from existing Automod configs and provide additional enforcement instructions. We'd love to use some of your examples to help test that work. I can follow up with you separately on that front.
Thanks again for sharing - these are exactly the sort of details that are useful for us to see.
37
u/mrekted 27d ago
I don't have an answer, but a question..
Why in gods name is 1/3 of the code commented ascii art???
11
u/camrynbronk 27d ago edited 27d ago
You format your automod like a non-crazy person and use a regex that makes sense??
5
u/Dekamir 27d ago
Reddit should take money parsing that YAML.
7
u/Halaku 💡 Top 10% Helper 💡 27d ago
Set it on fire and start over.
5
u/RS_Someone 27d ago
Is Reddit actually telling people to start dumping AutoMod already? By my estimations, we've got a year at minimum before replacing even half our code is viable, and longer before the more niche stuff is possible.
Auto-enforce has been in beta for well over a year now. There was a period of about 8 months when absolutely nothing happened at all with it, and we still can't even add context. Recent Automation features were 4 months late and under-delivered, and it's been another few months since I heard anything new about that. Out of maybe 40 code blocks, I think I was able to migrate 3 or 4 of them so far.
6
u/juleznailedit 27d ago
I hope you stub your toe for making us scroll through that mess.
2
u/InGeekiTrust 💡 Top 10% Helper 💡 27d ago
Oh so what you want to do is the reason why Neo isn't accepting it is because it is slightly different regex. One is python regex and the other is Java regex. Here's what you need to do you go to the devvit app page for Neo and there you will find the documentation. You feed that documentation into copilot and then you tell it to convert all of your auto mod code to be compliant with the documentation.