Menu

Legal journal · Barcelona Penal

Source code theft: how to take criminal action in Barcelona

Has your company's source code been stolen? Find out how to report it, preserve digital evidence and take legal action in Barcelona with criminal law experts.

Programmer wearing headphones in front of screens displaying stolen source code, a case defended in criminal proceedings by Barcelona Penal

A developer leaves the company and we discover that, days earlier, they had downloaded several repositories. A partner uses part of the software in a new project. Or a third party gains access to GitHub, GitLab or corporate servers and copies the code.

In the event of possible source code theft in Barcelona, speed is important, but we must also avoid acting hastily. Before deleting access, formatting devices or confronting the possible person responsible, it is advisable to preserve the evidence and determine exactly what information has been copied.

At Barcelona Penal, we are criminal lawyers specialising in cybercrime, trade secrets and economic crime in Barcelona. We analyse these types of incidents from a criminal law and evidential perspective and, where necessary, coordinate with computer forensics specialists.

Key summary: what to do if your company’s source code has been copied

  • Do not delete logs, devices, repositories or accounts before preserving the relevant information.
  • Review who had access to the code and what permissions they actually had.
  • Keep logs from GitHub, GitLab, Bitbucket, servers, VPNs, cloud storage and any other systems used.
  • Not all source code automatically constitutes a trade secret: it must be confidential, have value precisely because it is secret, and be protected through reasonable measures.
  • If an employee copies confidential code to use it outside the company, there may be criminal, employment and civil liability.
  • If a third party has breached security measures to access systems, there may also be an offence of unlawful access.
  • Software is protected by intellectual property rights from its creation; it does not need to have been registered beforehand to be protected.
  • Where there is a risk of immediate use or disclosure, court measures aimed at preventing further use of the code may be considered.

What we mean by source code theft

We commonly use the term “source code theft”, but legally this will not always constitute theft in the strict sense.

Code can be copied without the original disappearing.

We must therefore determine exactly what has happened:

  • An employee has copied repositories onto their personal computer.
  • A former employee uses code from their previous company.
  • A partner develops a parallel product using the same software.
  • A supplier makes use of code to which it had access solely to provide a service.
  • An external attacker unlawfully enters the systems.
  • A competitor receives and uses information knowing that it was obtained unlawfully.

Depending on the circumstances, this may involve offences relating to trade secrets, unlawful access to systems or intellectual property, as well as possible civil or employment claims.

Is source code a trade secret?

It can be, and in many technology companies it will be, but not automatically.

Trade Secrets Act 1/2019 sets out three essential requirements for information to be regarded as a trade secret:

  • It must not be generally known or readily accessible.
  • It must have commercial value precisely because it is secret.
  • It must have been protected by its holder through reasonable measures.

This is particularly important in cases of source code theft in Barcelona.

If a company allows every employee to access all repositories, does not monitor downloads, does not restrict permissions and has no confidentiality policy, it may subsequently be more difficult to show that certain information was genuinely treated as a secret.

What measures help demonstrate that code was confidential

For example:

  • Access limited by role.
  • Multi-factor authentication.
  • Logging of access and downloads.
  • Confidentiality agreements.
  • Contractual clauses governing the use of code.
  • Internal security policies.
  • Restrictions on copying information outside corporate systems.

It is not necessary to have all of these measures in place at the same time. What matters is being able to demonstrate that the company took reasonable steps to keep the information confidential.

What offences may arise if someone copies source code

We should not try to fit every case into the same offence.

What has happened What we can assess
Someone obtains confidential code to uncover a company secret Offences relating to trade secrets.
An employee or collaborator discloses information they were required to keep confidential Unlawful disclosure or use of a trade secret.
A third party enters systems without authorisation Unlawful access to computer systems.
The code is used commercially without authorisation Intellectual property protection may also be assessed.
Data or systems are destroyed or rendered unusable Computer damage offences may arise.

Trade secrets

