Skip to content

Commit

Permalink
Update nearly every file in the project
Browse files Browse the repository at this point in the history
* Replaced jshint with eslint
* Removed gulp; running mocha and eslint directly
* Fixed all lint errors, namely removed all semicolons
* Update least supported version to 4.8.5.
* Updated to ISC License
* Updated README
* Updated all packages
  • Loading branch information
Bland, Mike committed Oct 26, 2017
1 parent dcb29cd commit 9f840d3
Show file tree
Hide file tree
Showing 12 changed files with 1,599 additions and 313 deletions.
97 changes: 0 additions & 97 deletions .about.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
**/vendor/*.js
coverage/*
tmp/
37 changes: 37 additions & 0 deletions .eslintrc
@@ -0,0 +1,37 @@
{ "extends": "eslint:recommended",
"env" : {
"node" : true,
"mocha" : true,
"es6" : true /** all es6 features except modules */
},
"rules" : {
"indent": [
2,
2,
{ "VariableDeclarator": 2 }
],
"quotes": [
2,
"single"
],
"semi": [
2,
"never"
],
"comma-dangle": [
1,
"never"
],
"no-console": [ 0 ],
"max-len": [
2,
80,
2
],
"camelcase": [
2,
{ "properties": "always" }
],
"keyword-spacing": [ 2 ]
}
}
34 changes: 0 additions & 34 deletions .jshintrc

This file was deleted.

7 changes: 2 additions & 5 deletions .travis.yml
@@ -1,7 +1,4 @@
language: node_js
node_js:
- "5.0"
- "4.2"
- "4.1"
- "4.0"
- "0.12.7"
- node
- "4.8"
19 changes: 0 additions & 19 deletions CONTRIBUTING.md

This file was deleted.

44 changes: 13 additions & 31 deletions LICENSE.md
@@ -1,31 +1,13 @@
As a work of the United States Government, this project is in the
public domain within the United States.

Additionally, we waive copyright and related rights in the work
worldwide through the CC0 1.0 Universal public domain dedication.

## CC0 1.0 Universal Summary

This is a human-readable summary of the [Legal Code (read the full text)](https://creativecommons.org/publicdomain/zero/1.0/legalcode).

### No Copyright

The person who associated a work with this deed has dedicated the work to
the public domain by waiving all of his or her rights to the work worldwide
under copyright law, including all related and neighboring rights, to the
extent allowed by law.

You can copy, modify, distribute and perform the work, even for commercial
purposes, all without asking permission.

### Other Information

In no way are the patent or trademark rights of any person affected by CC0,
nor are the rights that other persons may have in the work or in how the
work is used, such as publicity or privacy rights.

Unless expressly stated otherwise, the person who associated a work with
this deed makes no warranties about the work, and disclaims liability for
all uses of the work, to the fullest extent permitted by applicable law.
When using or citing the work, you should not imply endorsement by the
author or the affirmer.
Copyright (c) 2017, Mike Bland <mbland@acm.org>

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
71 changes: 30 additions & 41 deletions README.md
@@ -1,12 +1,15 @@
# github-webhook-validator

This library provides an [Express](https://www.npmjs.com/package/express)
middleware validator for [GitHub webhooks](https://developer.github.com/webhooks/)
that have a secret key defined.
This library provides an [Express][] middleware validator for [GitHub
webhooks][] that have a secret key defined.

It was primarily developed for the [`18f-pages-server`
npm](https://www.npmjs.com/package/18f-pages-server). It enables
authentication across multiple webhooks handled by the same server.
[Express]: https://expressjs.com/
[GitHub webhooks]: https://developer.github.com/webhooks/

It was primarily developed for the [pages-server][]. It enables authentication
across multiple webhooks handled by the same server.

[pages-server]: https://github.com/mbland/pages-server

## Installation

Expand All @@ -16,8 +19,10 @@ To make this library part of your project:
$ npm install github-webhook-validator --save
```

Note that [Node.js](https://nodejs.org/) version 0.12.7 or higher is required;
check your installed version with `node -v`.
Note that [Node.js][] version 4.8.5 or higher is required; check your installed
version with `node -v`.

[Node.js]: https://nodejs.org/

## Usage

Expand Down Expand Up @@ -54,9 +59,10 @@ function doLaunch(config, keyDictionary) {

### loadKeyDictionary([defaultKeyFile[, builderConfigs[, parseKeyLabelFromConfig]]])

Returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
that will, upon success, resolve to an object comprised of `label: key`
mappings for use by the middleware validator.
Returns a [Promise][] that will, upon success, resolve to an object comprised of
`label: key` mappings for use by the middleware validator.

[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

* **defaultKeyFile**: path to the file containing the secret key used to
validate all payloads by default
Expand All @@ -81,9 +87,11 @@ definition.
### middlewareValidator(keyDictionary[, parseKeyLabelFromBody])

Returns a function corresponding to the `verify` function interface passed as
an option to [Express `body-parser` middleware](https://www.npmjs.com/package/body-parser).
The returned function will abort the request with an error message if
validation fails, prior to parsing taking place.
an option to [Express `body-parser` middleware][bp]. The returned function will
abort the request with an error message if validation fails, prior to parsing
taking place.

[bp]: https://www.npmjs.com/package/body-parser

* **keyDictionary**: the result from **loadKeyDictionary()**
* **parseKeyLabelFromBody**: maps the raw contents of the request body to a
Expand All @@ -105,30 +113,11 @@ does not exist, _any incoming requests with the `X-Hub-Signature` HTTP header
will fail validation_. The fix would be to add a default key, to add a
branch-specific key, or to remove the secret key from the webhook definition.

## Contributing

1. Fork the repo (or just clone it if you're an 18F team member)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Make your changes and test them via `npm test` or `gulp test`
4. Lint your changes with `gulp lint`
5. Commit your changes (`git commit -am 'Add some feature'`)
6. Push to the branch (`git push origin my-new-feature`)
7. Create a new Pull Request

Feel free to [file an issue](https://github.com/18F/github-webhook-validator/issues)
or to ping [@mbland](https://github.com/mbland) with any questions you may
have, especially if the current documentation should've addressed your needs,
but didn't.

## Public domain

This project is in the worldwide [public domain](LICENSE.md). As stated in
[CONTRIBUTING](CONTRIBUTING.md):

> This project is in the public domain within the United States, and copyright
> and related rights in the work worldwide are waived through the
> [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
>
> All contributions to this project will be released under the CC0 dedication.
> By submitting a pull request, you are agreeing to comply with this waiver of
> copyright interest.
### Open Source License

This software is made available as [Open Source software][oss-def] under the
[ISC License][]. For the text of the license, see the [LICENSE](LICENSE.md)
file.

[oss-def]: https://opensource.org/osd-annotated
[isc license]: https://www.isc.org/downloads/software-support-policy/isc-license/
18 changes: 0 additions & 18 deletions gulpfile.js

This file was deleted.

0 comments on commit 9f840d3

Please sign in to comment.