Add syntax highlighting for AppArmor Profiles.
ClosedPublic

Authored by nibags on Aug 22 2017, 9:28 AM.

Details

Summary

AppArmor is a Linux security module that provides mandatory access control on Linux.
The AppArmor Profiles are plain text files that contain access rules for the applications monitored by AppArmor. These are located in: /etc/apparmor.d/

More information:

This syntax highlighting file has the characteristic that has a different context for each type of AppArmor rule, so as to avoid conflicts between keywords with different uses and to provide a specific highlighting in each rule.

The highlighting file is made for the latest version of AppArmor: 2.11. Note that by the end of this year (at the latest), AppArmor 4.0 will be released, so, at that time, I will need to update this syntax file with the new features.

Test Plan

This file was created in late February 2017 for personal use and I have been using it to create/edit AppArmor profiles during this time. Therefore, I can assure you that the highlighting file has been tested enough.

Diff Detail

Repository
R216 Syntax Highlighting
Branch
add-apparmor-syntax (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
nibags created this revision.Aug 22 2017, 9:28 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 22 2017, 9:28 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript

Three things I see ATM:

  1. Please no hard coded colors, are they really necessary?
  2. I think we want some test file for it with reference in the autotests directory
  3. If possible please MIT license
dhaumann requested changes to this revision.Aug 22 2017, 10:16 AM
dhaumann added a subscriber: dhaumann.

See Christoph's comments. And indeed, please remove all hard-coded colors. Also, please provide a test file that is preferrably licensed under MIT.

data/syntax/apparmor.xml
47

Please remove all spaces around keywords. I.e. <item>profile</item> without the two spaces.

This revision now requires changes to proceed.Aug 22 2017, 10:16 AM

OK, I'll correct it.

nibags updated this revision to Diff 18983.Aug 30 2017, 10:55 PM
nibags edited edge metadata.
  • Updated AppArmor syntax highlighting file:
  1. Updating D7461: Add syntax highlighting for AppArmor Profiles. #

Updated AppArmor syntax highlighting file.

Hi! Sorry for the delay, I've been very busy the last few days. I made the changes you requested:

  • Hard color is removed. New highlighting styles are used.
  • Sample AppArmor profile is added for testing (including .ref, .fold & .html files).

In addition, some fixes are made to the file. In the case of the license, I prefer to use LGPL. I don't know if there is any special reason to use MIT instead.

Now I have more free time, so if you need to make more changes to the file, I'll respond faster.

From what I can tell, the xml file looks quite good, although it contains many rules so it is hard to completely review this.

With respect to MIT: We were discussing licensing last Akademy conference (this year), and the issue with LGPL is that we are not even sure whether many the syntax definitions can be licensed LGPL at all. Think of some vendor specific highlighting files (like ASP) or similar. So our goal is to make the xml files are free as possible, without claiming too much copyright here (since we most likely don't have it). MIT is the simplest and most liberal one that is compatible with LGPL.
And more on that, LGPL is not even unique, do you mean LGPLv2 only? or v2+v3? or v2 and any later version?

This currently is a mess, and we would like to avoid this as much as possible, therefore we kindly ask to agree with MIT license.

nibags updated this revision to Diff 19578.Sep 16 2017, 4:24 AM
  • License is changed to MIT

Ready! I've updated the license. If you need me to change something else (or if there is something you don't like), let me know.

dhaumann accepted this revision.Sep 16 2017, 6:55 AM

Thanks, I am fine with this now. Shall I push this for you, or do you have commit access as well?

This revision is now accepted and ready to land.Sep 16 2017, 6:55 AM

It seems that I do not have access to commits. You better push it

aacid closed this revision.Sep 16 2017, 7:49 PM