Article 278 of the Criminal Code protects against certain conduct aimed at uncovering a company secret through the taking of data, electronic documents or media relating to that secret.

There are also specific rules for anyone who discloses or uses confidential information while under a legal or contractual duty of confidentiality.

This route may be particularly relevant where the person responsible is an employee, director, partner or supplier who was fully aware of the confidential nature of the information.

Unlawful access to systems

Where the person responsible is an external attacker who breaches security measures to enter servers, repositories or corporate systems, we can also consider the offence of unlawful access.

The Criminal Code regulates this in article 197 bis.

It should not be confused with computer damage: accessing without authorisation and destroying information are different types of conduct.

Intellectual property in software

Source code may also be protected by intellectual property rights.

This does not mean that any copy automatically constitutes an offence under article 270 of the Criminal Code. In criminal proceedings, the specific requirements laid down by that provision must be met, including the intention to obtain a direct or indirect financial benefit and harm to a third party.

Civil protection of intellectual property is broader and exists from the creation of the work.

If your company has suffered the theft of its source code, every passing hour may be crucial to preserve evidence and initiate a criminal response. Contact our specialist lawyers now and we will guide you from the outset.

What to do in the event of source code theft in Barcelona

1. Avoid deleting evidence

One of the first impulses is often to immediately close all of the suspect’s accounts, erase their devices or reinstall equipment.

Blocking access may be necessary to contain the incident, but this must be coordinated with preserving the evidence.

Depending on the case, the following may be relevant:

  • Repository access history.
  • Clones and downloads.
  • Commits and branches viewed.
  • VPN connections.
  • Access from specific devices.
  • Downloads to cloud services.
  • Use of external devices.
  • Corporate emails and communications.

2. Preserve the logs

Many systems retain information only for a certain period.

It is therefore advisable to save the relevant logs as soon as possible and prevent them from being automatically overwritten.

Where the incident is serious, we recommend that a computer forensics specialist determines what should be copied and how.

3. Do not alter devices unnecessarily

There is no universal rule that equipment must never be switched off or touched.

The response will depend on the incident and the risk that information extraction may continue.

What matters is avoiding indiscriminately formatting, restoring or manipulating systems before assessing what evidence they may contain.

4. Identify exactly what code has been copied

It is not enough to know that someone downloaded “the repository”.

We must determine:

  • Which projects were affected.
  • Which code versions.
  • Whether it contained proprietary algorithms.
  • Whether it included technical documentation.
  • Whether it contained credentials or sensitive information.
  • Whether the code was already public or contained open-source components.

This distinction can be decisive in demonstrating the value and confidential nature of the information.

What if we suspect an employee?

This is one of the most common scenarios.

An employee announces they are leaving the company and, when reviewing recent activity, we discover that they have cloned several repositories or downloaded information they would not normally access.

Having access does not mean being entitled to take the code

A developer may need access to code to do their job.

That does not mean they can later copy it to use in a personal project, hand it over to a competitor or market a product based on the company’s confidential information.

Who owns code created by an employee?

This issue is expressly regulated.

The Intellectual Property Act establishes that where an employee creates a computer program in the performance of their duties or following the company’s instructions, the exploitation rights belong exclusively to the employer, unless otherwise agreed.

This rule appears in article 97 of the Intellectual Property Act.

Should the employee be dismissed immediately?

We do not recommend making that decision automatically.

We must first assess the evidence, preserve the systems and coordinate the criminal strategy with any potential employment action.

A hasty decision may alert the suspect before relevant information has been preserved or create an additional employment dispute if the facts have not yet been sufficiently established.

What if the person responsible is a former employee?

The fact that the employment relationship has ended does not make company code freely usable information.

However, we must distinguish between:

the knowledge and professional experience that the employee may legitimately use

and

the code, documentation or confidential information owned by the company.

The Trade Secrets Act itself makes clear that its protection cannot be used to prevent an employee from making use of skills and experience honestly acquired during their professional career.

