pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedWrap (obfuscate) code
14+ messages / 6 participants
[nested] [flat]
* Wrap (obfuscate) code
@ 2006-07-04 17:53 Rodrigo De Leon <rdeleonp@gmail.com>
0 siblings, 1 reply; 14+ messages in thread
From: Rodrigo De Leon @ 2006-07-04 17:53 UTC (permalink / raw)
To: pgsql-admin
Good afternoon.
I'm not sure if this is the correct list, so please forgive me if it's not.
I was wondering if there's a mechanism (or if not, a workaround) to
obfuscate server code (PL/PgSQL), a la Oracle's PL/SQL Wrap Utility:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm#LNPLS016
Thanks for your time.
Regards,
Rodrigo
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-04 18:41 Jonah H. Harris <jonah.harris@gmail.com>
parent: Rodrigo De Leon <rdeleonp@gmail.com>
0 siblings, 2 replies; 14+ messages in thread
From: Jonah H. Harris @ 2006-07-04 18:41 UTC (permalink / raw)
To: rdeleonp@gmail.com; rdeleonp@yahoo.com; +Cc: pgsql-admin
On 7/4/06, Rodrigo De Leon <rdeleonp@gmail.com> wrote:
> I was wondering if there's a mechanism (or if not, a workaround) to
> obfuscate server code (PL/PgSQL), a la Oracle's PL/SQL Wrap Utility:
No, there is no such utility for PostgreSQL. And, even if there were,
it wouldn't actually stop someone from reverse engineering it quite
easily as the source code to PL/pgSQL itself is readily available.
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-04 19:34 Rodrigo De Leon <rdeleonp@gmail.com>
parent: Jonah H. Harris <jonah.harris@gmail.com>
1 sibling, 0 replies; 14+ messages in thread
From: Rodrigo De Leon @ 2006-07-04 19:34 UTC (permalink / raw)
To: pgsql-admin
On 7/4/06, Jonah H. Harris <jonah.harris@gmail.com> wrote:
> No, there is no such utility for PostgreSQL. And, even if there were,
> it wouldn't actually stop someone from reverse engineering it quite
> easily as the source code to PL/pgSQL itself is readily available.
I see. Thanks for the reply, both to you and Mr. Momjian.
Regards,
Rodrigo
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-04 20:55 Aaron Bono <postgresql@aranya.com>
parent: Jonah H. Harris <jonah.harris@gmail.com>
1 sibling, 1 reply; 14+ messages in thread
From: Aaron Bono @ 2006-07-04 20:55 UTC (permalink / raw)
To: Jonah H. Harris <jonah.harris@gmail.com>; +Cc: rdeleonp@gmail.com; rdeleonp@yahoo.com; pgsql-admin
On 7/4/06, Jonah H. Harris <jonah.harris@gmail.com> wrote:
>
> On 7/4/06, Rodrigo De Leon <rdeleonp@gmail.com> wrote:
> > I was wondering if there's a mechanism (or if not, a workaround) to
> > obfuscate server code (PL/PgSQL), a la Oracle's PL/SQL Wrap Utility:
>
> No, there is no such utility for PostgreSQL. And, even if there were,
> it wouldn't actually stop someone from reverse engineering it quite
> easily as the source code to PL/pgSQL itself is readily available.
I don't see how PostgreSQL being open source will stop obfuscation of the
PL/pgSQL from being possible. Sure you can look at the code for a stored
procedure but the point of obfuscation is to make it hard to understand, not
impossible to see. A very long stored procedure could be quite difficult to
read if it were obfuscated well - that would not stop someone from being
able to understand what you did, just make it so hard that it would be
unlikely that it is worth the effort.
-Aaron
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-04 22:52 Jonah H. Harris <jonah.harris@gmail.com>
parent: Aaron Bono <postgresql@aranya.com>
0 siblings, 1 reply; 14+ messages in thread
From: Jonah H. Harris @ 2006-07-04 22:52 UTC (permalink / raw)
To: Aaron Bono <postgresql@aranya.com>; +Cc: rdeleonp@gmail.com; rdeleonp@yahoo.com; pgsql-admin
On 7/4/06, Aaron Bono <postgresql@aranya.com> wrote:
> I don't see how PostgreSQL being open source will stop obfuscation of the
> PL/pgSQL from being possible.
You're missing the whole point. Oracle doesn't obfuscate the code,
they compile it into bytecode and then spit the bytecode back out as a
textual "wrapped" version... this wouldn't work for an open source
database because all you'd have to do is modify the PL/pgSQL engine to
act as a code generator so that upon execution, it would nicely
generate source code to the function. In short, childs play.
In fact, the Oracle wrap utility doesn't totally prevent you from
reverse engineering a procedure, function, or package... it just makes
it *very* difficult. I had to do this for a company that paid a
developer to write some code for them and the consultant only gave
them the wrapped version (refusing to give them the actual source
code). I had to reverse engineer his algorithm with nothing but
wrapped code.
Just remember, if you had the source code to Oracle, the wrap utility
would be pretty much worthless as you could easily do the same thing
as PL/pgSQL and PostgreSQL.
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-04 22:53 Jonah H. Harris <jonah.harris@gmail.com>
parent: Jonah H. Harris <jonah.harris@gmail.com>
0 siblings, 1 reply; 14+ messages in thread
From: Jonah H. Harris @ 2006-07-04 22:53 UTC (permalink / raw)
To: Aaron Bono <postgresql@aranya.com>; +Cc: rdeleonp@gmail.com; rdeleonp@yahoo.com; pgsql-admin
On 7/4/06, Jonah H. Harris <jonah.harris@gmail.com> wrote:
> On 7/4/06, Aaron Bono <postgresql@aranya.com> wrote:
> > I don't see how PostgreSQL being open source will stop obfuscation of the
> > PL/pgSQL from being possible.
Oh, and I forgot to add, obfuscation is lame and doesn't really work.
Anyone with a good amount of compiler knowledge can easily get past
obfuscated code. But hey, if it makes you feel like you've protected
yourself, by all means... obfuscate away :)
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-04 23:56 Joshua D. Drake <jd@commandprompt.com>
parent: Jonah H. Harris <jonah.harris@gmail.com>
0 siblings, 2 replies; 14+ messages in thread
From: Joshua D. Drake @ 2006-07-04 23:56 UTC (permalink / raw)
To: pgsql-admin; +Cc: Jonah H. Harris <jonah.harris@gmail.com>; Aaron Bono <postgresql@aranya.com>; rdeleonp@gmail.com; rdeleonp@yahoo.com
On Tuesday 04 July 2006 15:53, Jonah H. Harris wrote:
> On 7/4/06, Jonah H. Harris <jonah.harris@gmail.com> wrote:
> > On 7/4/06, Aaron Bono <postgresql@aranya.com> wrote:
> > > I don't see how PostgreSQL being open source will stop obfuscation of
> > > the PL/pgSQL from being possible.
>
> Oh, and I forgot to add, obfuscation is lame and doesn't really work.
> Anyone with a good amount of compiler knowledge can easily get past
> obfuscated code. But hey, if it makes you feel like you've protected
> yourself, by all means... obfuscate away :)
Obfuscation is good in the sense that it can allow a person paying for code
to have a reasonable piece of mind that their customers can't just open the
jar and steal the cookies.
Although everything you say is accurate Jonah, it will cost more money to
defang obfuscated code then non obfuscated code. Thus there is a financial
detterant to stealing.
I have more then once been in an environment where, "Oh we just "sampled" the
function from *xyz*".
Sincerely,
Joshua D. Drake
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-05 01:38 Rodrigo De Leon <rdeleonp@gmail.com>
parent: Joshua D. Drake <jd@commandprompt.com>
1 sibling, 1 reply; 14+ messages in thread
From: Rodrigo De Leon @ 2006-07-05 01:38 UTC (permalink / raw)
To: Joshua D. Drake <jd@commandprompt.com>; +Cc: pgsql-admin@postgresql.org, "Jonah H. Harris" <jonah.harris@gmail.com>; Aaron Bono <postgresql@aranya.com>; rdeleonp@yahoo.com
On 7/4/06, Joshua D. Drake <jd@commandprompt.com> wrote:
> I have more then once been in an environment where, "Oh we just "sampled" the
> function from *xyz*".
That's precisely the reason I was asking, because my colleagues and I
had that same experience with Oracle packages when doing consulting
work for a customer.
After an incident where the customer's IT department had taken the
decision to try and *improve* the code we delivered, we just gave them
the original, untainted packages in wrapped format, and went on our
merry ways.
I would be quite a bonus to have equivalent functionality in PG.
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-05 01:51 Tom Lane <tgl@sss.pgh.pa.us>
parent: Rodrigo De Leon <rdeleonp@gmail.com>
0 siblings, 2 replies; 14+ messages in thread
From: Tom Lane @ 2006-07-05 01:51 UTC (permalink / raw)
To: rdeleonp@gmail.com; rdeleonp@yahoo.com; +Cc: Joshua D. Drake <jd@commandprompt.com>; pgsql-admin@postgresql.org, "Jonah H. Harris" <jonah.harris@gmail.com>; Aaron Bono <postgresql@aranya.com>
"Rodrigo De Leon" <rdeleonp@gmail.com> writes:
> I would be quite a bonus to have equivalent functionality in PG.
Write your functions in C and give them precompiled libraries.
Yes, also theoretically decompilable, but plenty hard ... plus
they have to come back to you for an update on every major PG
revision ;-)
regards, tom lane
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-05 01:56 Joshua D. Drake <jd@commandprompt.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 14+ messages in thread
From: Joshua D. Drake @ 2006-07-05 01:56 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: rdeleonp@gmail.com, rdeleonp@yahoo.com, pgsql-admin@postgresql.org, "Jonah H. Harris" <jonah.harris@gmail.com>; Aaron Bono <postgresql@aranya.com>
On Tuesday 04 July 2006 18:51, Tom Lane wrote:
> "Rodrigo De Leon" <rdeleonp@gmail.com> writes:
> > I would be quite a bonus to have equivalent functionality in PG.
>
> Write your functions in C and give them precompiled libraries.
> Yes, also theoretically decompilable, but plenty hard ... plus
> they have to come back to you for an update on every major PG
> revision ;-)
On that note, would it be possible to write a language handler in
C that would wrap plPgsql? E.g;
Write function in plpgsql, but call plpgsql_o
plpgsql_o takes the plpgsql code and turns it into some kind of bytecode.
When executed via postgresql, the handler defanges the bytecode and
hands it off to plpgsql for proper processing?
Just a thought.
Joshua D. Drake
>
> regards, tom lane
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-05 13:10 Jonah H. Harris <jonah.harris@gmail.com>
parent: Joshua D. Drake <jd@commandprompt.com>
1 sibling, 0 replies; 14+ messages in thread
From: Jonah H. Harris @ 2006-07-05 13:10 UTC (permalink / raw)
To: Joshua D. Drake <jd@commandprompt.com>; +Cc: pgsql-admin@postgresql.org, "Aaron Bono" <postgresql@aranya.com>; rdeleonp@gmail.com; rdeleonp@yahoo.com
On 7/4/06, Joshua D. Drake <jd@commandprompt.com> wrote:
> Although everything you say is accurate Jonah, it will cost more money to
> defang obfuscated code then non obfuscated code. Thus there is a financial
> detterant to stealing.
My bet is that it would take < 1 day to turn PL/pgSQL into a code
generator, thereby making both the obfuscation and bytecode methods
practically worthless.
I agree with Tom... if you want to hide the code just write it in C.
Of course, you could always take the "proprietary" shell script
approach and hide the PL/pgSQL in C code so that, upon execution, the
C code generates and calls the PL/pgSQL function and removes it on
exit... but still, it wouldn't really be that hard to get around it.
I've used Oracle's wrap utility on several products, but I've never
really felt that it secured our code... just made it *very* difficult
to decompile. I've never used obfuscation because I know how easy it
is to hack one of the C or Java compilers to make the code much more
readable and understandable. Just my 2 cents... but if someone wants
to add obfuscation functionality to PL/pgSQL, by all means go for it.
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-05 19:08 Scott Marlowe <smarlowe@g2switchworks.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 2 replies; 14+ messages in thread
From: Scott Marlowe @ 2006-07-05 19:08 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: rdeleonp@gmail.com, rdeleonp@yahoo.com, "Joshua D. Drake" <jd@commandprompt.com>; pgsql-admin@postgresql.org, "Jonah H. Harris" <jonah.harris@gmail.com>; Aaron Bono <postgresql@aranya.com>
On Tue, 2006-07-04 at 20:51, Tom Lane wrote:
> "Rodrigo De Leon" <rdeleonp@gmail.com> writes:
> > I would be quite a bonus to have equivalent functionality in PG.
>
> Write your functions in C and give them precompiled libraries.
> Yes, also theoretically decompilable, but plenty hard ... plus
> they have to come back to you for an update on every major PG
> revision ;-)
Or, just hire a crusty old perl programmer and have him write them all
as one line, super compact perl scripts and use plperl.
;^)
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-05 19:14 Joshua D. Drake <jd@commandprompt.com>
parent: Scott Marlowe <smarlowe@g2switchworks.com>
1 sibling, 0 replies; 14+ messages in thread
From: Joshua D. Drake @ 2006-07-05 19:14 UTC (permalink / raw)
To: Scott Marlowe <smarlowe@g2switchworks.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; rdeleonp@gmail.com, rdeleonp@yahoo.com, pgsql-admin@postgresql.org, "Jonah H. Harris" <jonah.harris@gmail.com>; Aaron Bono <postgresql@aranya.com>
On Wednesday
> Or, just hire a crusty old perl programmer and have him write them all
> as one line, super compact perl scripts and use plperl.
I thought we were actually trying to *help* people on this list... ;)
Joshua D. Drake
>
> ;^)
--
=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Wrap (obfuscate) code
@ 2006-07-05 19:18 Rodrigo De Leon <rdeleonp@gmail.com>
parent: Scott Marlowe <smarlowe@g2switchworks.com>
1 sibling, 0 replies; 14+ messages in thread
From: Rodrigo De Leon @ 2006-07-05 19:18 UTC (permalink / raw)
To: pgsql-admin
On 7/5/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
> Or, just hire a crusty old perl programmer and have him write them all
> as one line, super compact perl scripts and use plperl.
>
> ;^)
ROFLMAO!
The plpgsql_o idea sounds cool, but it seems I'm the only one that
presented such a need :(
Maybe no one else really cares about such functionality... if that's
the case, oh well... anyways, PG rocks!
Regards,
Rodrigo
^ permalink raw reply [nested|flat] 14+ messages in thread
end of thread, other threads:[~2006-07-05 19:18 UTC | newest]
Thread overview: 14+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-04 17:53 Wrap (obfuscate) code Rodrigo De Leon <rdeleonp@gmail.com>
2006-07-04 18:41 ` Jonah H. Harris <jonah.harris@gmail.com>
2006-07-04 19:34 ` Rodrigo De Leon <rdeleonp@gmail.com>
2006-07-04 20:55 ` Aaron Bono <postgresql@aranya.com>
2006-07-04 22:52 ` Jonah H. Harris <jonah.harris@gmail.com>
2006-07-04 22:53 ` Jonah H. Harris <jonah.harris@gmail.com>
2006-07-04 23:56 ` Joshua D. Drake <jd@commandprompt.com>
2006-07-05 01:38 ` Rodrigo De Leon <rdeleonp@gmail.com>
2006-07-05 01:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-07-05 01:56 ` Joshua D. Drake <jd@commandprompt.com>
2006-07-05 19:08 ` Scott Marlowe <smarlowe@g2switchworks.com>
2006-07-05 19:14 ` Joshua D. Drake <jd@commandprompt.com>
2006-07-05 19:18 ` Rodrigo De Leon <rdeleonp@gmail.com>
2006-07-05 13:10 ` Jonah H. Harris <jonah.harris@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox