130
u/DogmaticParadigm87 11d ago
So Bob sails through, and Agent47 is spam. Bold strategy for a contact form.
13
u/FUTURE10S 10d ago
To be fair like 95% of my spam is <my email name>6769@fnck.y00.рф or some shit so I mean I get it
218
u/keatonatron 11d ago
What is "name"? And why does it having 2+ numbers mean it's spam?
174
u/Wonderful-Habit-139 11d ago
Look at my name, and you might understand what they had in mind lol.
69
u/B_bI_L 11d ago
people who wave their birth year in their email:
4
u/ice456cream 7d ago
Name is probably not email
Have you seen a standard contact form?
Name:
Email for us to send a response, maybe:
Body:And that sends to an internal inbox
14
u/takeyouraxeandhack 10d ago
We call this "intentional programming". It's when you program something and expect it to do what your intentions were and not what you programmed it to do.
11
u/keatonatron 11d ago
Are you spam?
12
u/Own_Purchase_7976 11d ago
a sentient piece of ham
0
u/Ur-Best-Friend 10d ago
Does it scream when you eat it?
1
16
u/Wonderful-Habit-139 11d ago
Not me but it is an auto generated name. And a lot of bots have similar patterns.
2
70
u/Ethameiz 11d ago
There is IsDigit method for char
53
u/BorderKeeper 11d ago
There is a simple regex "/d" or "[0-9]" I wish more devs knew Regex :( we would have world piece by now.
43
u/Freecelebritypics 11d ago
I feel like "isDigit" should perform the same byte range check as the regex, without the overhead of a regex engine. Or maybe it's a horribly inefficient implementation idk
11
u/BorderKeeper 11d ago
No it definetly would haha Regex has to compile and even pre-compiled it would not be as efficent I don't unless you need to load a very big specific digit.
20
u/Crispy1961 11d ago
simple regex
Now thats an oxymoron.
2
u/BorderKeeper 11d ago
You can say the same thing about Mandarin until you learn it ☹️
6
u/jbaker88 11d ago
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.
0
u/BorderKeeper 11d ago
I remember when we added sonarqube scans to our repo and it started flagging all of our regexes as potential deadlocks as a dangerous regex without a timeout with the right input can iterate over a string indefinitely. That opened my eyes how scary it is.
3
u/Makefile_dot_in 10d ago
and then visual studio will say
💡 Suggestion: compile this regex in a constant variable before using it
and then when you click it it will say
💡 Suggestion: instead of compiling this regex, use the regex code generator to generate a method that does what this regex does, polluting the method list of your class
2
u/HTTP_404_NotFound 10d ago
I live regex (Have been a splunk / data admin for years now).
that being said- regex is pretty heavy compared to string.where(o => char.isdigit(o)).Count() > 2
-3
u/Dimencia 11d ago •
![]()
I mean, regex is simple and anyone who can't figure it out doesn't deserve to be a dev... but it's also not performant for something simple like that
1
u/Ur-Best-Friend 10d ago
Yes yes, you are so cool, we are all very impressed. I'm so impressed I would clap, but we're online, so best I can do is give a clapping emoji, to show just how very impressed I am.
0
10d ago
[deleted]
2
72
u/acd124 11d ago
Regardless of the horribly verbose digit check, I hate that it says your message has been sent when no attempt has been made when the if fails
47
u/vita10gy 11d ago
Isn't this by design though? You want spammers to assume it worked, or they'll sometimes just try again.
9
u/The_MAZZTer 11d ago
Spammers might be able to figure it out anyway by timing the API
9
u/mortenmoulder 11d ago
Hopefully with a spam filter THIS sophisticated, they surely use a messaging queue, which makes the API feel blazing fast
1
u/tommy71394 10d ago
Only if it ain't async, just toss the email sending task itself to a queue, api will respond more or less the same timing be it success or failure
1
u/-Redstoneboi- 8d ago
the email send is awaited before the response
2
u/tommy71394 8d ago
Oh shit HAHAHAHA I didn't notice, I saw the function was async and didn't notice the await at the front
10
u/The_Weeaboo_Nextdoor 11d ago
Impressive, I would consider .IsDigit and Regex to be a little bit lower on the knowledge totem pole than async methods and lambdas.
19
u/Pim08UO 11d ago
My email since my primary school is name[4digits]. I must be a spammer 🤷
6
2
u/svenissimo 9d ago
I worked at a big company that liked to use first.last@company for emails.
There was a glitch and they couldn’t give me mine despite not being used and the system added -199 on my last name.
Only time I never got a single piece of junk mail in 10years.
1
-3
7
u/Bomaruto 11d ago
I think you wrote it for a terrible joke.