We must therefore show that protected specific information has been misappropriated or used, rather than simply that the former employee now works in the same sector.

Do we need an NDA to take action?

Not necessarily.

A confidentiality agreement is very helpful in demonstrating that both parties understood the confidential nature of the information, but its absence does not automatically mean that the code is unprotected.

We must assess all the measures adopted:

  • Contracts.
  • Internal policies.
  • Technical controls.
  • Permissions.
  • Information provided to the employee.
  • How the repositories were managed.

The essential question will be whether the company reasonably treated that information as confidential.

Must the software have been registered?

No.

Intellectual property arises from the act of creation itself.

Therefore, registering the program is not a necessary condition for protection to exist.

However, having documentation that can establish who developed the software, when it was created and who owns the rights may considerably facilitate a future dispute.

Repositories, employment contracts, invoices, development documentation and version logs can be highly relevant.

Source code theft is a serious offence requiring a precise legal strategy from the outset. At Barcelona Penal, we explain how to act, what evidence to secure and how to file a complaint with the strongest possible safeguards.

How to prove that code used by another company is ours

This is often one of the main evidential challenges.

If a former employee launches a new product, it is not enough to say that “it works the same way”.

It may be necessary to compare both solutions technically.

What a computer forensics expert can analyse

Depending on the case, they can examine:

  • Literal matches between code fragments.
  • File structure and organisation.
  • Specific functions or modules.
  • Internal comments.
  • Matching errors or peculiarities.
  • Version history.
  • Metadata and dates.

The analysis must also distinguish between genuinely proprietary elements and external components, libraries or open-source code that may legitimately be used by multiple developers.

The chain of custody of digital evidence

The term “chain of custody” simply means being able to explain where evidence came from and what has happened to it from the time it was obtained until it is presented in proceedings.

There is no need to turn the company into a forensic laboratory.

But we must be able to show that the files and logs submitted have not been tampered with.

A weakness in the chain of custody does not automatically mean that evidence will be excluded, but it may allow the other party to challenge its authenticity or reliability.

For this reason, in a particularly important case of source code theft in Barcelona, the early involvement of an expert can be especially useful.

Can we prevent them from continuing to use the code?

When we discover that the code is already being used or there is an immediate risk of disclosure, waiting until the end of proceedings may allow the damage to increase.

The Trade Secrets Act allows various court measures to be sought, including an order to cease or prohibit the use or disclosure of the trade secret where the legal requirements are met.

It also provides for interim measures aimed at temporarily protecting the information while the dispute is resolved.

This can be especially important when a competitor is about to launch a product built using allegedly stolen information.

The appropriate route — criminal, commercial or both in coordination — must be decided according to the circumstances.

How do you report source code theft?

A complaint can be filed setting out the facts and available documentation, even if the technical investigation has not yet been fully completed.

In Barcelona, Mossos d'Esquadra, the National Police, the Civil Guard or the relevant Investigating Court may intervene.

Where the conduct may constitute an offence relating to trade secrets, there is a further relevant particularity: as a general rule, the Criminal Code requires a complaint by the company or person harmed in order to prosecute these offences, except in certain cases affecting the public interest or multiple people.

This is why it is particularly important for the affected company to actively decide how it wishes to proceed.

Has a former employee, partner or competitor accessed or copied your company’s source code? Do not act without advice: poor initial handling can compromise the entire investigation. Tell us what has happened and we will assess your case with no obligation.

How long do we have to file a complaint?

There is no single time limit for every case of source code theft in Barcelona.

It will depend on the specific offences that may apply.

Many of the offences that may arise in these cases have a limitation period of five years, while certain aggravated forms may have longer periods.

However, waiting years would normally be a serious practical mistake.

Logs may be deleted, repositories may be modified, devices may disappear and the code may be disclosed to third parties.

The main question should not be how long we can wait, but how much we can preserve if we act now.

What damages can the company claim?

