Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC/WIP: Add basic check for naming style violations #95

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cgzones
Copy link
Contributor

@cgzones cgzones commented Apr 6, 2020

Refpolicy findings:

networkmanager.te: 8: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 9: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 12: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 15: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 18: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 21: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 24: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 27: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 30: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te: 33: (C): Naming convention voliated: contains invalid character (C-006)
slocate.if: 13: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if: 18: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if: 48: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if: 67: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if: 86: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if: 106: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if: 127: (C): Naming convention voliated: interface has no module name prefix (C-006)
qemu.if: 113: (C): Naming convention voliated: template has an invalid postfix (C-006)
webalizer.if: 60: (C): Naming convention voliated: interface has no module name prefix (C-006)
udev.if: 461: (C): Naming convention voliated: interface has no module name prefix (C-006)
udev.if: 486: (C): Naming convention voliated: interface has no module name prefix (C-006)
udev.if: 505: (C): Naming convention voliated: interface has no module name prefix (C-006)
daemontools.if: 91: (C): Naming convention voliated: interface has no module name prefix (C-006)
systemd.if: 147: (C): Naming convention voliated: contains invalid character (C-006)
iscsi.if: 13: (C): Naming convention voliated: interface has no module name prefix (C-006)
kismet.if: 18: (C): Naming convention voliated: template has an invalid postfix (C-006)
lsm.if: 20: (C): Naming convention voliated: interface has no module name prefix (C-006)
mailscanner.if: 14: (C): Naming convention voliated: interface has no module name prefix (C-006)
mailscanner.if: 41: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if: 13: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if: 33: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if: 53: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if: 78: (C): Naming convention voliated: interface has no module name prefix (C-006)
rlogin.if: 32: (C): Naming convention voliated: template has an invalid postfix (C-006)
qpid.if: 13: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 32: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 50: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 69: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 87: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 106: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 125: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 145: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if: 171: (C): Naming convention voliated: interface has no module name prefix (C-006)
ctdb.if: 14: (C): Naming convention voliated: interface has no module name prefix (C-006)
ctdb.if: 34: (C): Naming convention voliated: interface has no module name prefix (C-006)
aisexec.if: 79: (C): Naming convention voliated: interface has no module name prefix (C-006)
isns.if: 20: (C): Naming convention voliated: interface has no module name prefix (C-006)
l2tp.if: 14: (C): Naming convention voliated: interface has no module name prefix (C-006)
l2tp.if: 34: (C): Naming convention voliated: interface has no module name prefix (C-006)
l2tp.if: 53: (C): Naming convention voliated: interface has no module name prefix (C-006)
polipo.if: 18: (C): Naming convention voliated: template has an invalid postfix (C-006)
systemtap.if: 20: (C): Naming convention voliated: interface has no module name prefix (C-006)
git.if: 18: (C): Naming convention voliated: template has an invalid postfix (C-006)
cobbler.if: 13: (C): Naming convention voliated: interface has no module name prefix (C-006)
cobbler.if: 33: (C): Naming convention voliated: interface has no module name prefix (C-006)
example.if: 29: (C): Naming convention voliated: interface has no module name prefix (C-006)
example.if: 47: (C): Naming convention voliated: interface has no module name prefix (C-006)
Found the following issue counts:
C-006: 57

@dburgener
Copy link
Member

A few initial thoughts:

