hc
2025-02-14 bbb9540dc49f70f6b703d1c8d1b85fa5f602d86e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
From ae84e5ef59bb24d5b8fd17e6756952f42c2d5c36 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 23 Feb 2017 08:17:07 +0100
Subject: [PATCH] Do not export/use setools.InfoFlowAnalysis and
 setools.DomainTransitionAnalysis
 
dta and infoflow modules require networkx which brings lot of dependencies.
These dependencies are not necessary for setools module itself as it's
used in policycoreutils.
 
Therefore it's better to use setools.infoflow.InfoFlowAnalysis and
setools.dta.DomainTransitionAnalysis and let the package containing
sedta and seinfoflow to require python3-networkx
 
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
[Refreshed for 4.3.0]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Refreshed for 4.4.0]
---
 sedta                       | 3 ++-
 seinfoflow                  | 5 +++--
 setools/__init__.py         | 4 ++--
 setoolsgui/apol/dta.py      | 2 +-
 setoolsgui/apol/infoflow.py | 2 +-
 tests/dta.py                | 2 +-
 tests/infoflow.py           | 2 +-
 7 files changed, 11 insertions(+), 9 deletions(-)
 
diff --git a/sedta b/sedta
index 60861ca630a5..0056172a55e5 100755
--- a/sedta
+++ b/sedta
@@ -23,6 +23,7 @@ import logging
 import signal
 
 import setools
+import setools.dta
 
 
 def print_transition(trans: setools.DomainTransition) -> None:
@@ -114,7 +115,7 @@ else:
 
 try:
     p = setools.SELinuxPolicy(args.policy)
-    g = setools.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
+    g = setools.dta.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
 
     if args.shortest_path or args.all_paths:
         if args.shortest_path:
diff --git a/seinfoflow b/seinfoflow
index f10c39de4d8e..fe733bbd0787 100755
--- a/seinfoflow
+++ b/seinfoflow
@@ -18,6 +18,7 @@
 #
 
 import setools
+import setools.infoflow
 import argparse
 import sys
 import logging
@@ -102,8 +103,8 @@ elif args.booleans is not None:
 try:
     p = setools.SELinuxPolicy(args.policy)
     m = setools.PermissionMap(args.map)
-    g = setools.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude,
-                                 booleans=booleans)
+    g = setools.infoflow.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude,
+                                          booleans=booleans)
 
     if args.shortest_path or args.all_paths:
         if args.shortest_path:
diff --git a/setools/__init__.py b/setools/__init__.py
index d72d343..4d5aaaa 100644
--- a/setools/__init__.py
+++ b/setools/__init__.py
@@ -91,11 +91,11 @@ from .pcideviceconquery import PcideviceconQuery
 from .devicetreeconquery import DevicetreeconQuery
 
 # Information Flow Analysis
-from .infoflow import InfoFlowAnalysis
+# from .infoflow import InfoFlowAnalysis
 from .permmap import PermissionMap, RuleWeight, Mapping
 
 # Domain Transition Analysis
-from .dta import DomainTransitionAnalysis, DomainEntrypoint, DomainTransition
+# from .dta import DomainTransitionAnalysis, DomainEntrypoint, DomainTransition
 
 # Policy difference
 from .diff import PolicyDifference
diff --git a/setoolsgui/apol/dta.py b/setoolsgui/apol/dta.py
index 4608b9dbf34e..2cde44c142e9 100644
--- a/setoolsgui/apol/dta.py
+++ b/setoolsgui/apol/dta.py
@@ -24,7 +24,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
 from PyQt5.QtGui import QPalette, QTextCursor
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
     QTreeWidgetItem
-from setools import DomainTransitionAnalysis
+from setools.dta import DomainTransitionAnalysis
 
 from ..logtosignal import LogHandlerToSignal
 from .analysistab import AnalysisSection, AnalysisTab
diff --git a/setoolsgui/apol/infoflow.py b/setoolsgui/apol/infoflow.py
index 7bca299d23fc..7fee2778f35f 100644
--- a/setoolsgui/apol/infoflow.py
+++ b/setoolsgui/apol/infoflow.py
@@ -26,7 +26,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
 from PyQt5.QtGui import QPalette, QTextCursor
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
     QTreeWidgetItem
-from setools import InfoFlowAnalysis
+from setools.infoflow import InfoFlowAnalysis
 from setools.exception import UnmappedClass, UnmappedPermission
 
 from ..logtosignal import LogHandlerToSignal
diff --git a/tests/dta.py b/tests/dta.py
index a0cc9381469c..177e6fb0b961 100644
--- a/tests/dta.py
+++ b/tests/dta.py
@@ -18,7 +18,7 @@
 import os
 import unittest
 
-from setools import DomainTransitionAnalysis
+from setools.dta import DomainTransitionAnalysis
 from setools import TERuletype as TERT
 from setools.exception import InvalidType
 from setools.policyrep import Type
diff --git a/tests/infoflow.py b/tests/infoflow.py
index aa0e44a7e4f8..fca2848aeca5 100644
--- a/tests/infoflow.py
+++ b/tests/infoflow.py
@@ -18,7 +18,7 @@
 import os
 import unittest
 
-from setools import InfoFlowAnalysis
+from setools.infoflow import InfoFlowAnalysis
 from setools import TERuletype as TERT
 from setools.exception import InvalidType
 from setools.permmap import PermissionMap
-- 
2.26.2