In addition to possible criminal liability, there may be a financial claim.

Depending on the case, we can assess:

  • Direct financial loss.
  • Losses caused by a competitor’s use of the code.
  • Lost profits where they can be proven.
  • Reasonable costs arising from investigating and containing the incident.
  • Other harm directly related to the facts.

Quantifying this damage does not simply involve adding up every hour historically spent developing the product.

It may be necessary to assess the specific value of the stolen information, how it has been used and the actual financial impact caused to the company.

How to better protect source code before a dispute arises

Good prevention serves two purposes: it makes it harder for code to leave the company and, if it does happen, it improves our ability to demonstrate what occurred.

Restrict access

Each employee should access only the repositories and projects they need to perform their role.

Log activity

Keeping records of access, cloning and downloads makes it easier to detect unusual behaviour.

Use multi-factor authentication

Especially for code repositories, cloud services and critical systems.

Set out confidentiality rules

Contracts, NDAs and internal policies should clearly explain what information is confidential and which uses are prohibited.

Manage employee departures properly

When a person leaves the company, we must revoke access, recover corporate devices and retain relevant logs for as long as necessary.

Lawyers for source code theft and trade secrets in Barcelona

Disputes involving software require an understanding of both criminal law and how code is generated, stored and versioned.

At Barcelona Penal, we are lawyers specialising in cybercrime, economic crime and the criminal protection of trade secrets in Barcelona.

From our criminal law firm in Barcelona, we can analyse how the access or copying occurred, review the available documentation, prepare the complaint and coordinate work with computer forensics experts where necessary.

As a team specialising in technology-related criminal law, we can also act as private prosecutor to actively participate in the investigation and claim financial compensation arising from the offence.

Where commercial action is also needed to stop the use or disclosure of code, the strategy must coordinate both routes to protect the company’s technology from the outset.

Conclusion

In the event of source code theft in Barcelona, the first objective should not be to file a complaint hastily, but to prevent evidence from disappearing and determine exactly what information has left the company.

We must then analyse who had access, whether the code was genuinely confidential, what measures the company used to protect it and how the information is being used.

Depending on the circumstances, claims relating to trade secrets, intellectual property, unlawful access to systems and damages may coexist.

The better the incident is documented from the outset, the stronger the company’s position will be in protecting its technology.

Frequently asked questions about source code theft in Barcelona

Is copying a company’s source code always a criminal offence?

Not automatically. We must analyse who copied it, what rights they had over it, whether it was confidential information, how it was obtained and how it was subsequently used. Depending on the circumstances, there may be criminal, civil or employment liability.

Is all source code a trade secret?

No. To be considered as such, it must be information that is not generally known or readily accessible, that has commercial value because it is secret, and that has been subject to reasonable measures to keep it confidential.

Do we need to have registered the software?

No. Intellectual property protection arises upon creation. Registration may later make it easier to prove ownership, but it is not what gives rise to the rights.

Who owns code created by an employee?

Where an employee creates a computer program within the duties entrusted to them or following the company’s instructions, the Intellectual Property Act grants the employer the program’s exploitation rights, unless otherwise agreed.

What evidence should we retain?

This includes repository access logs, cloning and downloads, VPN activity, cloud access, corporate communications, relevant devices and documentation that can establish ownership and the confidentiality of the code.

Can we prevent a former employee from continuing to use our code?

Where we can demonstrate unlawful use of a trade secret, actions are available to seek an order to cease or prohibit its use. The appropriate route and the possibility of obtaining interim measures will depend on the evidence and circumstances of the case.

Can Barcelona Penal handle a source code theft case?

Yes. At Barcelona Penal, we can analyse the facts and available evidence, prepare the criminal strategy, coordinate the preservation of technical evidence and act as private prosecutor to defend the interests of the affected company.

Briefly explain your situation. If there has been a summons or an arrest, mention it in general terms without including sensitive information in the form.

Request a consultation