Skip to content

Commit 076bf66

Browse files
committed
0.2.1
- fixes bug that would let anyone publish to a repo regardless of permissions that were set - fixes bug in test that didn't properly test auth based operations
1 parent f242195 commit 076bf66

17 files changed

Lines changed: 249 additions & 54 deletions

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ before_install:
44
- npm install npm@5 -g
55
language: node_js
66
script:
7-
- npm install node-coverage-server -g
7+
- npm install lcov-server -g
88
- npm run lint
99
- npm run coverage
10-
- cat coverage/lcov.info | node-coverage-cli --url https://node-coverage-server.herokuapp.com
10+
- cat coverage/lcov.info | lcov-server-cli --url https://lcov-server.herokuapp.com
1111
node_js:
1212
- "6"
13-
- "7"
13+
- "8"
1414
os:
1515
- linux
1616
sudo: false

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.2.1 (09/15/2017)
2+
3+
- fixes bug that would let anyone publish to a repo regardless of permissions that were set
4+
- fixes bug in test that didn't properly test auth based operations
5+
16
# 0.2.0 (09/05/2017)
27

38
- abstracts server into lib/git.js

docs/code/Git.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<label for="nav-trigger" class="overlay"></label>
2323

2424
<nav>
25-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
25+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li><li data-type='method'><a href="module-lib_util.html#~parseGitName">parseGitName</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
2626
</nav>
2727

2828
<div id="main">
@@ -557,7 +557,7 @@ <h4 class="name" id="Git"><span class="type-signature"></span>new Git<span class
557557
<br class="clear">
558558

559559
<footer>
560-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Tue Sep 05 2017 23:17:38 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
560+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 19:09:13 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
561561
</footer>
562562

563563
<script>prettyPrint();</script>

docs/code/Service.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<label for="nav-trigger" class="overlay"></label>
2323

2424
<nav>
25-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
25+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li><li data-type='method'><a href="module-lib_util.html#~parseGitName">parseGitName</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
2626
</nav>
2727

2828
<div id="main">
@@ -171,7 +171,7 @@ <h3 class="subsection-title">Extends</h3>
171171
<br class="clear">
172172

173173
<footer>
174-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Tue Sep 05 2017 23:17:38 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
174+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 19:09:13 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
175175
</footer>
176176

177177
<script>prettyPrint();</script>

docs/code/git.js.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<label for="nav-trigger" class="overlay"></label>
2323

2424
<nav>
25-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
25+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li><li data-type='method'><a href="module-lib_util.html#~parseGitName">parseGitName</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
2626
</nav>
2727

2828
<div id="main">
@@ -47,7 +47,7 @@ <h1 class="page-title">git.js</h1>
4747
const { spawn } = require('child_process');
4848
const { EventEmitter } = require('events');
4949

50-
const { createAction, infoResponse, onExit, basicAuth, noCache } = require('./util');
50+
const { parseGitName, createAction, infoResponse, onExit, basicAuth, noCache } = require('./util');
5151

5252
const services = ['upload-pack', 'receive-pack'];
5353

