Life isn't easy if your last name is 'Null' as it still breaks database entries the world over
-
It got worse than this, the ticketing company really wanted to get the money from him so when he got hold of a copy of the records and pointed out that one ticket was for a completely different car they modified the records on their end to change the make of car so it would match his. iirc he only got out of it because he had paper copies.
Don't they have to prove it with a photograph? In GermanyI'd laugh in theirface withput a photograph as evidence.
-
I have never seen this happen, and I don't know what tools would confuse the string "null" with NULL. From the comments in this thread, there are evidently more terribly programmed systems than I imagined.
As long as there's javascript somewhere, anything can happen
-
This post did not contain any content.
Lmao, I knew a guy from grade school with the last name Null.
-
NULL
!= 'NULL'How do devs make this mistake
It's baffling to me. Maybe I'm just used to using "modern" frameworks, but the only way this could be an issue is if if you literally check if the string value equals "null" and then replace it with a null value.
lastName = lastName.ToUpper() == "NULL" ? null : lastName;
Either that or the database has some bug where it's converting a string value of "null" into a
null
. -
It's baffling to me. Maybe I'm just used to using "modern" frameworks, but the only way this could be an issue is if if you literally check if the string value equals "null" and then replace it with a null value.
lastName = lastName.ToUpper() == "NULL" ? null : lastName;
Either that or the database has some bug where it's converting a string value of "null" into a
null
.That is something I’ve had to do on rare occasions because people set up and store info in stupid ways…
-
Let's take a blog and slap a whole e-commerce system on it through a plugin and let it auto translate with another one, what could go wrong. wait why is everything so slow, oh i need additional plugins for caching and one more for functionality XYZ why is everything broken now?!?
Maybe your app is based on WordPress :'D
-
It got worse than this, the ticketing company really wanted to get the money from him so when he got hold of a copy of the records and pointed out that one ticket was for a completely different car they modified the records on their end to change the make of car so it would match his. iirc he only got out of it because he had paper copies.
Isn't that falsifying legal documents? In many countries that would land you in jail? Am I wrong, did the people really run that risk?
-
Unless you’re coding from scratch it’s hard to not do this with any modern framework.
Unless you’re coding from scratch it’s hard to not do this with any modern framework.
I think that word modern is doing a lot of heavy lifting there.
A lot of systems simply aren't modern. There's always that mentality of "well, it's been working for the last 12 years, let's not mess with it now", despite all the valid objections like "but it's running on Windows2000” or "it's a data beach waiting to happen"...
-
This post did not contain any content.
I bet, I can't even read this article without confusion
-
I was NaN years old when I learned this.
It's funny because I also learned on [Object object].
-
Don't they have to prove it with a photograph? In GermanyI'd laugh in theirface withput a photograph as evidence.
Hey AI can you swap this 2015 corolla with a green 2019 Mazda 2.
Keep the license plate the same!
And remember THERE ARE FOUR PASSENGER DOORS NOT 6
-
Unless you’re coding from scratch it’s hard to not do this with any modern framework.
I think that word modern is doing a lot of heavy lifting there.
A lot of systems simply aren't modern. There's always that mentality of "well, it's been working for the last 12 years, let's not mess with it now", despite all the valid objections like "but it's running on Windows2000” or "it's a data beach waiting to happen"...
What is a data beach?
-
As long as there's javascript somewhere, anything can happen
Sounds like a promise of magic!
-
NULL
!= 'NULL'How do devs make this mistake
How do devs make this mistake
it can happen many different ways if you're not explicitly watching out for these types of things
example let's say you have a csv file with a bunch of names
id, last_name 1, schaffer 2, thornton 3, NULL 4, smith 5, "NULL"
if you use the following to import into postgres
COPY user_data (id, last_name) FROM '/path/to/data.csv' WITH (FORMAT csv, HEADER true);
number 5 will be imported as a string "NULL" but number 3 will be imported as a NULL value. of course, this is why you sanitize the data but I can imagine this happening countless times at companies all over the country
there are easy fixes if you're paying attention
COPY user_data (id, last_name) FROM '/path/to/data.csv' WITH (FORMAT csv, HEADER true, NULL '');
sets the empty string to NULL value.
example with js
fetch('/api/user/1') .then(response => response.json()) .then(data => { if (data.lastName == "null") { console.log("No last name found"); } else { console.log("Last name is:", data.lastName); } });
if
data
isdata = { id: 5, lastName: "null" };
then the if statement will trigger- as if there was no last name. that's why you gotta know the language you're using and the potential pitfalls
now you may ask -- why not just do
if (data.lastName === null)
instead? But what if the system you're working on uses
JSON.parse(data)
and that auto-converts everything to a string? it's a very natural move to check for the string"null"
obviously if you're paying attention and understand the pitfalls of certain languages (like javascript's type coercion and the particularities of
JSON.parse()
) it becomes easy but it's something that is honestly very easy to overlook -
What is a data beach?
Thanks, I missed that
-
How do devs make off by one mistakes.
The most common source of security vulnerabilities is memory corruption and off by one errors.
-
It's funny because I also learned on [Object object].
And here I am at undefined years old, learning for the first time.
-
I’ve been doing web development for something like 20 years now and I just can’t imagine how shitty your backend is if this is an issue.
As a backbend dev, I blame DBAs. We were forced to support CSV imports from out support team so they could fix data issues on their own, and now we have some wonky data in prod...
-
Yes but it's a dangerous process. You should use paramatrized queries instead.
Yup, then it becomes a front-end problem to deal with wonky input. As a backend dev, this is ideal, just give me data and I'll store it for ya.
-
Are there character escapes for SQL, to protect against stuff like that?
Only noobs get hit by this (called SQL injection). That's why we have leads review code...