Skip to contentSkip to conversation

copy/paste policy patch

PATCH Xavier Toth 3 participants 10 messages Apr 25, 2008 – May 28, 2008 1 message not in the archive SELinux security module

lore
Share & tools
lore
#0 lore raw

Here's a patch I'm using with an MLS version of glipper to give the capability to check for dominance between copy and paste data contexts. Hopefully some version of this can be upstreamed.

--- serefpolicy-3.3.1/policy/flask/access_vectors 2008-04-08
13:41:18.000000000 -0500
+++ serefpolicy-3.3.1.new//policy/flask/access_vectors 2008-04-08 13:35:43.000000000 -0500
@@ -765,3 +765,10 @@
{
recv
}
+
+class x_application_data
+{

+        paste
+        paste_without_confirm
+        copy

+}
--- serefpolicy-3.3.1/policy/flask/security_classes 2008-04-08
13:41:18.000000000 -0500
+++ serefpolicy-3.3.1.new//policy/flask/security_classes 2008-04-08
13:34:36.000000000 -0500
@@ -114,5 +114,6 @@
class x_resource # userspace
class x_event # userspace
class x_synthetic_event # userspace
+class x_application_data # userspace

# FLASK

policy/mls 2008-04-08 14:20:49.000000000 -0500 renamed from policy/mls 2008-04-08 13:41:18.000000000 -0500 +6 -0
@@ -567,6 +567,12 @@
         ( t1 == mlsxwinwritexinput ) or
         ( t1 == mlsxwinwrite ));
 
+#
+# MLS policy for the x_application_data class
+#
+mlsconstrain x_application_data { paste_without_confirm }
+       ( l1 domby l2 );
+
 
 #
 # MLS policy for the pax class
#1 lore raw
Quoted 3 lines · Xavier Toth

Here's a patch I'm using with an MLS version of glipper to give the capability to check for dominance between copy and paste data contexts. Hopefully some version of this can be upstreamed.

Is the code on its way to being upstreamed?

Quoted 38 lines
/policy/flask/access_vectors 2008-04-08 13:35:43.000000000 -0500 renamed from policy/flask/access_vectors 2008-04-08 13:41:18.000000000 -0500 +7 -0
@@ -765,3 +765,10 @@
 {
        recv
 }
+
+class x_application_data 
+{
+        paste
+        paste_without_confirm
+        copy
+}
/policy/flask/security_classes 2008-04-08 13:34:36.000000000 -0500 renamed from policy/flask/security_classes 2008-04-08 13:41:18.000000000 -0500 +1 -0
@@ -114,5 +114,6 @@
 class x_resource               # userspace
 class x_event                  # userspace
 class x_synthetic_event                # userspace
+class x_application_data        # userspace
 
 # FLASK
policy/mls 2008-04-08 14:20:49.000000000 -0500 renamed from policy/mls 2008-04-08 13:41:18.000000000 -0500 +6 -0
@@ -567,6 +567,12 @@
         ( t1 == mlsxwinwritexinput ) or
         ( t1 == mlsxwinwrite ));
 
+#
+# MLS policy for the x_application_data class
+#
+mlsconstrain x_application_data { paste_without_confirm }
+       ( l1 domby l2 );
+
 
 #
 # MLS policy for the pax class
Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 6 lines · Christopher J. PeBenito
Quoted 4 lines · Xavier Toth

Here's a patch I'm using with an MLS version of glipper to give the capability to check for dominance between copy and paste data contexts. Hopefully some version of this can be upstreamed.

Here is a revised patch. I support including this in refpolicy as it's generally useful for supporting selection managers.

Note that the access_vectors definition is at the end of the file in this patch. Not sure if the ordering matters in that file, if it doesn't you can move this to coincide with the other X classes.

---

flask/security_classes +0 -0
Index: policy/flask/security_classes
===================================================================
@@ -114,5 +114,6 @@

class x_resource # userspace
class x_event # userspace
class x_synthetic_event # userspace
+class x_application_data # userspace

# FLASK

flask/access_vectors +0 -0
Index: policy/flask/access_vectors
===================================================================
@@ -775,3 +775,10 @@

{
recv
}
+
+class x_application_data
+{
+ paste
+ paste_after_confirm
+ copy
+}

mls +0 -0
Index: policy/mls
===================================================================
@@ -568,7 +568,13 @@
	 ( t1 == mlsxwinwrite ));

