how to enable extension for hgweb?

Christian Ebert blacktrash at gmx.net
Thu Jul 5 02:42:16 CDT 2007


* Christian Ebert on Wednesday, July 04, 2007 at 21:42:39 +0200:
> * Alexis S. L. Carvalho on Wednesday, July 04, 2007 at 14:06:35 -0300:
>> Thus spake Christian Ebert:
>>> Unfortunately, for my public repos, I have not access to /etc/
>>> and not the permissions to change the owner of repo/.hg/hgrc
>> 
>> Mercurial refuses to load extensions from hgrc files from users/groups
>> it doesn't trust.  This is a basic security check to avoid running
>> arbitrary code.  It sounds like, in your setup, the cgi script is run by
>> user "www", which won't trust your user by default.
>> 
>>> Does anybody happen to have an idea how to circumvent this from
>>> within mercurial, in this case installed in
>>> $HOME/lib/python/{mercurial,hgext} ?
>> 
>> Can you change the cgi script?
> 
> Yes.
> 
>> In this case, add something like this to it:
>> 
>> import os
>> os.environ['HGRCPATH'] = '/path/to/a/hgrc'
> 
>> And then put this in /path/to/a/hgrc:
>> 
>> [trusted]
>> users = my-username
> 
> Thanks! It works now.

A note for anyone else needing this: it only works for me with
/recent/ versions of Mercurial; I had 2f489b00f8eb on my public
server and was wondering why it worked on my local machine and
not on the other server. So one needs a more recent Mercurial
than above for it to work -- 0.9.4 should be save.

Thanks again, Alexis.

c
-- 
keyword extension for Mercurial (http://selenic.com/mercurial):
<http://www.blacktrash.org/hg/hgkeyword/>
Mercurial crew development repository + keyword extension:
<http://www.blacktrash.org/hg/hg-crew-keyword/>


More information about the Mercurial mailing list