The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

prying eyes, some config files, and htaccess

Here's my situation:  I'm writing a webapp in PHP that will use one or more SQLite db's for storage.  In the past, I've stored configuration info for webapps as key-value pairs in a multidimensional associative array stored in a separate config.php file.  If someone downloaded the source for the app, saw how it was structured, and then tried navigating to the conf file of an installed version in their browser, they'd get a blank page or some kind of message if I wanted to be cute.

This time around, I'm using an XML config file so that I can validate it (using a RelaxNG schema at the moment, but obviously could switch to something else like Schematron or W3C XML Schema later on) quickly and easily when the app is run or accessed.

Both the XML and the schema are XML files, so they're plain text and can be parsed by most browsers or viewed via view source in the browser.  They live in a conf/ directory that resides in the root folder of my webapp.

If I restrict the permissions on the conf directory or these files (chmod'ing them), they can't be loaded by my webapp.  I won't be storing any usernames or passwords in the configuration file, but I'd rather that they not be accessible through the browser.

I've hit upon using an .htaccess file in the conf directory like this one:

<Files *>
Order allow,deny
Allow from domain-where-app-is-installed.tld
</Files>

This allows my app to load its conf file and gives prying visitors a 403 Forbidden response.

The obvious downside is that this restricts my software to running on Apache, but I'm fine with that.

Other than putting the conf directory above the publicly-accessible part of my server directory tree, does anyone have any ideas that trump htaccess?
suggestions will be appreciated
Wednesday, November 02, 2005
 
 
>Other than putting the conf directory above the publicly-accessible part of my server directory tree, does anyone have any ideas that trump htaccess?

Why is this not your first choice? It's what I do all the time.
just wondering
Wednesday, November 02, 2005
 
 
I'm my only user right now, but I might make this thing available for download at some point.  I saw two issues with putting part of the app up and out of the publicly-browsable part of the directory tree :

(1.) It introduces more complexity - the installer for my app, which will check the server config to make sure that all of the prerequisites are installed, will write the htaccess files, jumpstart the db(s), etc. can't really guess where to put this directory.  It makes another thing to ask the user about at install time, which makes the install less simple.

(2.) With webapps, it seems as though most people are accustomed to every piece of an app living "under a single roof" so to speak.  Part of the general crappiness of desktop software is that it scatters pieces of itself all over (in Windows, there are entries in the registry, maybe a folder in the "Application Data" directory, the main application folder under Programs, etc.). I don't want to piss people off.

I'm probably going to experiment with putting the conf folder up and out, and may make it an "advanced" option for the installer.

Does anyone know of any downsides for .htaccess as a tool for controlling access to files on a webserver (besides it being Apache only and not protecting your files from people who have access to the system - i.e. sysadmins/techs if you're in a shared hosting environment)?
suggestions will be appreciated
Wednesday, November 02, 2005
 
 
"Does anyone know of any downsides for .htaccess as a tool for controlling access to files on a webserver"

Sometimes .htaccess is disabled (some or all capabilities) in the apache server config.

Other than that, there isn't much of a downside.
Almost H. Anonymous Send private email
Thursday, November 03, 2005
 
 
"Other than putting the conf directory above the publicly-accessible part of my server directory tree, does anyone have any ideas that trump htaccess?"
Put it above the publicly-accessible part of your server directory tree. Oh, wait...  no, no idea's.
Dave
Friday, November 04, 2005
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz