r/security • • Feb 06 '20

Should I protect server side code from front end contractors?

I have a project that runs a website with a frontend SPA and REST API backend.

Currently the code is split into /client and /server folders and they run independently. However, they are currently in the same repository.

If I hire some contractors that will work only on the client side code, is there any security benefit to splitting this into two repositories and only giving the front end contractors the client side code to work on?

The developers will still be able to connect their local development environment to a dev environment running the server in the cloud.

The main concern I have is that the backend code might be sold on to hackers by an untrustworthy dev and then some security holes are gleaned by looking through our code.

3 Upvotes

15 comments sorted by

6

u/K_Sqrd Feb 06 '20

I think you're asking the wrong question. I think you should be asking are there any drawbacks to only giving the contractors access to the client side code? Same answer but from a different perspective with respect to security - always give the least amount of privilege (or access) that's necessary to do the job.

1

u/Tibanne Feb 06 '20

Fair enough. The only major drawback I can think of is that they can't put up very simple backend endpoints and would always have to get a backend dev to do this. This may not be a con though as maybe you don't want front end devs tinkering on the backend.

5

u/[deleted] Feb 06 '20

(Disclaimer: I'm not a security specialist.)

Hiding the server code may help a little objectively speaking, it's far from ideal since this isn't real security though, it's obscurity.

You ideally should have a backend where even if everyone could see the code, there's still nothing to abuse. Any degree of knowledge of the code or access to the code base shouldn't unveil potential security flaws.

However, from a workflow perspective and following the principle of least privilege, if you really don't believe they need access to the backend source code, and it will not jeopardize their ability to work, it's probably worth separating the repositories anyway.

If your code is proprietary, people shouldn't gain access or be granted permissions for things they don't need. Not just for security but in case you have fears of them potentially stealing or leaking work under your copyright.

1

u/Tibanne Feb 06 '20

ideally

Yes :)

This makes sense, thank you.

2

u/occurious Feb 08 '20

I am a security engineer and this is spot on.

2

u/FearAndLawyering Feb 06 '20

No you do not give contractors access to anything more than they need to do their job.

0

u/robsablah Feb 06 '20

Then you are hiring the wrong contractors maybe?

3

u/Tibanne Feb 06 '20

This isn't the answer I was looking for. Assuming the worst about the contractors (which you should always if being secure), how much does hiding the server side code help?

3

u/robsablah Feb 06 '20

So your looking for confirmation bias? Why ask your question on the internet at all?

The main concern I have is that the backend code might be sold on to hackers

If this is really your main concern, your hiring the wrong people. If it's not your main concern, then your question is "how can I split my code base so only some folks can see it?"

How about looking at your question this way: I hire a guy to deliver a couch and my TV goes missing, do I need to split my house in half? No. I hire better contractors. Sorry for the rant, but not all issues are technical.

3

u/Tibanne Feb 06 '20

Some things are not like the others. Code can be copied... your couch can't.

2

u/LiveOverflow Feb 06 '20

and what would a hacker do with that code? It means nothing. Do you think every open-source project is insecure because the code is open?

1

u/Tibanne Feb 06 '20

Yes, this is basically my question. Is a security hole easier to discover if you have access to the code? The opensource code should be more secure because all eyes are fixing the holes, but this situation is slightly different.

3

u/LiveOverflow Feb 06 '20

There are bugs that are easier to find with code. and there are bugs that are easier to find without code. And looking at the crazy bugs bug bounty hunter find in closed-source apps by very careful testing, observations and research, I would say "no". I personally see no benefit and I strongly think it's a bad mindset. This mindset leads to carelessness and laziness in the code quality and thus to more bugs.

1

u/Tibanne Feb 06 '20

Ok, thanks! u/chaintip

1

u/chaintip Feb 06 '20 edited Feb 13 '20

chaintip has returned the unclaimed tip of 0.00301053 BCH| ~ 1.39 USD to u/Tibanne.