Add syntax highlighting for SELinux kernel policy language

Authored by nibags on Aug 31 2018, 1:14 PM.

Description

Add syntax highlighting for SELinux kernel policy language

Summary:
This corresponds to the standard policy language of SELinux [1], used for example, by the SELinux Reference Policy [2] or the Android policies [3][4].

Extensions and files to highlight:

  • SELinux Type Enforcement (*.te)
  • SELinux Interface File (*.if)
  • M 4 Macros of Reference Policy (*.spt)
  • Some policy build files and policy config. files (access_vectors, mls, mcs, mls_macros, te_macros, policy_capabilities, seapp_contexts, port_contexts), and monolithic policy (policy.conf). NOTE: I added only relevant configuration files and policy building, since many have very generic names.

Also, this file contains common rules and keywords between selinux-fc.xml and selinux-cil.xml. For example, it contains the RegExp highlighting and the Permissions keywords. The idea is to avoid having repeated keywords and rules between the SELinux highlighting files.

References:
[1] SELinux Wiki. PolicyLanguage: https://selinuxproject.org/page/PolicyLanguage#Kernel_Policy_Language
[2] SELinux Reference Policy: https://github.com/SELinuxProject/refpolicy/wiki
[3] Security-Enhanced Linux in Android: https://source.android.com/security/selinux/
[4] SELinux policy configuration for AOSP: https://android.googlesource.com/platform/system/sepolicy/

Reviewers: Framework: Syntax Highlighting, dhaumann, cullmann

Reviewed By: Framework: Syntax Highlighting, cullmann

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: Kate, Frameworks

Differential Revision: https://phabricator.kde.org/D15089