+#
+# MLS policy for the x_application_data class
+#
+mlsconstrain x_application_data { paste }
+ ( l1 domby l2 );

+
#
# MLS policy for the pax class
#

Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 70 lines · Eamon Walsh
Quoted 9 lines · Christopher J. PeBenito
Quoted 5 lines · Xavier Toth

Here's a patch I'm using with an MLS version of glipper to give the capability to check for dominance between copy and paste data contexts. Hopefully some version of this can be upstreamed.

Here is a revised patch. I support including this in refpolicy as it's generally useful for supporting selection managers.

Note that the access_vectors definition is at the end of the file in this patch. Not sure if the ordering matters in that file, if it doesn't you can move this to coincide with the other X classes.

---

Index: policy/flask/security_classes
===================================================================

flask/security_classes (working copy) renamed from flask/security_classes (revision 2667) +0 -0
@@ -114,5 +114,6 @@
class x_resource                # userspace
class x_event                   # userspace
class x_synthetic_event         # userspace
+class x_application_data       # userspace

# FLASK
Index: policy/flask/access_vectors
===================================================================

flask/access_vectors (working copy) renamed from flask/access_vectors (revision 2667) +7 -0
@@ -775,3 +775,10 @@
 {
       recv
 }
+
+class x_application_data
+{
+       paste
+       paste_after_confirm
+       copy
+}

Index: policy/mls
===================================================================

mls (working copy) renamed from mls (revision 2667) +6 -1
@@ -568,7 +568,13 @@
        ( t1 == mlsxwinwrite ));
 
 
+#
+# MLS policy for the x_application_data class
+#
+mlsconstrain x_application_data { paste }
+       ( l1 domby l2 );
 
+
 #
 # MLS policy for the pax class
 #
 
 
 
--
Quoted 3 lines

Eamon Walsh <[email protected]>
National Security Agency

Seems to me that paste mlsconstrain should be (l1 eq l2) and should be a mlsconstrain for paste_after_confirm which is (l1 domby l2).

#4 lore raw
Quoted 1 line · Xavier Toth

Seems to me that paste mlsconstrain should be (l1 eq l2) and should be a mlsconstrain for paste_after_confirm which is (l1 domby l2).

Revised patch attached.

---

flask/security_classes +0 -0
Index: policy/flask/security_classes
===================================================================
@@ -114,5 +114,6 @@

class x_resource # userspace
class x_event # userspace
class x_synthetic_event # userspace
+class x_application_data # userspace

# FLASK

flask/access_vectors +0 -0
Index: policy/flask/access_vectors
===================================================================
@@ -775,3 +775,10 @@

{
recv
}
+
+class x_application_data
+{
+ paste
+ paste_after_confirm
+ copy
+}

mls +0 -0
Index: policy/mls
===================================================================
@@ -568,7 +568,19 @@
	 ( t1 == mlsxwinwrite ));

+#
+# MLS policy for the x_application_data class
+#

+# the x_application_data "paste" ops (explicit single level) +mlsconstrain x_application_data { paste }
+ ( l1 eq l2 );
+
+# the x_application_data "paste_after_confirm" ops (downgrade permitted) +mlsconstrain x_application_data { paste_after_confirm }
+ ( l1 domby l2 );
+
+
#
# MLS policy for the pax class
#

Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
Quoted 5 lines · Eamon Walsh
Quoted 2 lines · Xavier Toth

Seems to me that paste mlsconstrain should be (l1 eq l2) and should be a mlsconstrain for paste_after_confirm which is (l1 domby l2).

Revised patch attached.

Merged.

Quoted 55 lines

---

Index: policy/flask/security_classes
===================================================================

flask/security_classes +1 -0
@@ -114,5 +114,6 @@
 class x_resource		# userspace
 class x_event			# userspace
 class x_synthetic_event		# userspace
+class x_application_data	# userspace
 
 # FLASK

Index: policy/flask/access_vectors
===================================================================

flask/access_vectors +7 -0
@@ -775,3 +775,10 @@
 {
 	recv
 }
+
+class x_application_data
+{
+	paste
+	paste_after_confirm
+	copy
+}

Index: policy/mls
===================================================================

mls +12 -0
@@ -568,7 +568,19 @@
 	 ( t1 == mlsxwinwrite ));
 
 
+#
+# MLS policy for the x_application_data class
+#
 
