sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:

Here's a weird question, the answer's probably "no" but I have some weird twisted hopes that this would be possible.

Is it possible to change the address line in perl to something fake? Instead of trying to learn cookies I'm trying to see if I can get a login script to goto let's say www.mypage.com/members/characters/blah and in the url have it show somethign like www.mypage.com/unknown. If this can be done I won't have to password protect the actual directory because no one will ever know about it.

Can anything like this be done?

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Replies are listed 'Best First'.
Re: (nrd) Changing the address line/location bar
by newrisedesigns (Curate) on Feb 28, 2003 at 18:21 UTC

    Obscurity does not equal security.

    Use Apache's basic authentication, or a CGI script.

    #Psuedo Code my $q = CGI->new(); if($q->param("password") eq "my password"){ my $base_dir = '../secure_docs/'; my $requested_file = $q->param("file") || ''; if($requested_file =~ /(\w+)/){ $requested_file = $1 . '.html'; } else{ exit; } my file = $base_dir . $requested_file; if(-e $file){ open($fh, $file); print while <$fh>; close $fh; } } else{ exit; } # of course, there are other/better ways...

    Hope this helps.

    John J Reiser
    newrisedesigns.com

Re: Changing the address line/location bar
by tall_man (Parson) on Feb 28, 2003 at 17:48 UTC
    This question is rather strangely put, but I suppose what you are asking about is whether a cgi script can deliver the contents of another page without telling the browser the location. The answer is obviously yes. The browser will show the cgi command it used to get the answer, not the address of the page the cgi script used.

    The other thing I should mention is that "security through obscurity" is not a good idea. You should assume that "secret" directory names will be leaked or guessed eventually.

      I concur with this approach, as thats exactly what I suggested in the CB.

      I however didn't realize that this is an attempt to not have to secure a directory. *BAD BAD BAD* If you have sensitive data, secure it. Simply not showing someone that the door is wide open and all your goodies are inside is no excuse not to put a lock on the door, and close said door. There are all manner of articles online and elseware that talk about this. Companies have even tried to press legal charges against people who managed to walk in the open door, and results have varied.

      If you want secure data, encrypt/password protect it.

      /* And the Creator, against his better judgement, wrote man.c */
Re: Changing the address line/location bar
by jasonk (Parson) on Feb 28, 2003 at 17:46 UTC

    No, this cannot be done, using frames it is possible to have an outer frame that displays an inner frame, so the content is the inner frame, but the address is that of the outer frame. However this method is (a) annoying, and (b) NOT a security technique. There is nothing you can do to hide the URL that cannot be trivially bypassed. You should rethink your security scheme to something that doesn't depend on hiding the url.

Re: Changing the address line/location bar
by silent11 (Vicar) on Feb 28, 2003 at 18:23 UTC
    answer: javascript
    function changeLocation(){ location.replace("www.mypage.com/unknown"); }
    This will not protect you as it is a javascript (client-side) solution... and we never trust the client!

    -Silent11