TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JavaScript from 2001 on India's largest private bank site

136 pointsby plibither8about 4 years ago

41 comments

blntechieabout 4 years ago
For people who don&#x27;t know, this bank (HDFC) was dinged and penalized by the central governing bank (Reserve Bank of India) because of the frequent outages of their banking systems.<p>They restricted the bank from issuing new credit cards for a year which is a big penalty all things considered. Also, they were given a deadline to get their tech stable and they actually brought in an IT provider for the bank to fix things which was bit high handed. But the bank was very big in the country and a failure can have cascading affects which was the reason said by the central governing bank.<p>I believe it was the first of the kind in the country to penalize a bank because their tech was unstable.
评论 #26475618 未加载
评论 #26480147 未加载
评论 #26475778 未加载
评论 #26474503 未加载
评论 #26485551 未加载
评论 #26473601 未加载
segfaultbuserrabout 4 years ago
Honestly, not too bad. At least it&#x27;s organized as recognizable functions. It just has a lot of useless repetitions that should&#x27;ve been implemented as lookup tables or format strings.<p><pre><code> datestr += &#x27;&lt;option value=&quot;&quot; selected&gt;-mmm-&lt;&#x2F;option&gt;&#x27;; datestr += &#x27;&lt;option value=&quot;01&quot;&gt;Jan&lt;&#x2F;option&gt;&#x27;; datestr += &#x27;&lt;option value=&quot;02&quot;&gt;Feb&lt;&#x2F;option&gt;&#x27;; datestr += &#x27;&lt;option value=&quot;03&quot;&gt;Mar&lt;&#x2F;option&gt;&#x27;; datestr += &#x27;&lt;option value=&quot;04&quot;&gt;Apr&lt;&#x2F;option&gt;&#x27;; datestr += &#x27;&lt;option value=&quot;05&quot;&gt;May&lt;&#x2F;option&gt;&#x27;; </code></pre> and<p><pre><code> case &quot;alphanumhyphen&quot;: if(l_str.length &gt;0 &amp;&amp; l_str.search(&quot;[^A-Za-z0-9\-_]&quot;) &gt;= 0 ){ if(p_alertFlg){ alert( p_fldTitle +&quot; should contain Alphabets or Numbers or - or _&quot;); } return &quot;alphanumhyphen&quot;; } break; case &quot;numeric&quot;: if(l_str.length &gt;0 &amp;&amp; l_str.search(&quot;[^0-9]&quot;) &gt;=0 ){ if(p_alertFlg){ alert( p_fldTitle +&quot; should contain Numbers&quot;); } return &quot;numeric&quot;; } break; case &quot;decimal&quot;: if(l_str.length &gt;0 &amp;&amp; l_str.search(&quot;[^0-9.]&quot;) &gt;=0 ){ if(p_alertFlg){ alert( p_fldTitle +&quot; should be Numeric.&quot;); } return &quot;decimal&quot;; } break; </code></pre> What is the correct term to describe this type of code?<p>I used to call it &quot;Spaghetti Code&quot;. But I recently learned that it&#x27;s incorrect. &quot;Spaghetti Code&quot; only refers to programs with messy and unclear control flows (especially unstructured programs that abuse <i>goto</i>), it&#x27;s not the correct term for code with useless repetitions.
评论 #26474289 未加载
评论 #26473540 未加载
评论 #26475206 未加载
评论 #26473520 未加载
评论 #26473534 未加载
评论 #26489956 未加载
评论 #26473705 未加载
bmurray7jhuabout 4 years ago
Flexcube is the same software package that caused Citi to accidentally send $900 million.<p><a href="https:&#x2F;&#x2F;arstechnica.com&#x2F;tech-policy&#x2F;2021&#x2F;02&#x2F;citibank-just-got-a-500-million-lesson-in-the-importance-of-ui-design&#x2F;" rel="nofollow">https:&#x2F;&#x2F;arstechnica.com&#x2F;tech-policy&#x2F;2021&#x2F;02&#x2F;citibank-just-go...</a>
评论 #26473840 未加载
distantsoundsabout 4 years ago
Wait until you guys find out your operating systems were written in a 50 year old language.
评论 #26478365 未加载
评论 #26485585 未加载
RedShift1about 4 years ago
Doesn&#x27;t look too bad to be honest, considering when it was written. There are some oddities like the functions &quot;returnTrue&quot; and &quot;returnFalse&quot;. Other than that, don&#x27;t fix what ain&#x27;t broken?
评论 #26473819 未加载
评论 #26473784 未加载
_kblcuk_about 4 years ago
They&#x27;re pretty optimistic about how long this script will be in use:<p>``` if (l_y &lt; 1900 || l_y &gt; 9999) { l_err = 1 ; l_errstring = &quot;Year is invalid.&quot;; } ```
评论 #26474628 未加载
ncannabout 4 years ago
On the topic of banks and software, I can&#x27;t understand for the life of me why almost all of the banks in Canada and US have comical level of security. Most don&#x27;t offer 2FA (of all the banks on Canada, the only one with 2FA is TD if I recall). Those who do only have 2FA through SMS so good luck travelling out of country. Many still have pin-only passwords with 4-8 digits limit...
评论 #26473716 未加载
评论 #26474861 未加载
评论 #26477633 未加载
评论 #26476263 未加载
评论 #26474290 未加载
评论 #26475033 未加载
评论 #26475393 未加载
abhas9about 4 years ago
Interesting to note that one of the consultants [1] who worked on this codebase 20 years back is now an architect in the same company.<p>```<p>25&#x2F;&#x2F;2001 Gopi Yedla Changed code for new FD opening<p>```<p>Service company that wrote the code has changed it&#x27;s name from i-flex to Oracle Financials.[2]<p>Imagine finding the code you wrote today in a random internet discussion in 2040.<p>[1] <a href="https:&#x2F;&#x2F;www.linkedin.com&#x2F;in&#x2F;gopiyedla&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.linkedin.com&#x2F;in&#x2F;gopiyedla&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;www.firstpost.com&#x2F;business&#x2F;biztech&#x2F;i-flex-solutions-is-now-oracle-financial-services-1865643.html" rel="nofollow">https:&#x2F;&#x2F;www.firstpost.com&#x2F;business&#x2F;biztech&#x2F;i-flex-solutions-...</a>
评论 #26475004 未加载
jfrunyonabout 4 years ago
Okay, so, as you can see in the first page, it is in fact not from 2001, but instead at least 2017.<p>This is like saying that Windows 10 is from 1985. Just because the first version came out then doesn&#x27;t mean the latest version did.<p>Also, just because something is old does not make it bad. How old is `mv`?
kellengreenabout 4 years ago
Honestly kudos to the team, I was expecting much worse.<p>I can&#x27;t imagine having some JS I wrote in the early 2000&#x27;s on the front page of hacker news for the world to see.
throwaway4goodabout 4 years ago
Given how old it is, it is pretty good. Maybe better than 80% of what else is out there.<p>Luckily today we have build tools to prevent us showing our dirty laundry in public.
forgotmypw17about 4 years ago
I am obsessive about backwards compatibility, and I test back to Netscape 2.0 (the first JS platform). The magic of JS feature check abilities is that you can totally cover every browser.<p>There&#x27;s a little bit of testing you have to do, because early browser wars resulted in intentionally added incompatibility gotchas, but it&#x27;s not that bad.<p>The Web is an amazing and unique platform unlike almost any other available to us. We&#x27;re so lucky to have it.
评论 #26474426 未加载
评论 #26474605 未加载
评论 #26478281 未加载
评论 #26474678 未加载
gnu8about 4 years ago
<p><pre><code> No part of this work may be reproduced, stored in a retrieval system, adopted or transmitted in any form or by any means, electronic, mechanical, photographic, graphic, optic recording or otherwise, translated in any language or computer language, without the prior written permission of i-flex Solutions Limited. </code></pre> This language would seem to make it legally awkward to even visit the web site, much less have this discussion.
beyondcomputeabout 4 years ago
The code quality is one thing but its longevity doesn’t seem to me like a problem in itself.
p_labout 4 years ago
<i>2001</i> ? That&#x27;s positively recent and modern compared to Lockheed-Martin and their &quot;our target platform is IE7 on XP, let&#x27;s use a random JS script for DHTML menus we swiped off Geocities page in 1998 for Netscape 4 and IE4&quot;.<p>... to be honest I think that while it was one of the worst dependencies, it was still ages beyond the code they wrote themselves ¯\_(ツ)_&#x2F;¯
评论 #26474582 未加载
andi999about 4 years ago
So what&#x27;s the problem? Next breaking news is that banks run a backend in COBOL?
评论 #26484444 未加载
WesleyJohnsonabout 4 years ago
When I see somewhat obtuse code like this, I often want to see how well I could refactor it using modern techniques. No frameworks or anything crazy, in this case just vanilla JS, but using current best practices and enhancements in the both the language and JS at the browser level.<p>It&#x27;s arguably a waste of time, but it does it always seems like a fun challenge. I&#x27;m sure I&#x27;m not alone in this.<p>Is there a more constructive use of that time, while getting the same dopamine hit? I suppose the obvious answer is freelance markets, but I doubt many people are paying out for &quot;just&quot; refactoring.
rlv-danabout 4 years ago
If you think this is old, you should see the mainframes running our bank systems...
评论 #26474013 未加载
sequoiaabout 4 years ago
I love how nicely documented it is, with revisions &amp; author names there at the top of the file. Very nice touch!
davchanaabout 4 years ago
Hdfc &amp; SBI being my major banks since last one-two decades, SBI&#x27;s online banking is way better than HDFC&#x27;s although former is a government bank.
stuntabout 4 years ago
Traditional companies just don&#x27;t know about building software. They often start an IT transformation initiative because a consultancy firm told them they have to do. But at best, still all the middle managers don&#x27;t buy the idea and don&#x27;t commit to it. Even when they do, they lack knowledge and expertise to be successful and company doesn&#x27;t know how to train them. So they end up doing some stuff that may sound fancy on paper (Oh we are doing Serverless), but they are still building crappy integrations and they suffer from bad communication structure.<p>Banks are innovating in traditional banking. They make fancier branches and better ATM machines, but they fail to innovate in software space while their customers are increasingly using more digital interfaces. And that&#x27;s how they can&#x27;t compete with modern FinTech players when it comes to development pace. They are just suck at software and they are lots of middle managers that unintentionally make it even harder.
WD-42about 4 years ago
The red flag is in the first 20 lines of code, after the comments. The original variable definitions were all formatted nice so that the values line up. Then later coders came along and added more stuff but didn’t bother following the original formatting, messing it up.<p>It’s a sign of the attitude of the programmers and probably reflects the quality of the actual business logic code as well.
评论 #26477616 未加载
bniabout 4 years ago
Throw the first stone. 20 years ago I wrote code like this, probably some is still in use.
评论 #26475622 未加载
rgjabout 4 years ago
I love this<p><pre><code> function returnFalse () {return false} </code></pre> and the fact that their home cooked date_val() function does not use their home cooked isLeapYear() and daysInMonth() functions, but uses its own, pretty much unreadable, leap year determination algorithm.<p><pre><code> var l_k=parseInt(l_y%100) var l_m=parseInt(l_y&#x2F;100) if (l_d == 29 &amp;&amp; ((l_y&#x2F;4)!=parseInt(l_y&#x2F;4))) { l_err=1 ; l_errstring = &quot;Date is invalid.&quot;; } if(l_k ==0){ if (l_d == 29 &amp;&amp; ((l_m&#x2F;4)!=parseInt(l_m&#x2F;4))) { l_err=1 ; l_errstring = &quot;Date is invalid.&quot;; } }</code></pre>
评论 #26474350 未加载
评论 #26473836 未加载
smilebotabout 4 years ago
I&#x27;d take it as a compliment if my code was still in use 20 years down the line.
praveen9920about 4 years ago
I have been using this bank for a while now and never bothered to check their client side code.<p>I am surprised to see their js based encryption code.<p><a href="https:&#x2F;&#x2F;netbanking.hdfcbank.com&#x2F;jsdir&#x2F;des.js" rel="nofollow">https:&#x2F;&#x2F;netbanking.hdfcbank.com&#x2F;jsdir&#x2F;des.js</a><p><a href="https:&#x2F;&#x2F;netbanking.hdfcbank.com&#x2F;jsdir&#x2F;HmacSHA256.js" rel="nofollow">https:&#x2F;&#x2F;netbanking.hdfcbank.com&#x2F;jsdir&#x2F;HmacSHA256.js</a><p><a href="https:&#x2F;&#x2F;netbanking.hdfcbank.com&#x2F;jsdir&#x2F;rsa.js" rel="nofollow">https:&#x2F;&#x2F;netbanking.hdfcbank.com&#x2F;jsdir&#x2F;rsa.js</a>
hesarenuabout 4 years ago
This reminds me of the issue i had faced on setting up account on HDFC. I entered a very long password. When i tried to login it kept failing. I was sure of the password. So clicked on reset password. Bank sent me plain password in email. And the password was cut off to 8 chars!. This happened decade ago though.
TedDoesntTalkabout 4 years ago
<p><pre><code> function cancel_request () { window.history.back(); return false; } </code></pre> —-<p>What?
评论 #26473992 未加载
ramji123456about 4 years ago
People are just spreading the rummer about the Banks with out knowing the Security Impact. Mr.Mihir Chaturvedi have you know the impact ???? OR just spreading this news for the publicity or fame ????
dfgdghdfabout 4 years ago
Keeping file version history <i>inside</i> the file makes me feel queasy.
评论 #26476284 未加载
randompwdabout 4 years ago
In the section &#x27;modification history&#x27; at the top of the file, it has entry. &gt; 18&#x2F;07&#x2F;2017 4.2 MEHUL SHAH FLEXENH-194- R_ZINE ONE<p>So, not exactly 2001.
yawaworht1978about 4 years ago
Hm last comment from 2016.<p>But considering no date libraries were used and all browsers are covered, this is nice code.<p>To me the new array() is a bit odd, was var array = [] not available yet?
anonytraryabout 4 years ago
I am impressed to see none of this<p><pre><code> prototype</code></pre>
评论 #26474577 未加载
rockyjabout 4 years ago
&quot;The Ken&quot; had an good article on the state of Indian bank&#x27;s IT systems - <a href="https:&#x2F;&#x2F;the-ken.com&#x2F;story&#x2F;sorry-for-the-inconvenience-why-your-banks-systems-keep-failing&#x2F;" rel="nofollow">https:&#x2F;&#x2F;the-ken.com&#x2F;story&#x2F;sorry-for-the-inconvenience-why-yo...</a> (behind paywall but a good read).<p>These are the &quot;star&quot; private banks, let&#x27;s not get into the state of public banks.
评论 #26476516 未加载
tushar-rabout 4 years ago
Interesting timing, given that I&#x27;m currently running through hoops with a simple address change with their bank. Their web &amp; mobile apps suck bigtime, and it looks like they aren&#x27;t even making an effort to make online transactions easier.
评论 #26474654 未加载
ramji123456about 4 years ago
What is security Impact ????its a simple JS file.
peanut_wormabout 4 years ago
Didn’t know there were ternary operators in 2001 JS
olliejabout 4 years ago
And unlike python, it stills works fine.
baybal2about 4 years ago
I can&#x27;t open it. Did we DDOS them?
clever_kingabout 4 years ago
Do you read the report from Microsoft? India is most vulnerable to cyberattack.
评论 #26475377 未加载
villgaxabout 4 years ago
Obfuscation would have saved face
评论 #26474764 未加载