InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
But Why This Change, What Was The Problem With Cas? |
Answer»
|
|
| 2. |
What Are The Components Of Code Access Security? |
|
Answer» Code Group : The evidence provided by an assembly is used as the condition for granting and revoking permissions to it. It is done by putting the code in an appropriate code group. Every code group stipulates a membership condition and has specific conditions attached to it. Any assemblies that meet the condition become a member of the group. Code groups are arranged in a hierarchy and assemblies are nearly always matched to several code groups. The code group at the root of the hierarchy is called All Code and contains all other code groups. Evidence : In order for the CLR to determine which code group to place assembly information into, the FIRST step is to read supplied evidence. There are two main sources of information, they are internet and intranet. The group internet defines code that is sources from the internet and the group intranet defines code sources from a LAN. The examination of the assembly evidence makes the authentication part of the security process. Permissions : Permissions are the actions you ALLOW each code group to perform. The system administrator usually manages the permissions at the enterprise, MACHINE and user levels. The CLR Virtual Execution System (VES) loads and runs programs. It provides the functionality required to execute managed code and uses assembly metadata to connect modules TOGETHER at runtime. When VES loads an assembly, it matches the assembly to one or more code groups. Each code group is assigned to one or more permissions that specify what actions assemblies can do in that code group. Code Group : The evidence provided by an assembly is used as the condition for granting and revoking permissions to it. It is done by putting the code in an appropriate code group. Every code group stipulates a membership condition and has specific conditions attached to it. Any assemblies that meet the condition become a member of the group. Code groups are arranged in a hierarchy and assemblies are nearly always matched to several code groups. The code group at the root of the hierarchy is called All Code and contains all other code groups. Evidence : In order for the CLR to determine which code group to place assembly information into, the first step is to read supplied evidence. There are two main sources of information, they are internet and intranet. The group internet defines code that is sources from the internet and the group intranet defines code sources from a LAN. The examination of the assembly evidence makes the authentication part of the security process. Permissions : Permissions are the actions you allow each code group to perform. The system administrator usually manages the permissions at the enterprise, machine and user levels. The CLR Virtual Execution System (VES) loads and runs programs. It provides the functionality required to execute managed code and uses assembly metadata to connect modules together at runtime. When VES loads an assembly, it matches the assembly to one or more code groups. Each code group is assigned to one or more permissions that specify what actions assemblies can do in that code group. |
|
| 3. |
What Are The Elements Of Code Access Security? |
|
Answer» ELEMENTS of Code Access Security : EVERY security system needs some sort of mechanism (such as user name, password and Access Control List (ACL)) to identify the users and DETERMINE what a user can or can't do. However CAS identifies and assigns permissions to application rather than to application users. CAS identifies assemblies using evidence, there are a few elements by which an assembly can be identified, such as location, hash code and signature of the assembly. Evidence is the information that the RUNTIME gathers about an assembly to determine which code group the assembly BELONGS to. Code groups in turn grant an assembly a permission set. Elements of Code Access Security : Every security system needs some sort of mechanism (such as user name, password and Access Control List (ACL)) to identify the users and determine what a user can or can't do. However CAS identifies and assigns permissions to application rather than to application users. CAS identifies assemblies using evidence, there are a few elements by which an assembly can be identified, such as location, hash code and signature of the assembly. Evidence is the information that the runtime gathers about an assembly to determine which code group the assembly belongs to. Code groups in turn grant an assembly a permission set. |
|
| 4. |
Define Principal Object? |
Answer»
|
|
| 5. |
What Are The Types Of Code Security? |
|
Answer» There are two types of code SECURITY:
There are two types of code security: |
|
| 6. |
What Are The Differences Between Declarative And Imperative Security.? |
|
Answer» Declarative and imperative are the DIFFERENT syntax schemes used to implement security declarations in .NET Framework. In declarative security, ATTRIBUTE syntax is used. The security constraints are stored in the assembly at compile time. The disadvantage of declarative security is that there are tools which extract security requirements from the metadata in the assembly. In imperative implementation, the attribute syntax is not used. It is implemented by writing the REGULAR code to provide restrictions Declarative and imperative are the different syntax schemes used to implement security declarations in .NET Framework. In declarative security, attribute syntax is used. The security constraints are stored in the assembly at compile time. The disadvantage of declarative security is that there are tools which extract security requirements from the metadata in the assembly. In imperative implementation, the attribute syntax is not used. It is implemented by writing the regular code to provide restrictions |
|
| 7. |
Define Declarative And Imperative Security. |
|
Answer» Security checks can be applied imperatively or declaratively. Declarative security is applied by associating ATTRIBUTE declarations that specify a security action with classes or METHODS. IMPERATIVE security is applied by calling the appropriate methods of a Permission object that represents the Principal (for role-based security) or system resource (for code access security). Security checks can be applied imperatively or declaratively. Declarative security is applied by associating attribute declarations that specify a security action with classes or methods. Imperative security is applied by calling the appropriate methods of a Permission object that represents the Principal (for role-based security) or system resource (for code access security). |
|
| 8. |
Explain Role-based And Code Based Security? |
Answer»
|
|
| 9. |
What Is Code Group? |
| Answer» | |
| 10. |
What Is Evidence In Cas? |
|
Answer» When you want to execute any code in your environment you would first like to know from where the code came from. Depending from where it came from, you would then would like to give him access rights. For instance a code compiled from your own computer would have GREATER rights than code DOWNLOADED from the internet. In ORDER to know the same we need to probe the assembly / EXE / dll and get evidences like who is the PUBLISHER of the code , from which site has this code from , from which zone has it come from ( internet , intranet etc) etc. When you want to execute any code in your environment you would first like to know from where the code came from. Depending from where it came from, you would then would like to give him access rights. For instance a code compiled from your own computer would have greater rights than code downloaded from the internet. In order to know the same we need to probe the assembly / exe / dll and get evidences like who is the publisher of the code , from which site has this code from , from which zone has it come from ( internet , intranet etc) etc. |
|
| 11. |
What Is Cas? |
|
Answer» Code Access SECURITY is a security MODEL which grants or DENIES permission to your assembly depending on evidences like from where the code has EMERGED, who the publisher is? , STRONG names etc. Code Access security is a security model which grants or denies permission to your assembly depending on evidences like from where the code has emerged, who the publisher is? , strong names etc. |
|
| 12. |
What Is A Permission And Permission Set? |
|
Answer» Once you have gathered the evidences about the CODE you would LIKE to assign permission to the code. There are various PERMISSIONS which you can assign to the code like Can the code create a file, can we write to REGISTRY, can the code execute reflection, can the code OPEN file dialog box etc. These permissions are collect permission sets and those permission sets are allocated to the code. Once you have gathered the evidences about the code you would like to assign permission to the code. There are various permissions which you can assign to the code like Can the code create a file, can we write to registry, can the code execute reflection, can the code open file dialog box etc. These permissions are collect permission sets and those permission sets are allocated to the code. |
|
| 13. |
What Is Caspol.exe? |
|
Answer» It’s the core exe which is responsible to assign permission to the assembly. The .NET CONFIGURATION tool is just a cover which sits on the TOP of caspol.exe to ease our work. CASPOL.exe commands are cryptic so the .NET configuration tool is more user friendly. In case you are INTERESTED in using caspol.exe you can go to visual STUDIO command prompt and type caspol.exe with necessary parameters. It’s the core exe which is responsible to assign permission to the assembly. The .NET configuration tool is just a cover which sits on the top of caspol.exe to ease our work. CASPOL.exe commands are cryptic so the .NET configuration tool is more user friendly. In case you are interested in using caspol.exe you can go to visual studio command prompt and type caspol.exe with necessary parameters. |
|
| 14. |
What Are The Functions Performed By Cas? |
|
Answer» It performs following function:
It performs following function: |
|
| 15. |
Can I Create My Own Permission Set? |
|
Answer» YES. Use caspol -ap, specifying an XML file containing the permissions in the permission set. To save you some time, here is a sample file corresponding to the 'Everything' permission set - just edit to suit your needs. When you have edited the sample, ADD it to the range of available permission sets LIKE this: caspol -ap samplepermset.xml Yes. Use caspol -ap, specifying an XML file containing the permissions in the permission set. To save you some time, here is a sample file corresponding to the 'Everything' permission set - just edit to suit your needs. When you have edited the sample, add it to the range of available permission sets like this: caspol -ap samplepermset.xml |
|
| 16. |
How Do I Change The Permission Set For A Code Group? |
|
Answer» USE caspol. If you are the machine administrator, you can operate at the 'machine' level - which means not only that the changes you make become the default for the machine, but also that users cannot change the permissions to be more permissive. If you are a NORMAL (non-admin) user you can still modify the permissions, but only to make them more restrictive. For example, to allow intranet CODE to do what it likes you MIGHT do this: caspol -CG 1.2 FullTrust Note that because this is more permissive than the default policy (on a standard system), you should only do this at the machine level - doing it at the user level will have no effect. Use caspol. If you are the machine administrator, you can operate at the 'machine' level - which means not only that the changes you make become the default for the machine, but also that users cannot change the permissions to be more permissive. If you are a normal (non-admin) user you can still modify the permissions, but only to make them more restrictive. For example, to allow intranet code to do what it likes you might do this: caspol -cg 1.2 FullTrust Note that because this is more permissive than the default policy (on a standard system), you should only do this at the machine level - doing it at the user level will have no effect. |
|
| 17. |
How Do I Define My Own Code Group? |
|
Answer» Use caspol. For example, suppose you trust code from www.mydomain.com and you want it have full ACCESS to your SYSTEM, but you want to KEEP the default restrictions for all other internet sites. To achieve this, you would add a new code group as a sub-group of the 'Zone - Internet' group, like this: caspol -AG 1.3 -site www.mydomain.com FullTrust 1.3. Zone - Internet: Internet ... Use caspol. For example, suppose you trust code from www.mydomain.com and you want it have full access to your system, but you want to keep the default restrictions for all other internet sites. To achieve this, you would add a new code group as a sub-group of the 'Zone - Internet' group, like this: caspol -ag 1.3 -site www.mydomain.com FullTrust 1.3. Zone - Internet: Internet ... |
|
| 18. |
Who Defines The Cas Code Groups? |
|
Answer» MICROSOFT defines some default ones, but you can modify these and even CREATE your own. To see the code groups defined on your SYSTEM, run 'caspol -lg' from the command-line. On my system it looks like this: 1. All code: Nothing 0024000004800000940000000602000000240000525341310004000003 Note the hierarchy of code groups - the top of the hierarchy is the most general ('All code'), which is then sub-divided into several groups, each of which in turn can be sub-divided. Also note that (somewhat counter-intuitively) a sub-group can be associated with a more permissive permission set than its parent. Microsoft defines some default ones, but you can modify these and even create your own. To see the code groups defined on your system, run 'caspol -lg' from the command-line. On my system it looks like this: 1. All code: Nothing 0024000004800000940000000602000000240000525341310004000003 Note the hierarchy of code groups - the top of the hierarchy is the most general ('All code'), which is then sub-divided into several groups, each of which in turn can be sub-divided. Also note that (somewhat counter-intuitively) a sub-group can be associated with a more permissive permission set than its parent. |
|
| 19. |
How Does Cas Work? |
|
Answer» The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a PARTICULAR code group, and each code group is granted the permissions specified in a named PERMISSION set. For example, using the default security policy, a control DOWNLOADED from a web SITE belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.) The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set. For example, using the default security policy, a control downloaded from a web site belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.) |
|