2

Are there any applications out there that will let me encode my Ruby on Rails code so others can't read it? I plan on selling a few small applications, but I really don't want everyone knowing my code.

Thanks.

John Topley
  • 113,588
  • 46
  • 195
  • 237
Matt
  • 33
  • 4
  • possible duplicate of [Obfuscating Rails app on MRI Ruby / JRuby for a enterprise customer](http://stackoverflow.com/questions/5357381/obfuscating-rails-app-on-mri-ruby-jruby-for-a-enterprise-customer) – Ciro Santilli OurBigBook.com Oct 22 '14 at 15:28

5 Answers5

4

Only example I have seen in the wild is Mingle from ThoughtWorks, which runs on JRuby, which I think they must have modified in some way to run the encrypted code.

http://www.thoughtworks-studios.com/mingle-agile-project-management

I think they may have used something like this AOT compiler: http://kenai.com/projects/jruby/pages/RailsAOT

This also looks promising: http://www.infoq.com/news/2008/10/rubyencoder

Check out this answer for other ideas. Can you Distribute a Ruby on Rails Application without Source?

Community
  • 1
  • 1
Andrew Kuklewicz
  • 10,621
  • 1
  • 34
  • 42
2

If you want people to able to run your code (and if you don't, then why did you write it in the first place?), then their CPU needs to be able to execute your code. In order to be able to execute the code, the CPU needs to be able to understand it.

Since CPUs are dumb, and humans aren't, this means that humans can understand the code as well.

The only way you can protect your code through technical means, is if you "own" the entire execution path: you need to build your own CPU, your own computer, write your own operating system and your own Ruby interpreter. Then, and only then can you protect your code. (But note that even the tiniest mistake will render all of your protections useless. Microsoft, Apple, Sony, the Music Industry and the Movie Industry can attest to that.)

Or, you could just do nothing, which means that your code will be automatically protected by copyright law.

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • You are technically correct, but for all practical purposes, this is wrong. Code is usually well-enough protected by making it sufficiently hard to read and modify. By sufficiently hard I mean: It would cost less to hire people to develop from scratch than to reverse engineer the code, and in both cases this would take long enough that simply paying for the software licence or service is continuously worth it. There are very few areas (e.g. cryptography) where people distribute open-source software protected by confidentiality agreements, and this is a legal hassle on its own. – Mefitico Nov 28 '19 at 14:05
1

Thanks for all your answers! Currently I'm looking at jRuby and Ruby Encoder options but if I find neither are what I want then I think I should just sell the code and focus more on getting customers. It really doesn't make sense to spend all this time and money on an encryption that can be easily cracked anyways.

Matt
  • 33
  • 4
0

No, there is no way to have executable code that can't be read. Hard to read yes, impossible to read is... impossible. Best you can do is obfuscate, of which there are many examples around the net (but I don't know of any libraries that do it for you).

Chuck Vose
  • 4,560
  • 24
  • 31
0

Maybe you could host the application yourself.

This way nobody will have ever access to your code and you're clients will use the application everywhere via Internet and also will pay you for the support.

In order to host rails application the easiest way you could try http://heroku.com/ or even set a small VPS with apache and mod_passenger.

fjuan
  • 2,214
  • 2
  • 17
  • 20
  • Ive been thinking more and more today about hosting it myself. The only downside is the monthly hosting cost, but I could get the smallest server and see if people even like the the apps then expand. Thanks a lot for the input[: – Matt Jan 19 '10 at 23:14
  • If monthly hosting cost is an issue then I suspect that the idea for the app isn't much of a winner. RoR is a web framework, it makes perfect sense to host it yourself and charge a subscription fee to these services. It's a proven business model and if your app is good and people want to use it then it's so the way to go. – nitecoder Jan 20 '10 at 01:23
  • Surely this doesn't answer the question. – Rog Jun 01 '11 at 13:28