Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: not-self neverallow support #374

Closed
wants to merge 2 commits into from

Commits on Jul 5, 2023

  1. libsepol/cil: Add notself and minusself support to CIL

    Like "self", both of these reserved words can be used as a target
    in an access vector rule. "notself" means all types other than
    the source type. "minuself" is meant to be used with an attribute
    and its use results in the rule being expanded with each type of
    the attribute being used as the source type with each of the other
    types being used as the target type. Using "minusself" with just
    a type will result in no rule.
    
    Example 1
      (allow TYPE1 notself (CLASS (PERM)))
    
    This rule is expanded to a number of rules with TYPE1 as the source
    and every type except for TYPE1 as the target.
    
    Example 2
      (allow ATTR1 notself (CLASS (PERM)))
    
    Like Example 1, this rule will be expanded to each type in ATTR1
    being the source with every type except for the type used as the
    source being the target.
    
    Example 3
      (allow TYPE1 minusself (CLASS (PERM)))
    
    This expands to no rule.
    
    Example 4
      (allow ATTR1 minusself (CLASS (PERM)))
    
    Like Example 2, but the target types will be limited to the types
    in the attribute ATTR1 instead of all types. So if ATTR1 has the
    type t1, t2, and t3, then this rule expands to the following rules.
      (allow t1 t2 (CLASS (PERM)))
      (allow t1 t3 (CLASS (PERM)))
      (allow t2 t1 (CLASS (PERM)))
      (allow t2 t3 (CLASS (PERM)))
      (allow t3 t1 (CLASS (PERM)))
      (allow t3 t2 (CLASS (PERM)))
    
    Original patch from James Carter <[email protected]>
    
    Signed-off-by: Christian Göttsche <[email protected]>
    jwcart2 authored and cgzones committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    eeb7085 View commit details
    Browse the repository at this point in the history
  2. libsepol: update CIL generation for trivial not-self rules

    Convert trivial not-self neverallow rules to CIL, e.g.
    
        neverallow TYPE1 ~self:CLASS1 PERM1;
    
    into
    
        (neverallow TYPE1 notself (CLASS1 (PERM1)))
    
    More complex targets are not yet supported in CIL and will fail to
    convert, e.g.:
    
        neverallow TYPE1 ~{ self ATTR1 } : CLASS1 PERM1;
        neverallow TYPE2 { ATTR2 -self } : CLASS2 PERM2;
    
    Signed-off-by: Christian Göttsche <[email protected]>
    cgzones committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    3a9bb4a View commit details
    Browse the repository at this point in the history