+# the x_application_data "paste" ops (explicit single level)
+mlsconstrain x_application_data { paste }
+	( l1 eq l2 );
+
+# the x_application_data "paste_after_confirm" ops (downgrade permitted)
+mlsconstrain x_application_data { paste_after_confirm }
+	( l1 domby l2 );
+
+
 #
 # MLS policy for the pax class
 #
Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#6 lore raw
Quoted 60 lines · Christopher J. PeBenito
Quoted 5 lines · Eamon Walsh
Quoted 2 lines · Xavier Toth

Seems to me that paste mlsconstrain should be (l1 eq l2) and should be a mlsconstrain for paste_after_confirm which is (l1 domby l2).

Revised patch attached.

Merged.

Quoted 51 lines

---

Index: policy/flask/security_classes
===================================================================

flask/security_classes (working copy) renamed from flask/security_classes (revision 2669) +1 -0
@@ -114,5 +114,6 @@
 class x_resource             # userspace
 class x_event                        # userspace
 class x_synthetic_event              # userspace
+class x_application_data     # userspace
 
 # FLASK

Index: policy/flask/access_vectors
===================================================================

flask/access_vectors (working copy) renamed from flask/access_vectors (revision 2669) +7 -0
@@ -775,3 +775,10 @@
 {
      recv
 }
+
+class x_application_data
+{
+     paste
+     paste_after_confirm
+     copy
+}

Index: policy/mls
===================================================================

mls (working copy) renamed from mls (revision 2669) +12 -0
@@ -568,7 +568,19 @@
       ( t1 == mlsxwinwrite ));
 
 
+#
+# MLS policy for the x_application_data class
+#
 
+# the x_application_data "paste" ops (explicit single level)
+mlsconstrain x_application_data { paste }
+     ( l1 eq l2 );
+
+# the x_application_data "paste_after_confirm" ops (downgrade permitted)
+mlsconstrain x_application_data { paste_after_confirm }
+     ( l1 domby l2 );
+
+
 #
Quoted 10 lines

mls (working copy) line 586

Quoted 4 lines
mls (working copy) renamed from mls (revision 2669) +0 -0
 # MLS policy for the pax class
 #

--
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150

Here's what I've actually ended up using to allow pasting equal or up without requiring confirmation and to require confirmation when attempting to paste down:

mls +2 -2
Index: policy/mls
===================================================================
@@ -574,11 +574,11 @@
 
 # the x_application_data "paste" ops (explicit single level)
 mlsconstrain x_application_data { paste }
-	( l1 eq l2 );
+	(( l1 eq l2 ) or ( l1 domby l2 ));
 
 # the x_application_data "paste_after_confirm" ops (downgrade permitted)
 mlsconstrain x_application_data { paste_after_confirm }
-	( l1 domby l2 );
+	( l1 dom l2 );
 
 
 #

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#7 lore raw
Quoted 9 lines · Xavier Toth

Here's what I've actually ended up using to allow pasting equal or up without requiring confirmation and to require confirmation when attempting to paste down:

Index: policy/mls
===================================================================

mls line 577

Quoted 5 lines
mls +1 -1
@@ -574,11 +574,11 @@
 
 # the x_application_data "paste" ops (explicit single level)
 mlsconstrain x_application_data { paste }
-	( l1 eq l2 );
+	(( l1 eq l2 ) or ( l1 domby l2 ));

Isn't the (l1 eq l2) redundant?

Quoted 7 lines
mls +1 -1
 # the x_application_data "paste_after_confirm" ops (downgrade permitted)
 mlsconstrain x_application_data { paste_after_confirm }
-	( l1 domby l2 );
+	( l1 dom l2 );
 
 
 #
Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#8 lore raw
In reply to Xavier Toth
Quoted 1 line · Xavier Toth

Here's a patch I'm using with an MLS version of glipper to give the capability to check for dominance between copy and paste data contexts. Hopefully some version of this can be upstreamed.

Hi, why did you reverse the two paste operations? In my suggestion I had the "paste" bit meaning "unconditional paste" and "paste_after_confirm" meaning "allow paste only after the user confirms."

Having the confirmation dialog semantics built in to the plain old "paste" permission seems to me like it would be more confusing, and difficult to change later.

Quoted 45 lines

--- serefpolicy-3.3.1/policy/flask/access_vectors 2008-04-08
13:41:18.000000000 -0500
+++ serefpolicy-3.3.1.new//policy/flask/access_vectors 2008-04-08 13:35:43.000000000 -0500

