Is code obfuscation allowed in FOSS source code as per any of the popularly used FOSS licenses? If it is allowed, to what degree and extent?
1Do you mean obfuscating the code and then also distributing the non-obfuscated version as well? Or do you mean obfuscating the code and then refusing to distribute the non-obfuscated version?– BrandinJun 21, 2019 at 11:19
@Brandin, for now let's say that this question be taken in a general sense. When I had asked the question, I had the issues of security and code review in mind.– Basil AjithJun 21, 2019 at 17:58
How are you thinking of using obfuscation to improve security, and/or code review.– ctrl-alt-delorJun 22, 2019 at 17:56
2@ctrl-alt-delor, no, that was neither my line of thinking nor my goal. There is an argument, which you would surely know, that FOSS boosts security and privacy because the code is open, and an expert can review the code for backdoors, vulnerabilities, bugs etc. Now, I had heard of code obfuscation in the past. So, I wanted to know whether code obfuscation stands in the way of review of FOSS. For that I wanted to know whether code obfuscation was common in FOSS.– Basil AjithJun 22, 2019 at 18:32
No open source license that I know of disallows obfuscation, minification, or similar modifications. In a way, that's just a kind of translation like compilation, and it wouldn't make sense for an open source license to disallow compilation.
However, some licenses require the source code to be made available under certain circumstances. But what is the source code? The GPL defines the source code as:
the preferred form of the work for making modifications to it.
This is a very flexible definition. For example, if only obfuscated source code is available then that code might indeed be the preferred form of modifications. But the GPL's source code requirements cannot be satisfied with an obfuscated version if you have a non-obfuscated version available. Providing obfuscated code in place of the actual source code would be a license violation.
- Is code obfuscation allowed in FLOSS source code? Only if real source code is also available under the licence.
- Are there any FLOSS licences that allow obfuscation without restriction? Yes: all permissive licences, but then the software is no longer FLOSS.
No: it is impossible, there are no FLOSS licences that allow this. Any licence that does is not FLOSS. However it is allowed (e.g. as the compiled form of the program), so long as real source code is available, according to the rules of the licence.
See Free Software Definition, here is an extract.
- The freedom to run the program as you wish, for any purpose (freedom 0).
- The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
- The freedom to redistribute copies so you can help others (freedom 2).
- The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
The freedom to study the source code and make changes
In order for freedoms 1 and 3 (the freedom to make changes and the freedom to publish the changed versions) to be meaningful, you must have access to the source code of the program. Therefore, accessibility of source code is a necessary condition for free software. Obfuscated “source code” is not real source code and does not count as source code.
Extract from Open Source Definition:
2. Source Code
The program must include source code, and must allow distribution in source code as well as compiled form. Where some form of a product is not distributed with source code, there must be a well-publicized means of obtaining the source code for no more than a reasonable reproduction cost, preferably downloading via the Internet without charge. The source code must be the preferred form in which a programmer would modify the program. Deliberately obfuscated source code is not allowed. Intermediate forms such as the output of a preprocessor or translator are not allowed.
A note on permissive licences
Permissive Free-Software / Open-Source licences, allow one to make the software become proprietary.
While the licenses are Free-Software / Open-Source licences, and the software is Free-Software / Open-Source. You may choose to make it proprietary, then you may distribute without access to the source code. This includes obfuscation.
e.g. The MacOS X core is not Free-Software / Open-Source even though it was based on BSD.
That's a very strong statement. The 2-clause BSD license contains no obvious provision forbidding code obfuscation, and neither do most of the other "permissive" licenses.– KevinJun 25, 2019 at 21:22
@kevin Ahh yes. While the permissive licenses are Free-Software / Open-Source licences. The software, after it has been distributed in executable form only (no access to source code), is no longer Free-Software / Open-Source. e.g. The MacOS X core is not Free-Software / Open-Source even though it was based on BSD. Jun 26, 2019 at 8:49