在基于属性的访问控制(ABAC)中,如何根据主体和对象之间的关系对属性进行建模?

时间:2018-01-05 16:29:49

标签: access-control abac

在基于属性的访问控制(ABAC)中,建议的方法是建立来自主体和对象之间关系的属性

示例:医疗记录作为对象和医生/护士的帐户作为主题。在一个简单的设置中,主体和对象之间没有直接关系,规则可能会在心脏病学部 中声明“护士从业者 心脏病患者的医疗记录 (来自NIST Whitepaper的例子)。现在想象一下,在医疗记录数据库中,每条记录都明确地将某医生的帐户称为其主治医师。规则应规定只允许记录的主治医生更改该记录的某些关键属性。

我们如何在属性中对此进行最佳建模?

理想情况下,授权主体可以携带“功能=主治医师”属性。这样可以很容易地在技术上表达规则,但它也会使特定于对象的主题构建错误。

或者,该对象可以携带属性“Attending Physician =(Account-ID)”,这听起来更好,但是规则的技术表达将更复杂:“如果主题的Account ID属性值匹配,则授予访问权限对象的参加医师属性值“。 (在现实生活中,这种关系可能会更复杂和嵌套,而且规则更难用简单的术语表达。)

任何建议或最佳做法?

谢谢,约翰

1 个答案:

答案 0 :(得分:1)

是。在ABAC(和ALFA / XACML)中,您可以按照以下方式编写策略:

  • 物理学家可以查看病历。

这是没有关系的基线。如果你想引入一种关系,例如护理关系,将患者对象引入混合物中。该记录属于患者,患者具有指定的医生。该政策现在变为:

  • 医生可以查看与他们有照顾关系的患者的医疗记录。

以消化的格式,它变为:

  • 具有角色=="医生"可以采取行动=="查看"对象=="医疗记录"如果record.owner.assignedPhysician == user.userID。

这是ALFA中的一个完整示例。

namespace com.axiomatics.examples{

    import Attributes.*

    obligation breakTheGlass = "com.axiomatics.examples.breakTheGlass"
    obligation auditLog = "com.axiomatics.examples.auditLog"

    namespace user{
        attribute role{
            category = subjectCat
            id = "com.axiomatics.examples.user.role"
            type = string
        }
        attribute identifier{
            category = subjectCat
            id = "com.axiomatics.examples.user.identifier"
            type = string
        }
        attribute managerEmail{
            category = subjectCat
            id = "com.axiomatics.examples.user.manager.email"
            type = string
        }
    }
    namespace patient{
        attribute assignedDoctor{
            category = resourceCat
            id = "com.axiomatics.examples.user.assignedDoctor"
            type = string
        }
    }
    namespace record{
        attribute identifier{
            category = resourceCat
            id = "com.axiomatics.examples.record.identifier"
            type = string
        }
    }
    attribute actionId{
        category = actionCat
        id = "com.axiomatics.examples.actionId"
        type = string
    }
    attribute objectType{
        category = resourceCat
        id = "com.axiomatics.examples.objectType"
        type = string
    }
    attribute isEmergency{
        category = environmentCat
        id = "com.axiomatics.examples.isEmergency"
        type = boolean
    }
    attribute message{
        category = environmentCat
        id = "com.axiomatics.examples.message"
        type = boolean
    }
    /**
     * Control access to medical records
     */
    policy accessMedicalRecord{
        target clause actionId == "view" and objectType == "medical record"
        apply firstApplicable
        /**
         * Doctors can view medical records of patients they are assigned to
         */
        rule allowRegularAccess{
            target clause user.role == "doctor"
            condition patient.assignedDoctor == user.identifier
            permit
        }
        /**
         * Doctors can view any medical reason in the case of an emergency
         */
        rule allowBreakTheGlassAccess{
            target clause isEmergency == true
            permit
            on permit{
                obligation auditLog{
                    message = "A doctor has gotten access to a medical record by breaking the glass"
                    user.identifier = user.identifier
                    record.identifier = record.identifier
                    currentDateTime = currentDateTime
                }

            }
        }
        /**
         * Deny other accesses. If access is normally denied, tell doctors how
         * they can get access by "breaking the glass".
         */
        rule denyAccess{
            deny
            on deny{
                obligation breakTheGlass{
                    message = "You do not have access to this medical record. To be granted access, set the isEmergency flag to true."
                    record.identifier = record.identifier
                    currentDateTime = currentDateTime
                }
            }
        }
    }
}