I'm developing a webapplication working with PHP, SQL DB and other technologies. I'm always considering someone stealing the source code or using it to other means.

How can you prevent someone from stealing your source code? If that happens what is the security practices that you can place in order to prove later in court that that source code is yours?

I know some technologies that you can use to prevent and to secure your source code, such as:

  1. Encrypting your files;
  2. Using metadatas to add watermarks to your source code;
  3. Letting all your friends know that you are developing this webapp so you have an alibi;

I would like to know how can you properly secure your source code. How can you place measures to prove later in court that that source code is yours?

I don't know if this next question fits very well in here but I will give it a shot: What proofs are accepted by the court in case someone steals your source code? I'm asking this because I know that in my home country Portugal the courts can't accept Facebook messages as proofs.

  • 4
    If your partner has access to the code (maybe because he needs to work with it) then preventing theft is impossible. And all the questions about what is accepted in the court are off-topic here because we are no legal experts. These should be better asked at law.stackexchange.com. – Steffen Ullrich Jun 25 '16 at 13:30
  • Cryptographic timestamping is the only applicable answer outside of "ask a lawyer". You can prove you held a copy of the code at time X, ideally before anybody else had it (so you can show you had it first) – Natanael Jun 25 '16 at 18:28
  • possible duplicate security.stackexchange.com/questions/40077/… – user2320464 Jun 26 '16 at 4:08

It depends against what you want to secure your code.

If this is code which will be used (as source code) in development then obviously you cannot secure anything. My rule of thumb is that one someone can see anything then you cannot secure it (this extends to all kind of DRM protected documents which you take a photo of, run though OCR and poof, there goes the DRM).

As for whether you can protect that in courts you need to ask a lawyer who understands copyright in your specific case.

If you want to co-develop but do not need to share source code, you can work via APIs, shared libraries (which can be reverse-engineered - again ask your lawyer if this is legal or not) or some other mechanism where someone makes use of the functionality of your code, but not the code itself.


How can you place measures to prove later in court that that source code is yours?

Place a copy in escrow prior to showing the code to anyone.

When you form a partnership or employ someone, you might get them to sign a statement, preferably in front of witnesses, that acknowledges your ownership of a specified body of code.

The statement might include a hash of the escrowed code or some other identification that is hard to subsequently refute.


You can secure your code in a limited fashion. Create a dedicated development environment where:

  1. The developers can connect with remote desktop only. All shared drives, clipboard sharing, local printing, etc. is disabled.
  2. The environment has no Internet access - or if it does, it's heavily restricted.

With this setup, developers can view the code but they can't copy it out of the environment. While they can take screenshots of the code, that is significantly less useful than being able to copy the whole code base out as a file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.