I think we need to think about configuration and documentation for this. I can definitely envision use cases where people want to change these conventions (case in point: Android, although we don't actually support parsing Android policy yet, I hope to in the future). My initial thought is to have a config file option for each convention that people can turn on and off (and where it makes sense, customize). I don't know if that would get unwieldy or if we want to group related conventions.

In terms of documentation, a section in the README describing the conventions and how to configure them would be helpful I think. Possibly an abbreviated version in the man page? If it seems too long for the README, I wouldn't be opposed to a separate file that just gets referenced in the README.

Lastly, I wonder if breaking the interface and declaration checks into two separate checks would make more sense. The downside is that someone who wants no naming convention enforcement would have to turn off both (side note: groups of checks that can be configured together would be a cool future feature). On the other hand, I imagine someone might want to look at only one or the other without doing all the configuration work to turn one set of conventions off.

@cgzones cgzones changed the title Add basic check for naming style violations RFC/WIP: Add basic check for naming style violations May 8, 2020
Refpolicy findings:

networkmanager.te:    8: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:    9: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   12: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   15: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   18: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   21: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   24: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   27: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   30: (C): Naming convention voliated: contains invalid character (C-006)
networkmanager.te:   33: (C): Naming convention voliated: contains invalid character (C-006)
slocate.if:          13: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if:       18: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if:       48: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if:       67: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if:       86: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if:      106: (C): Naming convention voliated: interface has no module name prefix (C-006)
openoffice.if:      127: (C): Naming convention voliated: interface has no module name prefix (C-006)
qemu.if:            113: (C): Naming convention voliated: template has an invalid postfix (C-006)
webalizer.if:        60: (C): Naming convention voliated: interface has no module name prefix (C-006)
udev.if:            461: (C): Naming convention voliated: interface has no module name prefix (C-006)
udev.if:            486: (C): Naming convention voliated: interface has no module name prefix (C-006)
udev.if:            505: (C): Naming convention voliated: interface has no module name prefix (C-006)
daemontools.if:      91: (C): Naming convention voliated: interface has no module name prefix (C-006)
systemd.if:         147: (C): Naming convention voliated: contains invalid character (C-006)
iscsi.if:            13: (C): Naming convention voliated: interface has no module name prefix (C-006)
kismet.if:           18: (C): Naming convention voliated: template has an invalid postfix (C-006)
lsm.if:              20: (C): Naming convention voliated: interface has no module name prefix (C-006)
mailscanner.if:      14: (C): Naming convention voliated: interface has no module name prefix (C-006)
mailscanner.if:      41: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if:             13: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if:             33: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if:             53: (C): Naming convention voliated: interface has no module name prefix (C-006)
dhcp.if:             78: (C): Naming convention voliated: interface has no module name prefix (C-006)
rlogin.if:           32: (C): Naming convention voliated: template has an invalid postfix (C-006)
qpid.if:             13: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:             32: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:             50: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:             69: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:             87: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:            106: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:            125: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:            145: (C): Naming convention voliated: interface has no module name prefix (C-006)
qpid.if:            171: (C): Naming convention voliated: interface has no module name prefix (C-006)
ctdb.if:             14: (C): Naming convention voliated: interface has no module name prefix (C-006)
ctdb.if:             34: (C): Naming convention voliated: interface has no module name prefix (C-006)
aisexec.if:          79: (C): Naming convention voliated: interface has no module name prefix (C-006)
isns.if:             20: (C): Naming convention voliated: interface has no module name prefix (C-006)
l2tp.if:             14: (C): Naming convention voliated: interface has no module name prefix (C-006)
l2tp.if:             34: (C): Naming convention voliated: interface has no module name prefix (C-006)
l2tp.if:             53: (C): Naming convention voliated: interface has no module name prefix (C-006)
polipo.if:           18: (C): Naming convention voliated: template has an invalid postfix (C-006)
systemtap.if:        20: (C): Naming convention voliated: interface has no module name prefix (C-006)
git.if:              18: (C): Naming convention voliated: template has an invalid postfix (C-006)
cobbler.if:          13: (C): Naming convention voliated: interface has no module name prefix (C-006)
cobbler.if:          33: (C): Naming convention voliated: interface has no module name prefix (C-006)
example.if:          29: (C): Naming convention voliated: interface has no module name prefix (C-006)
example.if:          47: (C): Naming convention voliated: interface has no module name prefix (C-006)
Found the following issue counts:
C-006: 57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants