And then I saw the Password in the Stack Trace

Hanno's Blog

Saturday, April 8. 2017

And then I saw the Password in the Stack Trace


Trackbacks

No Trackbacks

Comments
Display comments as (Linear | Threaded)

I would suggest:
- never use display_errors in production. Even when harmless, it's a broken behaviour to the user and actually it is. A full error message "Sorry something went wrong" is better than some cryptic code in the page
- Remove passwords from your code and read them from files. Then a trace with code will not contain the password (one with variable contents still may contain it). Plus: They are easier to change everywhere in the project at once
- Consider to use a template system instead of php direct for rendering the page
- Use a error logging tool like sentry to send the errors to something managed instead of user/logfile/email. Sentry has a nice display of the message and the code around it, collects several same error in the same issue and you can mark them as resolved or regression.
#1 allo on 2017-04-08 19:13 (Reply)
You forgot to mention: don't make the database accessible
#2 Bernd (Homepage) on 2017-04-08 19:52 (Reply)
The default value oh display_errors is on the page, you referenced, right at the top:
https://secure.php.net/manual/en/errorfunc.configuration.php

usage and risks of display_errors (including "dont use in in prod!") is basic knowledge for php development.
To the "why the stacktrace": cause it was an uncaught exception. The same happens in java (e.g. with uncaught NullPointerExceptions) and many other languages. Exceptions must be caught.

it's sad, that this is another post, that makes php look bad (/worse) because of (basic/beginner) errors.
#3 Julian on 2017-04-12 09:30 (Reply)
Na, sagen Sie mal, dafür dass sie ein IT-Spezialist sind, sollten Sie ihren Blog aber wirklich besser pflegen! Sie arbeiten mit einer völlig veralteten S9Y-Version!

;-)

mfg
Gerd Höller
#4 Hans Gerhard Höller (Homepage) on 2017-04-12 11:01 (Reply)

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

 
 

About

This blog is written by Hanno Böck. Unless noted otherwise, its content is licensed as CC0.

You can find my web page with links to my work as a journalist here.

I am also publishing a newsletter about climate change and decarbonization technologies.

The blog uses the free software Serendipity and is hosted at schokokeks.org.

Hanno on Mastodon | Contact / Imprint | Privacy / Datenschutz