Skip to content

Improve docker-bench-security json output#314

Merged
konstruktoid merged 1 commit intodocker:masterfrom
draios:master
Oct 12, 2018
Merged

Improve docker-bench-security json output#314
konstruktoid merged 1 commit intodocker:masterfrom
draios:master

Conversation

@mstemm
Copy link
Copy Markdown
Contributor

@mstemm mstemm commented Jul 12, 2018

Add a test object for each test performed by the script. Each object has
an id N.M, a desc property describing the test, and the result. Some
tests include additional information about the test e.g. "No TLS
Certificate Found". That can be found in an optional details property of
the test object.

Also, some tests might also return a list of containers, images, users,
etc. This is included in an optional items property of the test object.

Instead of having all test results as top-level objects, break the test
results into sections. Each section has an id + description e.g. "1" and
"Host Configuration". The tests for that section are an array below that
object.

All of the additional json output is implemented by adding new functions
startsectionjson(), endsectionjson(), starttestjson(), and
resulttestjson() that take the id/desc/etc as arguments and print the
proper json properties. It also required adding an "end" test to each
script that calls endsectionjson().

Signed-off-by: Mark Stemm mark.stemm@gmail.com

@GordonTheTurtle
Copy link
Copy Markdown

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "master" git@github.com:draios/docker-bench-security.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354528264
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@pingoleon108
Copy link
Copy Markdown

any chance to merge those commits, would be great to have a better json.

@konstruktoid
Copy link
Copy Markdown
Collaborator

Could you rebase this @mstemm and I'll continue with testing?

Add a test object for each test performed by the script. Each object has
an id N.M, a desc property describing the test, and the result. Some
tests include additional information about the test e.g. "No TLS
Certificate Found". That can be found in an optional details property of
the test object.

Also, some tests might also return a list of containers, images, users,
etc. This is included in an optional items property of the test object.

Instead of having all test results as top-level objects, break the test
results into sections. Each section has an id + description e.g. "1" and
"Host Configuration". The tests for that section are an array below that
object.

All of the additional json output is implemented by adding new functions
startsectionjson(), endsectionjson(), starttestjson(), and
resulttestjson() that take the id/desc/etc as arguments and print the
proper json properties. It also required adding an "end" test to each
script that calls endsectionjson().

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
@mstemm
Copy link
Copy Markdown
Contributor Author

mstemm commented Oct 11, 2018

Sure, rebased. Please take a look.

@konstruktoid konstruktoid merged commit 9ca5b8b into docker:master Oct 12, 2018
@konstruktoid
Copy link
Copy Markdown
Collaborator

Thanks and so sorry for the delay on this on @mstemm.

Close #323

@mstemm
Copy link
Copy Markdown
Contributor Author

mstemm commented Oct 12, 2018

thanks so much for incorporating!

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.

4 participants