Architecting Secure-First Software for Developers by Mahesh Chand | Code Quality Conference 2023
Oct 30, 2023
In this session, software developers will learn what and how to architect software apps that are secure and hack-proof.
Conference Website: https://codequalityconf.com
đź”— C# Corner - Community of Software and Data Developers
https://www.c-sharpcorner.com​​​​​​​​
📺 CSharp.TV - Dev Streaming Destination
#CSharpCorner​​​​​​​ #CodeQualityConf #CSharpTV
Show More Show Less View Video Transcript
0:00
thank you david for having me at this code quality conference this is amazing
0:06
you're doing this for you know 30 years in a row um today i'm going to talk about how to build
0:13
secure first software and secure first is term i just coined out there um and then i'm also going
0:23
to bring a guest a little later simon just watch out for praveen malik he's going to come
0:28
He can join the show whenever he's available, but I'm going to bring him a little after 25 minutes or so
0:37
Praveen is actually a vice president and senior security professional, works with large corporations
0:45
And right now he's a vice president of security at a big bank
0:50
So he will talk about some as well. So, yeah, let's get this started
0:55
My name is Mahesh Chan. I'm founder of C sharp corner the the community that's bringing this conference I also founded
1:04
mindcracker Inc it's a consulting firm here in Philadelphia my background is software architect
1:11
so I work a lot of software architecture when we are building new software and that's how I got to
1:15
learn all these tips and tricks which we are going to share we are going to learn today here in this
1:21
session is um so what are we going to learn in this session and who this for this session is for
1:29
software architects um software developers anybody who wants to learn how to build secure software
1:39
and the we will also a little bit talk about what is security first design principle is
1:46
what does that mean um you're going to learn how to build a secure front ends what you look for
1:52
when you're building secure back end talk about some it security and then i'm going to add some
2:00
twist to this security is the how the how current you know ai and blockchain can add the the layer
2:09
of security to your software and i'm sure you have heard of ai in blockchain by now
2:16
yeah in blockchain are going to play a major role when you're building a secure software
2:22
so let's get started um so what is security first design principle this is not somebody
2:30
there's not nobody invented this called security first design principle i just
2:34
created this term just to make separate my session so the idea with security first design principle
2:40
is when you are building think about when you're starting a new project when you start
2:45
starting a new software project. It can be a website, it can be a mobile app, it can be an enterprise app, it can be a large system with multiple apps
2:58
So when we are designing this first time as software architects, we don't put security as a part of our design and architecture phase
3:07
Security first design principle says that security needs to be part of your design and architecture phase
3:15
It cannot come later. Right now, in most cases, what we do is we build the software using some of the more of those frameworks
3:25
And then we think of security later. And we rely a lot more on IT security
3:30
as a software architects and developers we automatically assume that when we are building
3:36
this app it's going to be secure by the by the it security of that company or cloud hosting and so
3:45
on and so forth but that's exactly where we get it wrong as a software architects and developers
3:50
it is also our responsibility to build secure software hopefully that makes sense also please
3:59
please please please feel free to ask your question post your questions i'm going to take
4:04
these questions a little later part of this session i'm not going to show you any coding here
4:10
i'm not going to show you any hands-on all i'm going to do is talk through these that as an
4:16
architect when you're building a new software what you need to think and write you know there's
4:22
detailed articles are already published on these topics on c-sharp corner so if you want to go
4:28
learn how to do that how it's being done there is a bunch of articles i have written in somebody
4:34
some other authors have written on c-sharp corner so anyway first point is that when you are
4:42
designing and architecting a new product you need to think about security at that point right there
4:48
and make that as part of your design and architecture phase second is enterprise-wide
4:54
awareness of security is very important what i'm seeing again and again and we all seeing this again
5:00
and again that entire enterprise does not know or concern or understand the security
5:08
everybody at least in your it team should understand should know either it's a is a
5:14
backend developer front-end developer engineers architects devops testers even it guys they may
5:22
not involve in design and architecture phase they may not involve in security decisions but they
5:27
should all understand what software security is what are the what are the consequences if you
5:35
don't write a secure software if more awareness we build within organization better i think we will
5:43
build these systems and give you an idea the security is probably one of the major concern
5:49
in its IT field today. There was a survey there that 65% of CTO and CIOs are
5:58
they can't sleep because of their security of their data and their applications
6:03
That's a big number. And there's billions of billions of dollars being spent each year
6:08
on not only just giving money to the hackers, but also figuring out how to secure their data
6:18
Billions of billions. it's a big number out there also there is going to be a big lack big shortage of actually our
6:26
security professionals in coming time so this is also a good feel for anybody younger students or
6:32
somebody's trying to get into it space security is a big big big area where there's going to be
6:39
a big demand coming up and it's right now there's a lack of security professionals
6:43
so let's let's get this going so this gives you a little idea when you you know to me what i'm
6:51
trying to point i'm trying to make here is that whenever you're designing a new software make sure you spend a little bit time on security
6:57
so let's talk about the software security when you think of software security
7:05
there are five major areas where you know you need to think that how to secure these areas there's a
7:13
front end, back end databases, servers and network. And each of these security is managed
7:23
and implemented by different people It not just one person that does all of the security Okay that where we get it wrong we think that as a software developer and i used to be same way as a software developer back in the day
7:37
i used to think is that all i have to do is build an application build a website
7:41
and then my company it security team is separate they will take care of it but that's another
7:47
problem is that in our bigger large corporations the it teams with this that manages security
7:53
they don't really talk to developers because they don't talk to each other that's when there is a
7:59
gap between understanding the security as a whole so communication between these two teams is very
8:05
important either you are a dba either you are a it security either you are a cyber security you
8:12
are a developer you are trying to build secure app they all have to think as a it's a it's an
8:18
enterprise wide application uh implementation okay that's how we have to think so in this uh
8:25
today's session what i'll do is i'll run through these front and back in all these areas and how to
8:31
you know some of the tips out there what you can do to build these secure all these you know think
8:37
of this like you have a home in your home you have these five windows and doors front end back
8:43
and in apis databases servers and network then how do you secure all of them if one of them is not
8:50
secure if you're let's say you have a home and it has 11 doors and windows and one window a small
8:57
window is open hackers can just get in there thieves can come in there from that one window and
9:02
steal it it doesn't matter if your rest of the 10 windows and doors are secure make sense hopefully
9:09
that makes sense all right so front-end security front-end security and a lot of people think that
9:19
the hackers always come direct to the servers or databases and they hack their applications but what
9:25
we learn in recent data is that majority of a hack happens actually from the front end from
9:31
the applications through applications and that's why i keep saying that build secure software your
9:39
app can be the app can be the gateway to these hackers to come in even though your it is amazing
9:45
they have done secure all the things but you know hackers can come through your your your application
9:52
so there are here are some eight of these top top things you should look for or implement when you
9:58
think about front-end security first of all make sure that all websites connection strings public
10:05
facing anything you have they are secure https and that so the so the all transfer data transfer
10:12
is secure and encrypted at least that should be the first thing second thing is very important what i
10:18
see again and again and again a lot of developers they put their connection strings or login
10:23
credential credential somehow some way in unencrypted way in the in the application files
10:29
that's totally wrong because somebody just get into your config file or your setup or whatever
10:36
file you're storing them or even in the code or even in the i see i see some developers web
10:43
developers storing plain readable connection string in java these html and javascript files
10:51
that's a a very easy invitation to hackers all they need to do is get access to your files and
10:59
And now they can just read your connection string and go to your database. Then third thing is enforce complex passwords and rules
11:07
That's very important. And again, IT may do that, but this is also a role of software developers
11:14
And I'm still building software, you know, building these apps. And none of the developers start with implementing these complex passwords unless I go back and say, hey, these are the rules for passwords
11:26
So when you are architecting your new software, you make sure that all these are written there for developers that what kind of complex password you want to implement
11:38
Where do you want to store your connection string? Are they encrypted or not? Same thing as DTPs, right
11:44
If you are asking user to put some input scale, you make sure you have Capshine and other tools and make sure that the bots are not enabled
11:55
like sometimes you can disable any external bots you have to put extra file on there
12:00
so even google and all that they are not tracking your republic facing websites
12:06
owasp is another great uh way to um to learn about some of the security if you go search
12:12
owasp there's a website dedicated to that it has some industry standards um and there's tool
12:19
to test that too for your associate check that out that will help you as well number six is uh so i'm
12:29
sure some of you understand client-side coding versus server-side coding um and these recently
12:35
because of you know javascript and browsers are being so powerful these days there's a lot and
12:42
and lot more coding going on client sides versus the server side
12:47
So more and more developers are executing their code JavaScript in the browser
12:53
And there's a lot of JavaScript there. The JavaScript is number one programming language used, right
12:59
So when you put your code and execute in a client side, this has more chance of hacking
13:05
than compared to your code being executed on server side because servers are more secure
13:10
So just think about if you are building something very, very secure, the security, you have some data you don't want to expose to the entire hackers
13:20
Try to see, can I implement this server side? So some of your code can execute on the server side rather than on the client side
13:31
And exception and error handling, they have to be part of from day one. day one i see that again and again and again because developers trying to rush things and
13:41
they're like oh let's get the functionality done and put it out there we will come back and
13:45
implement these later the later never comes some companies have best practices they are good design
13:51
practices their architects are great they're following them but i see most of us don't but
13:57
again just because your company doesn't have a standard doesn't mean you as a software developer
14:03
or architect cannot enforce within your project. This is very important. And definitely don't rely on server security
14:10
You cannot just say that, oh, my IT is going to secure everything. I'm not worried about it
14:15
All I have to do is build an app. So based on my 25 years of experience
14:21
working and writing, building the software for enterprises, these are some of the eight things
14:27
I found that we as software developer must, must, must, must focus on these things
14:33
So, okay, so we learn about app front end security. Now let's talk about data security
14:41
Data security again, data is probably the most important part. If, if you know, most people who most hackers or anybody, they all they're going, going
14:52
after the data, right? They not really they don want to really steal your code They want to have access to code so they can really get to the data data is the one in your databases that that has you know what they really looking for either it a credit card information or is it your your healthcare data whatever it is that
15:10
really they're trying to get to so here are seven tips that i think as a software developers or dbas
15:18
or data professionals or data developers if we can implement some of these um this will help right
15:27
so encrypt sensitive data that's when i look at any software application uh recently we're trying
15:34
to you know acquire or purchase this software product and i found that the code is written is
15:44
so unsecure that I like we can deal with this. So make sure any data that's stored in databases
15:50
is sensitive should be encrypted. In these days database already have these features you don't have
15:56
to write extra code you don't have to do much about it. So for example if you are storing a
16:02
you know I don't know data birth social security credit card information password they should those
16:09
columns should be encrypted in from the database side already so if i go and log into my database i
16:16
don't think i should be able to read those sql injections and that's where when i was talking
16:23
about in my last slide is the front end 62 of cyber attacks actually happen through sql injections
16:30
so do not use i if my choice is do not use embedded sql um yes and then if there is some
16:41
data where you want this is new thing number fourth is new thing if if there is a data that
16:49
you don't want anybody to tamper with or change with it's like for audit purposes you like this
16:55
data can never be changed then microsoft launched something called sql ledger check that out it's
17:02
a service it's a database service on azure where it's a immutable ledger it's just similar to what
17:08
the blockchains use that means once you write a transaction or once a row is written in that
17:15
database nobody can ever go change or delete that and that's very useful for some some some
17:23
applications where you're trying to make sure that there cannot be fraud or changes later if
17:29
something is done it's just done there it's written there and then number five is make sure
17:35
you have so number five is it's funny um when a lot of companies the application developers and
17:45
senior developers they also manage databases when they manage databases they're using the same admin
17:51
login for everything they use a same login for the connection string they use same login to give
17:57
access to themselves or developers so this is totally wrong i think you should have separated
18:04
roles and users for applications if there are multiple applications they should have different
18:09
users for those and they should have access to those data only so if you have for example
18:14
multiple applications running from the single database then application roles the user role
18:20
should be defined so application based users can have access to that data only so think about that's
18:28
how it should be architected um and yeah keep by default access by default it should be read only
18:35
for all users for example if you want to give one user access right on right only or edit permission
18:42
on say one table then enable on that only not just enable on the entire database so that will have
18:49
some like secure at least some kind of security on your back end side um yeah apps definitely app
18:58
logins dbas admins developers they all should have different logins if there are five people in the
19:04
team you should have five logins don't give everybody same logins otherwise hard to really
19:10
track who did what what happens what application had these problems and so on so forth
19:16
all right keep those comments coming guys hopefully i'm making some sense um this um
19:24
just keep those comments coming we will take your comments in the in the end of the session
19:30
all right um backend and api security similar to the front end and database backend is also
19:37
very important same with the api make sure you secure api token base authentication is the way
19:43
to go right now you also separate read-only versus rat-only apis unless you know some you can't really
19:50
depending on the architecture of the api but if you are able to implement only for example
19:55
if you're building an api just read only for public just go i like just keep it separate
20:02
don't mix a read-only and riot api together um or you have to figure out that users who are
20:08
accessing don't have those you know post permissions just the get permissions right
20:14
um obviously do not share uh store sensitive data and plain text that's how we also discussed in the
20:21
previous two so some you remember twitter twitter got hacked and millions of millions of users the
20:27
password got stolen because they were storing their password in a plain text file no so do not
20:35
store this kind of data in plaintext. Validation is very important. Make sure that a lot of
20:42
hacks happen because the UI in the back end, they don't do validation on these parameters
20:48
and data being inputted. Logging and exceptions are very important. Make sure they're implemented
20:55
This was also mentioned in the previous screens. Make sure you use your password hash and secure
21:00
token that's again you're encrypting all sensitive data never expose sensitive data in url sometimes
21:07
you know we are passing these login credentials in the urls user ids or whatever that should not
21:13
be there and then try to implement some of the industry standard uh you know authorization and
21:20
authentication mechanisms a lot of frameworks like microsoft has their own you can use those
21:26
you can also integrate some of the external you know security um log in these
21:34
third-party apis or often bunch of others are out there you can implement those um time stamp is
21:41
important for all requests so even in the backend so at least you know what time what user called
21:49
what api these are pretty standard it just make sure you have a checklist of these so when you are
21:57
architecting and building this in the software or writing code see if you have check check check
22:02
make sure you have checked all of them all right now let's talk about server security servers are
22:09
back-end the securities right so um and then this is pretty standard it's not something i didn't
22:16
really invent this part it's a they're pretty standard out there make sure you have lesser
22:20
security patches and updates installed every every you know day almost or every week uh most there a lot of patches coming out with new new you know new uh you know fixing new problems and hacks and all those make sure you install
22:36
those latest patches obviously firewall and ports are this is not really for software developers by
22:42
i put this slide anyway but third point is good with developers and architects make sure you have
22:48
separate environments for devq and prod and also you have separate users too actually i see the
22:55
same users login passwords are being used in qa dev prod yeah it's good it's easy for us not to but
23:02
it's sometimes this could lead to this hack because um you know developers store these password in
23:09
text files they send an email they share on their skype chat they share on slacks and so on so forth
23:15
So hard drives when data is being stored, make sure you have different read and write
23:24
permission files because some users don't read only, only few you need write only
23:29
So you can don't try not to use the same drive. For example, if you have a large storage where you're storing files and only few people have
23:38
access to write permissions, maybe you want to have also separate the storage as well
23:45
script by default these are already by default done for you from your it department but just not
23:50
as a developer or architect you want to make sure that these checks are there these are already
23:57
taken care for you a limited number of to have access separate database and web servers yes
24:03
that's another thing if you can do it i know for a smaller application and startup it's hard to do
24:08
sometimes but databases should be separated than web servers and again regularly monitor app logs
24:17
server logs traffic that should be part of this even as an architect of an application you should
24:23
be monitoring checking what's going on with your application it's health these days if you are
24:28
deploying applications say on cloud like azure or aws they already have services there that can give
24:37
you all this information um yeah and audits right audits very important um i think every year every
24:45
company that is um managing this sensitive data for example you know insurance and bank and accounts
24:54
they do these regular audits i don't think as a developer you can do anything here this is more
24:59
like a it policy but they should be happening um regularly so now there's two things i'm going to
25:06
add here these are new for some of you if you are already know that that how blockchain and ai
25:12
can actually help you uh build secure software so blockchain if you don't know much about i have
25:20
written a detailed article on blockchain multiple of them on c sharp corner and if you search what
25:26
is blockchain on c sharp corner what you know you will see that that so it's good it's actually
25:32
really good for securing data that's what it's for really because data is decentralized and
25:38
distributed and data is stored multiple nodes so hackers even they though try to come hack into one
25:44
of the computers they just can't do that they use blockchain is cryptography uh cryptography from
25:52
the scratch so each block contains a cryptographic edge so if somebody's trying to mess around with
25:59
one of the blocks and data it's just not and it's impossible in blockchain blockchain is immutable
26:05
in tempo resistance what does that mean that means you can't just go and edit any record there
26:12
you can not delete data there it just you know you can only add to it and it uses consensus
26:18
mechanism so even before data can be updated or i mean added to the blockchain there's a consensus
26:26
mechanism that multiple these nodes running the blockchain they have to agree and then approve
26:32
before the data can be written on blockchain it increases transparency and auditability so
26:39
ai is also i mean a lot of companies are already using ai in security microsoft has been doing this
26:47
and they're adding more in you know and they're on their azure platform but even companies it
26:53
companies use ai tools a lot now and they can help you in these threat detects and preventions like
27:00
ai algorithms can be used to yze large amount of data for example your log files
27:05
network traffic and even user behavior as a matter of fact we are using on c sharp corner
27:11
we are building the next platform next version of next iteration of c sharp corner and ai is
27:17
a big part of us so we are using uh user behavior big time in that so next c-sharp platform launch
27:25
uh is you know going using both blockchain and ai malware detection again machine learning is being
27:32
used when deep learning being used for identifying this there is security automation and auto
27:37
responses user authentication behavior so these are some of the points uh you need you can think
27:44
when think about building a next generation software that is secure that that's what point
27:51
you can make these notes i'm happy to share even these slides to give you some list of the points
27:58
to consider so let's bring our guest now i think we are right on time it's been 30 minutes i kind
28:05
of tried to run through that bring our guest proven malik here and we will talk to him about some of
28:14
Okay, somebody is calling. What's going on here? Stop sharing, I think I can stop sharing
28:21
Let me do that. Hey, Praveen
28:32
Praveen, can you hear me? I can't hear you
28:43
Hi everyone, this is Praveen Malik. Can you hear me? Yes, are you on audio or not on video
28:51
Please let me know if you guys can hear me. Yeah, I can hear you
28:59
I guess you can hear us. But you can hear us, right
29:09
So as we were talking about the application security, so I think Mahesh already
29:18
convey a lot of information about the application security. So there are various tools are there for the application security
29:32
Some of the names of that very popular tools are the Vara code. Vara code is basically an
29:38
applications security platform that performs various different type of ysis which include static ysis dynamic ysis software composition
29:50
ysis interactive applications security testing and prediction testing so it also provide that
30:00
on-demand expertise and aim to help the complex vulnerability fixes. Then second
30:10
tool is the Qualys. The Qualys is a cloud platform which is earlier called as the
30:18
Qualys Guard. It is a basically a San Francisco based company which is having
30:23
various different modules which include the vulnerability management where means from the servers or you can validate that vulnerability from there then it is
30:39
also having a cloud testing so where you can validate that cloud vulnerability is
30:47
from the container and others and then means application security related issues also it can
30:57
validate it also having a policy compliance where it will look into that the settings whether we are
31:04
having the right settings into the systems and validate that with the industry standard like
31:13
NIST based compliances, whether all the settings are as for the NIST compliance or any other
31:19
compliances we can validate against that one. And then another module is web application
31:26
security. In that security it will validate end-to-end application security which include
31:32
the web application the backend connectivity to the databases and it can also validate some of the security based application or code based security as well so that is a really good tool to use it uh then another other tools could be the sonar
31:54
cube sonar cube is a basically it is a core component of the sonar solution it is a open
32:02
source solution and the self-management tool that systematically helps developers and organization to deliver the clean codes so in that tool you just configure your
32:18
github or the code in that one one it against it it will validate that
32:23
various OWASP top 10 related vulnerabilities in that one which I was seeing that Mahesh
32:34
was explaining very clearly that these are I mean as a developer we should take care
32:41
of these top 10 things and it again means validate against that one as well as it also
32:49
validate that the end of the life and other vulnerabilities also where we can see that
32:57
means any of these very known vulnerabilities is in the code is available and if it is it
33:06
will it can map it and it can tell you that what is the best solution for that it will
33:13
also give a kind of a guidance that instead of this code how you can change to a better secure code The next tool I can talk about is the Git Guardian Git Guardian is again internet monitoring Help organizations to detect and fix the vulnerabilities in source code at every step of software development lifecycle
33:40
With that, Git Guardian policy compliance engine security team can monitor and enforce
33:49
the rules across their VCS, DevOps and infrastructure related vulnerabilities as well
33:58
Other tools is one of also popular tool is Armour. It is a cloud mobile security solution
34:06
The vendor value proposition is that the solution was proposed built in deliver the highest level
34:13
of defense controls for the application for the organization's critical data no
34:20
matter where the data is hosted we can confidently validate the security
34:30
settings of these mobile applications I would there is again so many are there
34:39
but the last one I would like to go with that the via via app defense it is
34:45
basically a hypervisor native workload protection platform for enterprise virtualization and security teams and it delivered the most secure virtual
34:58
infrastructures which simplify the micro segmentation planning by providing that deep application visibility and reputable scoring system With that it also provides a validation on that what is the priority means it can give
35:22
you that if ten different vulnerabilities are there in the code so it will say that
35:29
okay you may not have that capability to remediate all of them so it gives you
35:33
that what should you be the priority and based on that priority you can also give
35:39
you a best effort to remediate those applications related to vulnerabilities so I think I got around ten minutes from Mahesh so I have already taken it so
35:57
giving back to the Mahesh. That's great Praveen, good tools. There's a good number of tools out
36:03
there and I'll publish it. Maybe I'll get more details and publish this somewhere list and add
36:08
a slide. But as you can see, Praveen, he has a real world experience. That's what he does
36:14
These are a bunch of the tools IT companies use. I don't expect developers to go and use all these
36:20
tools but if you can do one or two and you know see how to work with IT teams and maybe
36:28
just say hey can you demos how you guys use the sonar cube and this qualis tools and all that so
36:34
at least you get an idea as a developer that you should think about when we are writing code
#Business Operations
#Computer Security
#Hacking & Cracking
#Education
#Public Safety
#Security Products & Services
#Antivirus & Malware
#Network Security


