What Is Code Access Security (CAS)?
CAS is like a bouncer. It keeps out the riffraff but lets you and your buddies in. CAS is designed to address the issues faced when obtaining code from external sources, which contain bugs and vulnerabilities. These bugs and vulnerabilities may make a user's system vulnerable to malicious code, which may be performing tasks without the user knowing it. The Code Access Security model is applied to native code in the same way as managed code. Native code and managed code have the same security privileges. The only difference is that managed code is compiled into IL code, and native code is machine code. Native code can still use CAS permissions, but it needs to be granted access through the same process as managed code. Native code accessing code remotely through reflection is given the same permissions as managed code. CAS is a layer on top of your operating system that provides evidence-based security. That means it's not just about the permissions you have but also the evidence that you have. It's like saying you're going to be allowed to do something if you can show me proof that it's okay. So, if I want to open a door, I need to offer you my ID card and also tell you what time it is because those are the things that prove I'm allowed to open doors at this particular time. It is the system that runs your code. It does so in a sandbox, meaning that it has to ensure that the code you write can't do anything bad to the system or other programs running on it. It does this by asking for permissions as necessary and then ensuring those permissions are granted before allowing your code to run. If they aren't granted, an exception will be thrown.
Related Terms by Software Development
Join Our Newsletter
Get weekly news, engaging articles, and career tips-all free!
By subscribing to our newsletter, you're cool with our terms and conditions and agree to our Privacy Policy.