org-checks
v1.3.0
Published
Perform security checks on github
Downloads
2
Readme
node-org-checks
Organization monitoring and reporting to ensure standards are in place for every aspect of an organization.
Architecture
┌──────┐ ┌──────┐ ┌──────┐
│check │ │assert│ │verify│
│creden│ │tests │ │ org │
│tials │ │exist │ │ 2FA │
└──────┘ └──────┘ └──────┘
│ │ │
└─────┬─────┴──────────┘
│
┌─────▼────────┐ ┌─────┐
│ device ◀ ─ ─│creds│
└──────────────┘ └─────┘
│
┌───────┴───┬──────────┐
│ │ │
┌───▼──┐ ┌───▼──┐ ┌───▼──┐
│ hip- │ │ │ │ │
│ chat │ │ xml │ │stdout│
│ │ │ │ │ │
└──────┘ └──────┘ └──────┘
Input
credentials(organization, opts)
Check existance of AWS_KEY
, .pem
, id_rsa
and .key
files. Opts has the
following fields:
- user: GitHub user (required)
- token: GitHub OpenAuth token (required)
stale(organization, auth, opts?)
Check for stale repositories. By default projects are considered stale after 6 months of no updates. Opts has the following fields:
- offset: offset in months before a project is considered stale. Defaults to 6
Output
stdout(opts)
Report to stdout. If opts.summary=true
it will report a summary only.
hipchat(opts)
Report a summary to HipChat. Opts has the following fields:
- token: HipChat authentication token
- room: room id to report to
xunit(opts)
Report a summary in xunit xml
. Useful to integrate with CI solutions. Unlike
other reporters, this will be reported as pass / fail
. Opts has the following
fields:
- output: path to write to. Writes to
process.stdout
by default - fail: determine if errors should be reported. Defaults to
true
csv(opts)
Transforms output into a stream of csv
. Can either write to stdout or a file.
opts
has the following fields:
- output: path to write to. Writes to
process.stdout
by default
Installation
$ git clone https://github.com/TabDigital/org-checks
Usage
const checkCredentials = require('org-checks/input/credentials')
const toHipchat = require('org-checks/output/hipchat')
const toHtml = require('org-checks/output/html')
const orgChecks = require('org-checks/device')
const hipchatAuth = { room: '208899', token: '<token>' }
const ghAuth = { username: 'foobar', token: '<token>' }
const org = 'tabDigital'
const output = [ toHipchat(hipchatAuth), toHtml('/tmp/org-status.html') ]
const input = [ checkCredentials(org, ghAuth) ]
orgChecks(input, output)
Device format
Each input should return data in the following format to the device:
{ "name": "credentials:aws-keys", "type": "error", "data": "https://binbaz.com" }
{ "name": "credentials:.pem", "type": "error", "data": "https://foobar.com" }
{ "name": "credentials:aws-keys", "type": "summary", "data": { "total": 40, "pass": 24, "fail": 16 } }
There are 2 types that can be returned:
- error: an error has occured, a string is included to point to the corresponding error.
- summary: a test has finished running and has a
total
,pass
andfail
count. Useful for short form reporters. If there is no total count (e.g. cannot be expressed as a percentage), only thefail
key should be included.
The name
key can be namespaced using :
to distinguish between topics and
sub topics. This distinction is useful for output formatters to control the
amount of detail to display.
License
MIT