The present application claims priority to European Patent Application No. 11180574.3, filed on Sep. 8, 2011, and all the benefits accruing therefrom under 35 U.S.C. §119, the contents of which in its entirety are herein incorporated by reference.
This present invention relates generally to the field of security permissions for applications, and more specifically, to generating security permissions for applications in an enterprise environment.
Java 2 Security is a fine-grained, policy-based access control mechanism that is intended to increase overall system integrity by guarding access to protected system resources. (Java and ail Java-based trademarks and logo are trademarks or registered trademarks of Oracle and/or its affiliates.)
A typical scenario that occurs when Java 2 Security is enabled is that applications will stop working due to security access exceptions. The system administrator has to set up a coherent security policy, and this requires experience and security expertise on the part of the system administrator. An alternative option is to allow users to handle the policy management, which may result in mistakes being made due to their lack of expertise in defining security policies.
In many cases, in order to get applications working quickly, applications are given the permission “AllPermission” which is all encompassing and essentially negates the value that Java 2 Security is intended to provide.
Once the application is working, the tendency is not to go back to define proper security settings. System users may have a misplaced sense of security and assume that they have security protection as they know that Java 2 Security is enabled on the server.
Users that attempt to define the correct policy for their files may encounter difficulties. Often it is recommended that the application code be executed and that each time a security exception is hit, the security exception is analysed. Examples of options that may be taken when a security exception is encountered include: put the code in a “doPrivileged” block if the code is trusted (a drawback to this option is that this will open security holes); add the exception to the security policy file; and recode the application if the application should not actually be using that code.
The decision of which option to take requires a good understanding of security and of the application code. Once users have decided which option to take, they rerun the application again and potentially hit the next security exception and repeat the process until the application runs cleanly. Even once the application has run cleanly there is no guarantee that all the code paths which might generate a security exception will have been exercised, so it may just be a matter of time before the user hits the next one.
Adding to the difficulty of defining a security policy is that enterprise applications are often made up of multiple components. In the case of Java Enterprise Edition (EE) Enterprise Archive (EAR) files, the components might include, for example, Java Archive (JAR) files or Web application Archive (WAR) files contained in a hierarchy. Similarly, for OSGi Enterprise Bundle Archive (EBA) enterprise applications, the components might consist of different bundles in a hierarchy. (OSGi is a trademark or a registered trademark of the OSGi Alliance in the United States, other countries, or both.) Java 2 Security can be defined hierarchically to allow policies to be fine-tuned to the separate components. To add to the complication, the way these are defined for the different enterprise applications is different as well. In addition, the format of these policies is extremely sensitive to incorrect formatting, and they are of slightly different formats for each type of enterprise application.
Embodiments include a method, system, and computer program product for generating security permissions for applications. A static analysis on an application is carried out to determine security exceptions and to determine the application components responsible for the security exceptions. The determined security exceptions are analysed to calculate permissions required for each component. A security policy file that includes a hierarchy of the required permissions suitable for the type of application is formatted and applied to the application to provide a security enabled application.
The subject matter regarded as the invention is particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings in which:
It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numbers may be repeated among the figures to indicate corresponding or analogous features.
In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be understood by those skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the present invention.
A method and system are described in which a tool is provided which a user may run once, which calculates the possible security exceptions in an application and the components they correspond to. The user may then confirm if all of these exceptions are valid, so that the tool proceeds and produces required security policy files in the correct format. Furthermore, the required security policy files are calculated correctly to match the application hierarchy, which enables their application for Java 2 Security.
The described method and system takes an application and, through static analysis of the application components, produces the set of required Java 2 Security permissions that the application requires in order to run.
There are two stages to the described process.
First, a permission analysing stage takes an existing application which may be in an enterprise environment (for example, an OSGi or Java EE), and performs a static analysis of the code to calculate what security access exceptions might be generated by the code, and which components of the application would be generating those security access exceptions. Analysis of the results then calculates what permissions should be allocated to each component.
Second, a permission formatting stage takes as input the original application and the output from the permission analysis to produce a final application with the correct Java 2 Security permission or policy files. This stage determines the type of application and from there it determines the correct structure of the file(s) and determines the correct way to represent the hierarchy of permissions. In JEE this may be one high-level file, with corresponding entries for the component codebases. For OSGi, it may be one high-level application level permission file, as well as component level permission files packaged up inside the bundles themselves.
The use of static analysis techniques generates secured applications, with only minimal validation required by a system administrator before deployment, whereby the permission structure also correctly reflects the code hierarchy of the application components.
Referring to
The security permission tool 110 shown in
The permission analyser component 120 shown in
The permission formatting component 130 shown in
The permission formatting component 130 shown in
In the embodiment shown in
As shown in
As shown in the embodiment in
There are known tools that can detect potential areas of code that would generate a security exception. For example, FindBugs (FindBugs is a trade mark of University of Maryland) is an open source example of a tool which may be run as part of a build process to statically analyse code. The standard use of this is to warn developers of areas which might potentially need to be encapsulated in a doPriviledged block. Embodiments described herein make use of such existing static analysis methods to calculate all the possible security exceptions that the application code could generate, and therefore the corresponding maximal set of permissions needed.
As well as storing the permissions, the system may also keep a mapping of which component required the permissions.
By performing set calculations, it is possible to determine which permissions can be extracted out to a higher level, and which would only be needed by particular components. In this way, the permission structure generated will still be kept as closely tied to the component hierarchy as possible. The benefit of this is that it avoids the situation where permissions are granted at the application level unnecessarily making the system less secure when only a small component of the application needs to be granted that permission.
Referring to
In the embodiment in
The system 200 may also include a primary storage means 211 such as a magnetic hard disk drive and secondary storage means 212 such as a magnetic disc drive and an optical disc drive. The drives and their associated computer-readable media provide non-volatile storage of computer-executable instructions, data structures, program modules and other data for the system 200. Software applications may be stored on the primary and secondary storage means 211, 212 as well as the system memory 202.
The computing system 200 may operate in a networked environment using logical connections to one or more remote computers via a network adapter 216.
Input/output devices 213 can be coupled to the system either directly or through intervening I/O controllers. A user may enter commands and information into the system 200 through input devices such as a keyboard, pointing device, or other input devices (for example, microphone, joy stick, game pad, satellite dish, scanner, or the like). Output devices may include speakers, printers, etc. A display device 214 is also connected to system bus 203 via an interface, such as video adapter 215.
Referring to
An application is input at block 301 into the system. A static analysis is carried out at block 302 on the application to analyze code for potential security exceptions. The code fragments are listed at block 303 with their associated security exceptions. For each code fragment in the listing, the code fragment is analyzed at block 304 to ascertain the required parameters for the security policy and to calculate permissions required. For example, for a code fragment that writes to disk that requires a FilePermission, it is ascertained that it is a “write” call and the associated file is written to from the method signature.
Security policy files are formatted and a hierarchical tree is generated at block 305 based on the code's class structure (inheritance, etc.) with each node being the associated security policy for that particular component/class.
The security policies are aggregated by determining, at block 306, if for any node, all its descendants have a given specific security policy. If so, at block 307, this policy is removed from each descendant and added it to the node's security policy.
The generated security policies are compared at block 308 to the given policy constraints provided to the generating application. If none match, then it is assumed appropriate and correct security policy definitions have been generated and processing continues at block 310. If a match is found, then a user is alerted at block 309 and the violating security policy is removed from the generated security policy definition.
At block 311, based on the security policy definitions generated, the appropriate security policy files are generated and the security policy files are then applied in the format of the determined hierarchy for the application and a security enabled application is generated 311.
Using the above method, when generating the security policy for a given piece of code, the policy generation application described has the ability to be able to specify constraints. A default set of policy constraints may be specified for the policy generation such that if a generated policy violates any of these constraints, it would flag the user, otherwise it would assume that all is correct.
For example, a constraint may be that no application can write to the root directory of a file system. By specifying this constraint, if a policy is targeted to be generated that allows write permission to a root directory then this would be flagged to the user and not included in any generated security policy file.
Referring to
An application 400 includes a first component A 401 and a second component B 402. A permission analyser component 420 analyses the application 400. It is determined that two permissions 441, 442 are required by the first component A 401 and three permissions 451, 452, 453 are required by the second component B 402. It is noted that permission 441 and permission 451 are the same permission that is needed by both component A 401 and component B 402. This permission 441, 451 is pulled up to the application level of a permission hierarchy 460. The rest of the permissions are kept linked to the particular components they have been generated from.
In
A first application 400A is shown as an example OSGi enterprise application. Three permission policy files 471, 472, 473 are generated for the OSGi enterprise application for each of the first application 400A, component A 401A and component B 402A.
A second application 400B is shown in the form of an example Java enterprise application with component A 401B and component B 402B. For this form of application a single permission policy file 480 may be generated with the component hierarchy specified within that file.
In this form of second application 400B, the component hierarchy may be specified as:
The described method and system address the problem of an incorrectly configured or a non-existent security policy for executing an application. Embodiments of the invention involve static analysis of an application to determine security exposures and to formulate an appropriate security policy for proposal to a system user/administrator. In this way, secure applications can be prepared for execution without undue burden on system administrators who may know nothing of either or both of enterprise security or the particular application.
A system for generating security permission for an application may be provided as a service to a customer over a network.
The invention can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment containing both hardware and software elements. In a preferred embodiment, the invention is implemented in software, which includes but is not limited to firmware, resident software, microcode, etc.
The invention can take the form of a computer program product accessible from a computer-usable or computer-readable medium providing program code for use by or in connection with a computer or any instruction execution system. For the purposes of this description, a computer usable or computer readable medium can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus or device.
The medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read only memory (ROM), a rigid magnetic disk and an optical disk. Current examples of optical disks include compact disk read only memory (CD-ROM), compact disk read/write (CD-R/W), and DVD.
Improvements and modifications can be made to the foregoing without departing from the scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
11180574.3 | Sep 2011 | EP | regional |