Add syntax highlighting for SELinux CIL Policies & File Contexts

Authored by nibags on Jan 29 2018, 11:54 AM.



SELinux CIL Policies:
The SELinux Common Intermediate Language (CIL) is a language for creating security policies. This is a recent language and is part of the official SELinux project.

More information:

SELinux File Contexts files (File Labeling Policy):
These contain the security contexts for paths/files. This highlighting applies to the following files:

  • "file_contexts", "file_contexts.local", "file_contexts.template", "file_contexts.homedirs", "homedir_template": They are SELinux configuration files. They are usually stored in: /etc/selinux/targeted/contexts/. The file 'file_contexts' is also generated when compiling the CIL policy.
  • "*.fc": These files are part of the SELinux Reference Policy.

The CIL syntax is very similar to the Scheme language, therefore, I used the bracket highlighting code of the Scheme XML file as a base (I even used the same bracket colors). At the beginning of the file I gave credits to the author of the Scheme file (Dominik Haumann), but I am not sure if this is the correct way.


Diff Detail

R216 Syntax Highlighting
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
nibags created this revision.Jan 29 2018, 11:54 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 29 2018, 11:54 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
nibags requested review of this revision.Jan 29 2018, 11:54 AM
nibags edited the summary of this revision. (Show Details)Jan 29 2018, 11:55 AM
nibags updated this revision to Diff 26240.EditedJan 31 2018, 8:47 AM
  • Modification of 'itemDatas', to adapt the syntax to the available schemas

The highlighting did not look good in the 'vim (dark)' scheme, due to the use of 'bold' by default. Sorry for not having noticed.

dhaumann accepted this revision.Feb 24 2018, 9:17 PM
dhaumann added a subscriber: dhaumann.

I'll remove the selColor attributes, since these will not work with dark color schemes.
Similar, I will remove all underline, italic, and bold attributes where not needed by default.

This revision is now accepted and ready to land.Feb 24 2018, 9:17 PM
This revision was automatically updated to reflect the committed changes.