(quoted diff) +7 -1
@@ -765,3 +765,10 @@
 {
        recv
 }
+
+class x_application_data
+{
+        paste
+        paste_without_confirm
+        copy
+}
--- serefpolicy-3.3.1/policy/flask/security_classes     2008-04-08 

13:41:18.000000000 -0500
+++ serefpolicy-3.3.1.new//policy/flask/security_classes

2008-04-08 13:34:36.000000000 -0500
policy/mls 2008-04-08 14:20:49.000000000 -0500 renamed from policy/mls 2008-04-08 13:41:18.000000000 -0500 +8 -3
@@ -114,5 +114,6 @@
 class x_resource               # userspace
 class x_event                  # userspace
 class x_synthetic_event                # userspace
+class x_application_data        # userspace
 
 # FLASK
--- serefpolicy-3.3.1/policy/mls        2008-04-08 13:41:18.000000000 
-0500
+++ serefpolicy-3.3.1.new/policy/mls    2008-04-08 14:20:49.000000000 
-0500
@@ -567,6 +567,12 @@
         ( t1 == mlsxwinwritexinput ) or
         ( t1 == mlsxwinwrite ));
 
+#
+# MLS policy for the x_application_data class
+#
+mlsconstrain x_application_data { paste_without_confirm }
+       ( l1 domby l2 );
+
 
 #
 # MLS policy for the pax class
Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 17 lines · Xavier Toth

On Mon, Apr 28, 2008 at 1:26 PM, Eamon Walsh <[email protected] <mailto:[email protected]>> wrote:

Xavier Toth wrote:

Here's a patch I'm using with an MLS version of glipper to give the capability to check for dominance between copy and paste data contexts. Hopefully some version of this can be upstreamed.

Hi, why did you reverse the two paste operations? In my suggestion I had the "paste" bit meaning "unconditional paste" and "paste_after_confirm" meaning "allow paste only after the user confirms."

Quoted 6 lines

Having the confirmation dialog semantics built in to the plain old "paste" permission seems to me like it would be more confusing, and difficult to change later.

Well maybe I didn't understand what you were thinking. I did it the way I did because I use the avc_has_perm to tell me whether I need to bring up the downgrade dialog.

Here is pseudo-code for the way I'd prefer to have the check done:

if (avc_has_perm(requestor's context, selection's context, X_APPLICATION_DATA, PASTE) == 0)
// Perform the paste without asking.

else if (avc_has_perm(requestor's context, selection's context, X_APPLICATION_DATA, PASTE_AFTER_CONFIRM) == 0)
// Pop up the confirmation dialog; perform the paste if user accepts.

else
// If you get here, the paste just isn't allowed at all.

Quoted 52 lines



        --- serefpolicy-3.3.1/policy/flask/access_vectors      
        2008-04-08 13:41:18.000000000 -0500
        +++ serefpolicy-3.3.1.new//policy/flask/access_vectors
         2008-04-08 13:35:43.000000000 -0500
        @@ -765,3 +765,10 @@
         {
               recv
         }
        +
        +class x_application_data
        +{
        +        paste
        +        paste_without_confirm
        +        copy
        +}
        --- serefpolicy-3.3.1/policy/flask/security_classes    
        2008-04-08 13:41:18.000000000 -0500
        +++ serefpolicy-3.3.1.new//policy/flask/security_classes      
         2008-04-08 13:34:36.000000000 -0500
        @@ -114,5 +114,6 @@
         class x_resource               # userspace
         class x_event                  # userspace
         class x_synthetic_event                # userspace
        +class x_application_data        # userspace
          # FLASK
        --- serefpolicy-3.3.1/policy/mls        2008-04-08
        13:41:18.000000000 -0500
        +++ serefpolicy-3.3.1.new/policy/mls    2008-04-08
        14:20:49.000000000 -0500
        @@ -567,6 +567,12 @@
                ( t1 == mlsxwinwritexinput ) or
                ( t1 == mlsxwinwrite ));
         +#
        +# MLS policy for the x_application_data class
        +#
        +mlsconstrain x_application_data { paste_without_confirm }
        +       ( l1 domby l2 );
        +
          #
         # MLS policy for the pax class



    -- 
    Eamon Walsh <[email protected] <mailto:[email protected]>>
    National Security Agency
Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.