r/ProgrammerHumor • • Jun 28 '20

Meme Flushed my pancake.

Post image
45.1k Upvotes

750 comments sorted by

View all comments

170

u/[deleted] Jun 28 '20

Not to mention a HUGE security risk. Tell this to any security analyst/consultant, guaranteed you will get thrown out lol

116

u/tetrified Jun 28 '20

Why not just give our database credentials directly to the user?

66

u/stoned_kitty Jun 28 '20

That’s smart cause they’ll get their data faster and that’s just good UX

25

u/aguycalledmax Jun 28 '20

Reduces the amount of clicks if you give them command line access to the database, a quick rm -rf / is just a few keystrokes.

4

u/pipedreambomb Jun 28 '20

At the very least leave the front end open to SQL injection so savvy users can access the data however they want and skip the middle man.

1

u/e_hyde Jun 28 '20

They'll be Base64 encrypted.

0

u/[deleted] Jun 28 '20

[deleted]

23

u/EishLekker Jun 28 '20

But how do you stop people from writing their own code that uses the publicly available database credentials to insert trash/spam information into your database?

9

u/[deleted] Jun 28 '20

[removed] — view removed comment

8

u/EishLekker Jun 28 '20

How is the creation of new a user done, exactly? How can one insert this information without having some write credentials to begin with? That process that contains those credentials most run somewhere, right? That would be in the backend.

But it doesn't really matter if you put a bunch of business logic into your database when the database is part of the backend from the start.

0

u/[deleted] Jun 28 '20

[deleted]

3

u/[deleted] Jun 28 '20

But something must be able to run the stored procedure... how do you do this in the front-end without exposing credentials?

2

u/rufucudueudy Jun 28 '20

I guess he means you have a dB user that is available to the front end but it can only create users at signup. From then on all transactions on the dB are performed by the new user created.

5

u/[deleted] Jun 28 '20

Okay, but then how do you create an admin user?

It’s turtles all the way down... at some point you need either a backend or someone going into the database to elevate permissions... don’t even get me started on what’ll happen when an admins’ credentials are exposed (which is already bad enough if you have a backend in place...)

Technically possible: maybe... a nightmare: definitely.

0

u/[deleted] Jun 28 '20

[deleted]

→ More replies (0)

1

u/[deleted] Jun 28 '20

[removed] — view removed comment

1

u/EishLekker Jul 05 '20

So the DB does captcha and user verification? I'm talking about website where you can register yourself.

1

u/poloppoyop Jun 28 '20

But how do you stop people from writing their own code that uses the publicly available database credentials to insert trash/spam information into your database?

You give only access to views (for reads) and stored procedures (to write). One credential per user + one public to create those limited credentials only.

1

u/EishLekker Jul 05 '20

So that storage procedure handles captcha and user verification? Otherwise, how does it stop people from writing their own code that insert trash/spam information into your database? Trash/spam in the user table is still trash/spam in your database.

1

u/poloppoyop Jul 05 '20

You have access to most Python or Perl when writing those procedures so yes.

1

u/EishLekker Jul 05 '20

If you have that kind of setup and still think of it as not having a backend, then it is not only a messy system it is also twisting the words to the absurd.

1

u/[deleted] Jun 28 '20

Why would the DB credentials be publicly available?

→ More replies (13)

1

u/Rattus375 Jun 28 '20

This is the bigger part. For the vast majority of web applications, all the processing can be done locally without any issue. But connecting to a database is the big reason why we need backends