@@ -172,7 +172,7 @@ <h1 class="page-title">git.js</h1>
172172
Reject the pending request.
173173
*/
174174
constructor(repoDir, options={}) {
175-
super()
175+
super();
176176

177177
if(typeof repoDir === 'function') {
178178
this.dirMap = repoDir;
@@ -199,7 +199,7 @@ <h1 class="page-title">git.js</h1>
199199
fs.readdir(this.dirMap(), (error, results) => {
200200
if(error) return callback(error);
201201
let repos = results.filter((r) => {
202-
return r.substring(r.length - 3, r.length) == 'git'
202+
return r.substring(r.length - 3, r.length) == 'git';
203203
}, []);
204204

205205
callback(null, repos);
@@ -239,7 +239,7 @@ <h1 class="page-title">git.js</h1>
239239
*/
240240
create(repo, callback) {
241241
var self = this;
242-
if (typeof cb !== 'function') cb = function () {};
242+
if (typeof callback !== 'function') callback = function () {};
243243

244244
if (!/\.git$/.test(repo)) repo += '.git';
245245

@@ -252,7 +252,7 @@ <h1 class="page-title">git.js</h1>
252252
});
253253

254254
function next (err) {
255-
if (err) return cb(err);
255+
if (err) return callback(err);
256256

257257
var ps, error = '';
258258

@@ -266,9 +266,9 @@ <h1 class="page-title">git.js</h1>
266266

267267
ps.stderr.on('data', function (buf) { error += buf; });
268268
onExit(ps, function (code) {
269-
if (!cb) { return; }
270-
else if (code) cb(error || true);
271-
else cb(null);
269+
if (!callback) { return; }
270+
else if (code) callback(error || true);
271+
else callback(null);
272272
});
273273
}
274274
}
@@ -285,7 +285,7 @@ <h1 class="page-title">git.js</h1>
285285
var u = url.parse(req.url);
286286
var m = u.pathname.match(/\/(.+)\/info\/refs$/) || u.pathname.match(/\/(.+)\/git-receive-pack$/) || u.pathname.match(/\/(.+)\/git-upload-pack$/);
287287
if(!m) return false; // this action is not supported
288-
var repo = m[1];
288+
var repo = parseGitName(m[1]);
289289

290290
// check if the repo is authenticated
291291
if(self.repos &amp;&amp; self.repos[repo] &amp;&amp; self.repos[repo].username &amp;&amp; self.repos[repo].password) {
@@ -435,7 +435,7 @@ <h1 class="page-title">git.js</h1>
435435
res.statusCode = 404;
436436
res.end('not found');
437437
}
438-
]
438+
];
439439
res.setHeader('connection', 'close');
440440
var self = this;
441441
(function next(ix) {
@@ -471,7 +471,7 @@ <h1 class="page-title">git.js</h1>
471471
<br class="clear">
472472

473473
<footer>
474-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Tue Sep 05 2017 23:17:38 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
474+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 19:09:13 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
475475
</footer>
476476

477477
<script>prettyPrint();</script>

docs/code/global.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<label for="nav-trigger" class="overlay"></label>
2323

2424
<nav>
25-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
25+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li><li data-type='method'><a href="module-lib_util.html#~parseGitName">parseGitName</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
2626
</nav>
2727

2828
<div id="main">
@@ -945,7 +945,7 @@ <h5>Parameters:</h5>
945945
<br class="clear">
946946

947947
<footer>
948-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Tue Sep 05 2017 23:17:38 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
948+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 19:09:13 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
949949
</footer>
950950

951951
<script>prettyPrint();</script>

docs/code/index.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<label for="nav-trigger" class="overlay"></label>
2323

2424
<nav>
25-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
25+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a></li><li><a href="Service.html">Service</a></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li><li data-type='method'><a href="module-lib_util.html#~parseGitName">parseGitName</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#create">create</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#handle">handle</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkdir">mkdir</a></li></ul>
2626
</nav>
2727

2828
<div id="main">
@@ -47,7 +47,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html"
4747

4848
<section class="readme">
4949
<article><h1>node-git-server</h1><blockquote>
50-
<p>An almost zero dependency git-server built with <code>nodejs</code></p>
50+
<p>A configurable git server written in Node.js</p>
5151
</blockquote>
5252
<p><a href="https://www.npmjs.com/package/node-git-server"><img src="https://img.shields.io/npm/v/node-git-server.svg" alt="Npm Version"></a>
5353
<a href="https://travis-ci.org/gabrielcsapo/node-git-server"><img src="https://travis-ci.org/gabrielcsapo/node-git-server.svg?branch=master" alt="Build Status"></a>
@@ -84,11 +84,7 @@ <h1>requirements</h1><pre class="prettyprint source"><code>- git (^ 2.7)</code><
8484
Writing objects: 100% (356/356), 46.20 KiB, done.
8585
Total 356 (delta 210), reused 355 (delta 210)
8686
To http://localhost:7005/beep
87-
* [new branch] master -> master</code></pre><p>and then...</p>
88-
<pre class="prettyprint source"><code>$ node example/simple.js
89-
push beep.git/d5013a53a0e139804e729a12107fc212f11e64c3 (master)</code></pre><p>or...</p>
90-
<pre class="prettyprint source"><code>$ git clone http://localhost:7005/beep.git</code></pre><p>and then...</p>
91-
<pre class="prettyprint source"><code>fetch beep.git/d5013a53a0e139804e729a12107fc212f11e64c3</code></pre><h1>Philosophy</h1><p>This library is aimed to have a zero dependency footprint. If you are reading this and you see dependencies, help to remove them 🐒.</p>
87+
* [new branch] master -> master</code></pre><h1>Philosophy</h1><p>This library is aimed to have a zero dependency footprint. If you are reading this and you see dependencies, help to remove them 🐒.</p>
9288
<h1>Thanks</h1><p>This is a hard fork from <a href="https://github.com/substack/pushover">pushover</a>.</p></article>
9389
</section>
9490

@@ -102,7 +98,7 @@ <h1>Thanks</h1><p>This is a hard fork from <a href="https://github.com/substack/
10298
<br class="clear">
10399

104100
<footer>
105-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Tue Sep 05 2017 23:17:38 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
101+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 19:09:13 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
106102
</footer>
107103

108104
<script>prettyPrint();</script>

0 commit comments

Comments
 (0)