Re: a trigger that sends an email

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Moray McConnachie" <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk>
Cc: "Oscar Serrano" <oserra(at)fondos(dot)net>, "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: a trigger that sends an email
Date: 2000-04-06 17:52:44
Message-ID: 27815.955043564@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

"Moray McConnachie" <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk> writes:
>> programming languages we offer are "trusted", which means you can't do
>> anything that would affect files or programs outside the database.
>> Sending email is right out.

> Could one do a rule that used a dummy function, where the function called
> the Perl routine which generates the email?

If it's in plperl then it's going to be running in a "safe" interpreter,
which should mean that you won't be able to do anything to send mail.

> CREATE RULE emailer AS ON INSERT TO new_accounts
> DO SELECT new_account_email_function(NEW.emailaddress);

> or something like that? Or is this subject to the same restrictions?

Wouldn't be much of a security system if it were that easy to get
around, would it?

The problem here is that anything done by the backend is done with the
full permissions of user postgres (or whatever the backend is running
as). So we don't want ordinary users to have access to programming
languages that will allow them to muck around with postgres' files.
The only way to escape the restrictions is to write a C-language
extension. That has to be installed by the database admin, and we
expect him to exercise some caution in what he will install...

regards, tom lane

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Craig Orsinger 2000-04-06 17:54:52 Re: a trigger that sends an email
Previous Message Moray McConnachie 2000-04-06 16:06:49 Re: a trigger that sends an email