$ show SELinuxProject/setools
SETools is a comprehensive SELinux policy analysis toolkit providing both command-line and GUI utilities for querying, comparing, and analyzing SELinux policies. The system consists of a core library (setools) for policy representation and analysis, GUI components (setoolsgui) for interactive analysis via apol, and specialized tools like seinfo (policy querying), sesearch (rule search), sediff (policy comparison), and setools-mcp (MCP server for LLM integration). The architecture features a modular design with clear separation between policy representation, querying mechanisms, difference analysis, and validation frameworks. Key strengths include a reusable query framework using descriptor patterns and mixins, a robust difference engine with wrapper-based caching, and a well-structured GUI following model-view patterns. The project demonstrates active maintenance with recent updates, strict dependency management, and extensive test coverage.
The LLM identified 5 files worth highlighting for reuse:
Provides abstract PolicyQuery base class with mixin-based criteria matching (MatchName, MatchContext, etc.) and descriptor pattern for criteria handling. Enables reusable query construction across policy components (types, roles, booleans, rules) with automatic value conversion and validation. Highly decoupled from policy representation details.
Implements CriteriaDescriptor and CriteriaSetDescriptor patterns for automatic attribute conversion, validation, and default handling in query objects. Supports regex, enum, lookup, and type conversion with configurable behavior. Eliminates boilerplate in query classes while providing consistent attribute handling.
Defines PolicyDifference base class with Wrapper pattern for policy objects and DiffResultDescriptor for lazy difference computation. Provides framework for component-specific difference classes (TypesDifference, RulesDifference, etc.) with efficient caching and clear separation of concerns. Demonstrates sophisticated diff algorithm design.
Implements CheckerModule base class with registry system for pluggable policy validation checks. Enables extensible compliance checking through declarative check definitions (assertrbac, assertte). Shows clean separation between check registration, execution, and result reporting.
Provides SEToolsTableModel abstract base class and concrete model implementations (TypeTable, RoleTable, etc.) following Qt model-view pattern. Separates data presentation from GUI logic enabling reusable tabular displays across different policy components. Demonstrates proper Qt model implementation with role-based data access.