• Home

CodingExperiments.com

$ sudo make money

Search

Category:

  • Apple Inc.
  • Facts
  • Fun
  • Google
  • Google Android
  • Ideas
  • Internet
  • Linux
  • Microsoft
  • Programming
  • Rants
  • Security
  • Uncategorized
  • web 2.0

Archives:

  • April 2010
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007

Pages

  • About
  • About
    • The Authors
  • Commenting your code
  • How to Write Papers with Groff
  • ModCMS Anti-Spam Component Set
  • ModCMS Technical Specifications
  • Regular Expressions Guessing Game
  • Saving code directly to a web server
  • The (Almost) Perfect PHP 404 Page

Meta:

  • RSS
  • Comments RSS

Awesomeness tracker

CodingExperiments at Blogged View blog authority
Free Page Rank Tool

Debug Constants vs. Secret GET Parameters

March 11th, 2008 by Voyagerfan5761

A while back I commented on one of possible248′s posts that secret GET parameters aren’t the best way to do debugging. The problem is that if someone discovers your “secret” parameter (which most people would probably set to just debug=1), they can get all sorts of information about your site’s underlying code structure.

What I like to do is have debug mode switched in the source code itself, say in a global include file that defines constants and variables for the entire site. (MediaWiki’s LocalSettings.php is a good example.) Since it’s usually wise to do your development on a different set of files (at least, if not on your own machine), you can make changes and set debug mode on while coding, and then turn it off before uploading the code to the live site. There’s no risk of someone discovering a hidden parameter, and you use the same basic if(debug){print debug stuff} code that you would otherwise.

It’s not necessarily something you would call a “best practice”; it’s just the sort of thing that you want to think about before making the decision to use GET params or constants. If security is important, you should stick with things that can only be switched by modifying the source code. Barring anyone hacking your server, everything would be safe from GET snoopers.

This is your daily food for thought.


Posted in Programming, Uncategorized | View Comments

  • possible248

    Well, I don't set my debug parameter to "debug =1". I put a more complex, almost password-like, value to the parameter.

    Changing something in the source code of a PHP app on a remote server takes longer than simply modifying the URL of the PHP page that you are looking at.

    However, I suppose that when the developer reaches a point where is no longer modifying the code and content is being added to the website, then the code that has the debugging parameter displaying messages can be removed.

blog comments powered by Disqus

 
Wordpress Themes by and Website Templates by Blogcut Blogged Blog Directory Blog Directory - Blogged