Briggsy-is-back!:
I know that the security enhancements with Frameworks really make it easy to use. Will Frameworks provide the type of security I need??
Yes. And if you’re an ISV or a developer that wants to sell a Servoy module I would recommend using the same technology we developed to lock down our frameworks.
ISSUES
1- Servoy default lock
-
you can import a locked module but you can’t export it. this makes transferring a solution that includes a locked module from a 3rd party fairly difficult
-
can’t go into design mode. developing with an included locked module is aggravating
-
it’s an all or nothing lock. very difficult to make a locked module extensible
-
you can unlock a locked solution if you know a few things
2- Servoy methods in plain text in repository
Basically, you can’t sell a servoy module/solution with Servoy’s default lock to other Servoy developers. A vertical market solution is about all it’s good for. Even then I would not be comfortable with this approach.
SOLUTION
- Obfuscate your methods
- Put obfuscated methods in a plugin
- Replace original methods with calls to the plugin to run obfuscated method
optional:
4. Add license code check to any number of methods before obfuscating
BENEFITS
- No Servoy module lock
- Methods in repository have no logic in them
IMPLEMENTATION
We created a Servoy solution for this process. It gives you a list of all methods for any solution/version in a repository database of your choosing. You then select which methods you want to obfuscate. Our obfuscation steps (off the top of my head):
- license code is added
- variable names become non-sense
- all numbers become mathematical expression in hex
- each method is randomly split into many functions
- we run the results through a commercial quality command-line driven javascript obfuscator
- the results are output to a text file that gets included into our plugin
- original methods are replaced with plugin calls
EXAMPLE
- Original code
/*
* TITLE : FX_actions_sub
*
* MODULE : _FRAMEWORKS_
*
* ABOUT : get requested navigation_item properties
*
* INPUT : 1) config_type value (admin/user)
* 2) navigation set ID
*
* OUTPUT : 1) itemName array
* 2) formName array
* 3) navItemID array
*
* REQUIRES :
*
* MODIFIED : Mar 24, 2008 -- Troy Elliott, Data Mosaic
*
*/
var searchValue = arguments[0]
var navID = arguments[1]
var navigationSets = new Array()
var valueList = new Array()
var formList = new Array()
//get [searchValue] modes
var navItem = databaseManager.getFoundSet(controller.getServerName(),'mosaic_navigation_item')
navItem.clear()
navItem.find()
navItem.id_navigation = navID
navItem.row_status_show = 1
navItem.config_type = searchValue
var results = navItem.search()
if (results) {
navItem.sort('node_1 asc')
for (var j = 1; j <= navItem.getSize() ; j++) {
var record = navItem.getRecord(j)
navigationSets[navigationSets.length] = record.id_navigation_item
valueList[valueList.length] = record.item_name
formList[formList.length] = record.form_to_load
}
}
return {itemName:valueList,formName:formList,navItemID:navigationSets}
- Obfuscated code (one piece of it anyway):
(See attached pic – forum wouldn’t upload due to the weird characters)
- Modified method in repository
/*
* TITLE : FX_actions_sub
*
* MODULE : _FRAMEWORKS_
*
* ABOUT : get requested navigation_item properties
*
* INPUT : 1) config_type value (admin/user)
* 2) navigation set ID
*
* OUTPUT : 1) itemName array
* 2) formName array
* 3) navItemID array
*
* REQUIRES :
*
* MODIFIED : Mar 24, 2008 -- Troy Elliott, Data Mosaic
*
*/
var args = new Array(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6])
return plugins.Frameworks.performFunction(forms.FRAMEWORKS_0F_solution.FX_actions_sub,args,"86376305-082c-459f-ab37-ae4708e15239")
SUMMARY
We’ve been posting all of our frameworks builds to our beta testers for the last four months with this technique. They can go into design mode, integrate their modules with ours, export the entirety – with no hassle to them. Our modules are completely extensible and modifiable and yet our code is protected.
If you want to test this out for yourself, email me a solution (nothing proprietary please, but as complicated as you want). We’ll obfuscate it for you and send you back an export of a “locked” solution along with the plugin to make it run.
Cheers -
David