Skip to contentSkip to conversation

libsepol/cil: Allow dotted names in aliasactual rules

PATCH In review James Carter 2 participants 4 messages Aug 12, 2024 – Sep 5, 2024 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol/cil: Allow dotted names in aliasactual rules

The function cil_gen_alias() is used to declare type, sensitivity, and category aliases and the function cil_gen_aliasactual() is used to assign an alias to the actual declared name.

Commit e55621c03 ("libsepol/cil: Add notself and other support to CIL") added "notself" and "other" as reserved words. Previously, a check was made in cil_gen_aliasactual() to ensure that the "self" reserved word was not used. With the notself patch this function was upgraded to call cil_verify_name() to verify that the other reserved words were not used as well. This change prevents the use of dotted names to refer to alias or actual names that are declared in blocks.

The check for a reserved word being used is not needed because that check will be done for both the alias and the actual name when they are declared.

Remove the call to cil_verify_name() and allow dotted names in aliasactual rules.

---
 libsepol/cil/src/cil_build_ast.c | 10 ----------
 1 file changed, 10 deletions(-)
libsepol/cil/src/cil_build_ast.c +0 -10
index 56dac891..6884f12c 100644
@@ -3174,16 +3174,6 @@ int cil_gen_aliasactual(struct cil_db *db, struct cil_tree_node *parse_current,
 		goto exit;
 	}
 
-	rc = cil_verify_name(db, parse_current->next->data, flavor);
-	if (rc != SEPOL_OK) {
-		goto exit;
-	}
-
-	rc = cil_verify_name(db, parse_current->next->next->data, flavor);
-	if (rc != SEPOL_OK) {
-		goto exit;
-	}
-
 	cil_aliasactual_init(&aliasactual);
 
 	aliasactual->alias_str = parse_current->next->data;
Signature · 1 line
2.46.0
#1 lore raw
Quoted 16 lines · James Carter

The function cil_gen_alias() is used to declare type, sensitivity, and category aliases and the function cil_gen_aliasactual() is used to assign an alias to the actual declared name.

Commit e55621c03 ("libsepol/cil: Add notself and other support to CIL") added "notself" and "other" as reserved words. Previously, a check was made in cil_gen_aliasactual() to ensure that the "self" reserved word was not used. With the notself patch this function was upgraded to call cil_verify_name() to verify that the other reserved words were not used as well. This change prevents the use of dotted names to refer to alias or actual names that are declared in blocks.

The check for a reserved word being used is not needed because that check will be done for both the alias and the actual name when they are declared.

Quoted 5 lines

Remove the call to cil_verify_name() and allow dotted names in aliasactual rules.

Thank you.

Quoted 25 lines
---
 libsepol/cil/src/cil_build_ast.c | 10 ----------
 1 file changed, 10 deletions(-)
libsepol/cil/src/cil_build_ast.c +0 -10
index 56dac891..6884f12c 100644
@@ -3174,16 +3174,6 @@ int cil_gen_aliasactual(struct cil_db *db, struct cil_tree_node *parse_current,
 		goto exit;
 	}
 
-	rc = cil_verify_name(db, parse_current->next->data, flavor);
-	if (rc != SEPOL_OK) {
-		goto exit;
-	}
-
-	rc = cil_verify_name(db, parse_current->next->next->data, flavor);
-	if (rc != SEPOL_OK) {
-		goto exit;
-	}
-
 	cil_aliasactual_init(&aliasactual);
 
 	aliasactual->alias_str = parse_current->next->data;
Signature · 4 lines
gpg --locate-keys [email protected] (wkd)
Key fingerprint = FCD2 3660 5D6B 9D27 7FC6  E0FF DA7E 521F 10F6 4098
Dominick Grift
Mastodon: @[email protected]
#2 lore raw
In reply to James Carter
Quoted 17 lines · James Carter

The function cil_gen_alias() is used to declare type, sensitivity, and category aliases and the function cil_gen_aliasactual() is used to assign an alias to the actual declared name.

Commit e55621c03 ("libsepol/cil: Add notself and other support to CIL") added "notself" and "other" as reserved words. Previously, a check was made in cil_gen_aliasactual() to ensure that the "self" reserved word was not used. With the notself patch this function was upgraded to call cil_verify_name() to verify that the other reserved words were not used as well. This change prevents the use of dotted names to refer to alias or actual names that are declared in blocks.

The check for a reserved word being used is not needed because that check will be done for both the alias and the actual name when they are declared.

Quoted 5 lines

Remove the call to cil_verify_name() and allow dotted names in aliasactual rules.

I plan on merging this soon.
Jim

Quoted 28 lines
---
 libsepol/cil/src/cil_build_ast.c | 10 ----------
 1 file changed, 10 deletions(-)
libsepol/cil/src/cil_build_ast.c +0 -11
index 56dac891..6884f12c 100644
@@ -3174,16 +3174,6 @@ int cil_gen_aliasactual(struct cil_db *db, struct cil_tree_node *parse_current,
                goto exit;
        }
 
-       rc = cil_verify_name(db, parse_current->next->data, flavor);
-       if (rc != SEPOL_OK) {
-               goto exit;
-       }
-
-       rc = cil_verify_name(db, parse_current->next->next->data, flavor);
-       if (rc != SEPOL_OK) {
-               goto exit;
-       }
-
        cil_aliasactual_init(&aliasactual);
 
        aliasactual->alias_str = parse_current->next->data;
--

2.46.0

#3 lore raw
Quoted 19 lines · James Carter
Quoted 17 lines · James Carter

The function cil_gen_alias() is used to declare type, sensitivity, and category aliases and the function cil_gen_aliasactual() is used to assign an alias to the actual declared name.

Commit e55621c03 ("libsepol/cil: Add notself and other support to CIL") added "notself" and "other" as reserved words. Previously, a check was made in cil_gen_aliasactual() to ensure that the "self" reserved word was not used. With the notself patch this function was upgraded to call cil_verify_name() to verify that the other reserved words were not used as well. This change prevents the use of dotted names to refer to alias or actual names that are declared in blocks.

The check for a reserved word being used is not needed because that check will be done for both the alias and the actual name when they are declared.

Quoted 9 lines
Quoted 5 lines

Remove the call to cil_verify_name() and allow dotted names in aliasactual rules.

I plan on merging this soon.
Jim

This patch has been merged.
Jim

Quoted 28 lines
Quoted 28 lines
---
 libsepol/cil/src/cil_build_ast.c | 10 ----------
 1 file changed, 10 deletions(-)
libsepol/cil/src/cil_build_ast.c +0 -11
index 56dac891..6884f12c 100644
@@ -3174,16 +3174,6 @@ int cil_gen_aliasactual(struct cil_db *db, struct cil_tree_node *parse_current,
                goto exit;
        }
 
-       rc = cil_verify_name(db, parse_current->next->data, flavor);
-       if (rc != SEPOL_OK) {
-               goto exit;
-       }
-
-       rc = cil_verify_name(db, parse_current->next->next->data, flavor);
-       if (rc != SEPOL_OK) {
-               goto exit;
-       }
-
        cil_aliasactual_init(&aliasactual);
 
        aliasactual->alias_str = parse_current->next->data;
--

2.46.0