Merge lp://staging/~jcsackett/launchpad/add-security-audit-utility into lp://staging/launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | j.c.sackett | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12896 | ||||
Proposed branch: | lp://staging/~jcsackett/launchpad/add-security-audit-utility | ||||
Merge into: | lp://staging/launchpad | ||||
Diff against target: |
147 lines (+138/-0) 2 files modified
lib/lp/scripts/utilities/tests/test_audit_security_settings.py (+26/-0) utilities/audit-security-settings.py (+112/-0) |
||||
To merge this branch: | bzr merge lp://staging/~jcsackett/launchpad/add-security-audit-utility | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Benji York (community) | code | Approve | |
Review via email: mp+58199@code.staging.launchpad.net |
Commit message
[r=benji][bug=765207][no-qa][incr] Adds utility to check for dupes in security.cfg
Description of the change
Summary
=======
database/
This branch does not attempt to remove duplicates--some of the duplicate settings are contradictory (one specifies only SELECT, another says SELECT and UPDATE). Another branch can be landed down the line to correct the file, once all duplicates are checked via this utility.
Preimp
======
Spoke with Curtis Hovey
Implementation
==============
Adds a utility which scans security.cfg and reports and duplicates.
QA
==
Run the script in a branch, it will report any dupes.
Lint
====
make lint:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
utilities/
This branch looks fine. There's nothing keeping this from being merged,
but here are a few things to consider:
If comment lines can also start with whitespace, you might want to strip
before looking for the comment character, like so:
def strip(data): ).startswith( '#')]
data = [d for d in data if not d.strip(
return [d for d in data if d.strip() != '']
It would be nice if this were tested to be sure that it reports the
errors you expect it to report (and more importantly, that it doesn't
stop reporting errors in the future when someone breaks it).
Would it be possible to run this at "make" time or as part of the test
suite? It'd be great if buildbot/jenkins would tell us if we introduced
errors that this code can find.
I see that the standard library's ConfigParser wouldn't work for this
use case; you might add a note explaining why you parse the file
yourself.
Since you use the "__metatype__ = type" trick you don't need to subclass
from object when defining SettingsAuditor.
In start_new_section, I don't see why you have to make a copy of settings because you're going to discard it at the end of
self.observed_
the method anyway.
You use "sys.exit(main())" but main doesn't ever return a non-None
value.