Oracle9i XML Database Developer's Guide - Oracle XML DB Release 2 (9.2) Part Number A96620-02 |
|
|
View PDF |
This chapter describes Access Control Lists (ACL) based security mechanism for Oracle XML DB resources. It describes how to create ACLs, set and change ACls on resources, and how ACL security interacts with other database security mechanisms.
This chapter contains the following sections:
Oracle XML DB maintains object-level security for any resource in Oracle XML DB Repository hierarchy.
Oracle XML DB uses an access control list (ACL) mechanism to restrict access to any Oracle XML DB resource or database object mapped to Oracle XML DB Repository.
The Oracle XML DB ACL security mechanism supports the WebDAV ACL specification. ACLs are a standard security mechanism used in Java, Windows NT, and other systems.
Oracle XML DB ACL security mechanism is designed to handle large volumes of XML data stored in Oracle9i database. Privileges can be granted or denied to the principal dav:owner, that represents the owner of the document, regardless of who the owner is.
Before a user performs an operation or method on a resource, a check of privileges for the user on the resource takes place. The set of privileges checked depends on the operation or method performed. For example, to increase employee Scott's salary by 10 percent, READ
and WRITE
privileges are needed for the scott/salary.xml
resource.
A few access control list (ACL) terms are described here:
There is a special principal named dav:owner that corresponds to a separate property on the object being secured. Use of the dav:owner principal allows greater ACL sharing between users, since the owner of the document often has special rights. See Also "Access Control: User and Group Access".
Aggregate privileges are a naming convenience to simplify usability when the number of privileges becomes large, as well as to promote interoperability between ACL clients. A set of privileges controls the ability to perform a given operation or method on an Oracle XML DB resource. For example, if the principal Scott
wants to perform the read
operation on a given resource, the read
privileges must be granted to Scott
prior to the read operation. Therefore, privileges control how users can operate on given resources.
gran
t ACE
and one deny
ACE
for a particular principal in a single ACL.
Note: Many grant ACEs (or deny ACEs) may apply to a particular user since a user may be granted many roles. |
An Oracle XML DB ACE element has the following attributes:
ace
, that defines access control to a resource. An ACE either grants or denies privileges for a principal.
http://xmlns.oracle.com/xdb/XDBDemo.xsd#PurchaseOrder
that specifies that the ACL can only be applied to instances of that XML element and elements in a substitution group with that element.
/sys/acls/bootstrap_acl.xml
, is the only ACL protected by its own contents. All of the default ACLs are protected by the bootstrap ACL, which grants the xdb:readContents
privilege to all users. The bootstrap ACL grants FULL ACCESS to Oracle XML DB ADMIN
and DBA
groups. The XDBADMIN
role is particularly useful for users that must register global XML schemas.
privilege_users_acl.xml
where privilege
represents the privilege granted and user
represents the users that are granted access to the resource.
Oracle XML DB supports the following ACL features:
Users must have the appropriate privilege on the underlying table/view where the XML object is stored, as well as permissions through the ACL for that individual instance.
LDAP is integrated with Oracle XML DB to allow external users access to Oracle XML DB. External users can perform the same operations that a local database user can.
The PL/SQL API for ACL security allows the PL/SQL developer access to the security mechanisms, to check privileges given a particular ACL, and to list the set of privileges the current user has for a particular ACL and object.
Oracle XML DB ACLs are cached for very fast evaluation. When a transaction modifying an ACL is committed, the modified ACL is picked up after the time-out specified in the Oracle XML DB configuration file is up. The XPath for this configuration parameter is /xdbconfig/sysconfig/acl-max-age
.
The principal
can be either an individual user or a group. A group is also referred to as a collection. A user is granted access as a group principal if the user has been granted a database role.
Access privileges for each principal are stored in access control entries (ACEs) in the ACL.
The following example shows entries in an ACL:
<acl description="myacl" xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:dav="DAV:" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd http://xmlns.oracle.com/xdb/acl.xsd"> <ace> <principal>OWNER</principal> <grant>true</grant> <privilege> <all/> </privilege> </ace> </acl>
The preceding ACL grants all privileges to the owner of the document. Access to an Oracle XML DB resource is granted for each principal. Table 18-1 lists the access control entry (ACE) elements. Each ACE element specifies access privileges for a given principal using values set for the following elements.
Oracle XML DB provides a set of privileges to control access to Oracle XML DB resources. Access privileges in an ACE are stored in the privilege element. Privileges can be:
When an ACL is stored in Oracle XML DB, the aggregate privileges retain their identity, that is, they are not decomposed into the corresponding leaf privileges. In WebDAV terms, these are non-abstract aggregate privileges, so they can be used in ACEs.
Atomic Privileges:
> read-properties
> read-contents
> update
> link (applies only to containers)
> unlink (applies only to containers)
> read-acl
> write-acl-ref
> update-acl
> link-to
> unlink-from
> resolve
> dav:lock
> dav:unlock
>
> Aggregate Privileges:
> dav:read (read-properties, read-contents, resolve)
> dav:write (update, link, unlink, unlink-from)
> dav:read-acl (read-acl)
> dav:write-acl (write-acl-ref, update-acl)
> dav:all (dav:read, dav:write, dav:read-acl, dav:write-acl, dav:lock, dav:unlock)
Table 18-2 lists the atomic privileges supported by Oracle XML DB.
Since you can directly access the XMLType
storage for ACLs, the XML structure is part of the client interface. Hence ACLs can be manipulated using XMLType
APIs.
Table 18-3 lists the aggregate privileges defined by Oracle XML DB, along with the atomic privileges of which they are composed.
Table 18-4 shows the privileges required for some common operations on resources in Oracle XML DB Repository. The Privileges Required column assumes that you already have resolve
privilege on container C and all its parent containers, up to the root of the hierarchy.
To evaluate an ACL, the database collects the list of ACEs applying to the user logged into the current database session. The list of currently active roles for the given user is maintained as a part of the session and is used to match ACEs with the current users. To resolve conflicts between ACEs, the following rule is used: if a privilege is denied by any ACE, the privilege is denied for the entire ACL.
Entries in an ACL must observe the following rule:
Every resource in the Oracle XML DB Repository hierarchy has an associated ACL. The ACL mechanism specifies a privilege-based access control for resources to principals. Whenever a resource is accessed, a security check is performed. The ACL determines which principals have which set of privileges to access the resource. An Oracle XML DB principal can be either of the following:
Each ACL has a list of ACEs. An ACE has the following elements:
Named ACLs also have a name attribute and an optional type restrictor, for example, http://xmlns.oracle.com/xdb/XDBDemo.xsd#PurchaseOrder,
that specifies that the ACL may only be applied to instances of that XML element (and elements in a substitution group with that element). Note that a privilege that is neither granted nor denied to a user is assumed to be denied.
To evaluate an ACL, the database collects the list of ACEs applying to the user logged into the current database session. The list of currently active roles for the given user is maintained as a part of the session and is used to match ACEs along with the current user.
To check if a user has a certain privilege, you need to know the ID of the ACL and the owner of the object being secured. The Oracle XML DB hierarchy automatically associates an ACL ID and owner with an object that is mapped into its file system (they are stored in a table in the Oracle XML DB schema).
This example creates two users, Oracle XML DB administrator, xdbadmin
, and Oracle XML DB user, xdbuser
. The administrator creates the user's folder under '/'. The default ACL on this folder, inherited from the parent container, allows:
The owner of the folder is changed to the user, by updating the resource_view
. You can also make the user's folder completely private by changing the ACL to another system ACL, such as, all_owner_acl.xml
connect system/manager Rem Create an Oracle XML DB administrator user (has XDBADMIN role) grant connect, resource, xdbadmin to xdbadmn identified by xdbadmn; Rem Create Oracle XML DB user grant connect, resource to xdbuser identified by xdbuser; conn xdbadmn/xdbadmn Rem create the user's folder declare retval boolean; begin retval := dbms_xdb.createfolder('/xdbuser'); end; / Rem update the OWNER of the user folder update resource_view set res = updatexml(res, '/Resource/Owner/text()', 'XDBUSER') where any_path = '/xdbuser'; commit; connect xdbuser/xdbuser Rem XDBUSER has full permissions to operate on her folder declare retval boolean; begin retval := dbms_xdb.createfolder('/xdbuser/workdir'); end; / Rem All users can read /xdbuser folder at this time. Rem change ACL to make folder completely private call dbms_xdb.setacl('/xdbuser', '/sys/acls/all_owner_acl.xml');
The following subsections describe ACL and resource management in Oracle XML DB Repository.
Any Oracle XML DB resource has an ACL as a resource property. To set the ACL resource property, use any of the following methods:
DBMS_XDB
.setacl(res_path VARCHAR2,acl_path VARCHAR2)
to set the ACL property of the resource represented by res_path to the ACL represented by acl_path.quote sacl <res_path> <acl_path>
" to set the ACL resource property of res_path
to the ACLOID
for acl_pathWhen a resource is inserted into the Oracle XML DB hierarchy, and the resource does not specify an ACL, it shares the ACL of its parent container.
The following DBMS_XDB
API can be used to get the ACL for a given resource:
DBMS_XDB.getAclDocument(res_path IN VARCHAR2)
It returns an XMLType
instance of <acl
> element representing the ACL for the resource at res_path.
The following DBMS_XDB
API can be used to add an ACE to a resource's ACL:
DBMS_XDB.changePrivileges(res_path IN VARCHAR2, ace IN XMLType)
All named ACLs are XML schema-based resources in the Oracle XML DB Repository hierarchy. Every method used for other resources in Oracle XML DB Repository hierarchy can also be used for ACLs. For example, FTP commands, PL/SQL DOM, and XMLType
methods can operate on ACLs. However, because ACLs are part of the access control security scheme and Oracle XML DB Repository hierarchy, the following restrictions are enforced:
You can enforce Oracle XML DB access control using the following DBMS_XDB
functions:
CheckPrivileges
, getAclDocument
, and getPrivileges
for Oracle XML DB resources.AclCheckPrivileges
for database objects. This function loads the ACL from the cache, and performs the access request evaluation as described in the next section.ACL security in Oracle XML DB acts in conjunction with database security for XML objects. The user must have the appropriate rights on the underlying table/view where the XML object is stored as well as permissions in the ACL for that individual instance. When an object from a particular table is first stored in the Oracle XML DB hierarchy (and mapped to a resource), a row-level security (RLS) policy is added to that table that checks ACL-based permission only for those rows in the table that are mapped to a resource. RLS is enforced for XMLType
tables or views that are part of the Oracle XML DB hierarchy.