Archive for May 26th, 2006

26 May 2006

CSS: Points,Pixels,Ems,Percent Matrix

1 Comment Web Development

Very useful matrix for web developers:

Points Pixels Ems Percent
6pt 8px 0.5em 50%
7pt 9px 0.55em 55%
7.5pt 10px 0.625em 62.5%
8pt 11px 0.7em 70%
9pt 12px 0.75em 75%
10pt 13px 0.8em 80%
10.5pt 14px 0.875em 87.5%
11pt 15px 0.95em 95%
12pt 16px 1em 100%
13pt 17px 1.05em 105%
13.5pt 18px 1.125em 112.5%
14pt 19px 1.2em 120%
14.5pt 20px 1.25em 125%
15pt 21px 1.3em 130%
16pt 22px 1.4em 140%
17pt 23px 1.45em 145%
18pt 24px 1.5em 150%
20pt 26px 1.6em 160%
22pt 29px 1.8em 180%
24pt 32px 2em 200%
26pt 35px 2.2em 220%
27pt 36px 2.25em 225%
28pt 37px 2.3em 230%
29pt 38px 2.35em 235%
30pt 40px 2.45em 245%
32pt 42px 2.55em 255%
34pt 45px 2.75em 275%
36pt 48px 3em 300%

Via: Fernando Cortés Hierro

26 May 2006

Vulnerable JavaScript Comments

No Comments ASP.NET, Programming

Today while checking balance in my banker’s web portal, which is self acclaimed as one of the most secured online banking portal of India, I curiously thought of inspecting their HTML content using View Source. But I really shocked (and I almost got heart attack) to see whole bunch of JavaScript comment placed all over their pages. Most interesting thing was that these JavaScript snippets not only tell you bug numbers, who have done those modifications, on which date, but also what was the actual issue and how they have resolved that issue. :)

The most interesting part was:
<script language="JavaScript1.2">
function alert_keycode(){
/*
Abhilash.

This script was added bcze on pressing enter key on pwd field used to get Submittted but since the Command Action invoked was diff one that of OK button, it was not producing desired results. The solution was create a temp hidden field and changing Pwd field name to that of Ok button dynamically, assigning tmp-hidden field name/value with original Pwd Field name/value.

And submit is invoked

*/

frm = document.confirmFrm;
if(event.keyCode==13)
{
blah blah blah

I love this “detailed” and technically well explained comment provided by developer in HTML code.

On serious note, I never prefer to put these JavaScript comments in my code as you can realize from comments like these, it might give lead to reveal any vulnerability or security hole in application. Even if you don’t want to consider the increase of payload of page because of these JavaScript comment but still putting comments with all kind technical or business explanations is major security risk to your application. Don’t do that!

IMO, these code comments are for developer and not for user. My suggestion to all web developers to use server side comments instead of any client side comment specially if you are developing application for financial institutions etc.

What is your opinion if I modify above code like this:
<script language="JavaScript1.2">
function alert_keycode(){
<%
/*Abhilash.

This script was added bcze on pressing enter key on pwd field used to get Submittted but since the Command Action invoked was diff one that of OK button, it was not producing desired results. The solution was create a temp hidden field and changing Pwd field name to that of Ok button dynamically, assigning tmp-hidden field name/value with original Pwd Field name/value.
And submit is invoked
*/
%>
frm = document.confirmFrm;
if(event.keyCode==13)
{
blah blah blah
</script>

I guess later one is more secured than the original one. Do you agree with me??

26 May 2006

A lesson to be learned from this announcement!

No Comments Uncategorized

Here is an announcement from .NET Valley posted at their homepage. You probably wonder why they have so clean interface with no content at all. You will get answer if you read their recent announcement at right block of homepage.

.NET Valley

Lesson Learned: Always take backup of your data!!!