Commit 4c7d541a176f2e064fa573b2a960014b4bc088d5
Allow publish only from local host
cel committed on 9/25/2017, 2:37:34 AMParent: ac87f1608fda8b0d7298cb255af198e0c0d9fe64
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -18,9 +18,9 @@ | ||
18 | 18 | getAddress: 'async' |
19 | 19 | } |
20 | 20 | exports.init = function (sbot, config) { |
21 | 21 | var port = config.npm ? config.npm.port : 8043 |
22 | - var host = config.npm && config.npm.host || null | |
22 | + var host = config.npm && config.npm.host || 'localhost' | |
23 | 23 | var registryAddress |
24 | 24 | var getAddressCbs = [] |
25 | 25 | |
26 | 26 | var server = http.createServer(exports.respond(sbot, config)) |
@@ -229,22 +229,11 @@ | ||
229 | 229 | getMention(null, next) |
230 | 230 | }) |
231 | 231 | } |
232 | 232 | |
233 | -var localhosts = { | |
234 | - '127.0.0.1': true, | |
235 | - '::1': true, | |
236 | - '::ffff:127.0.0.1': true, | |
237 | -} | |
238 | - | |
239 | 233 | Req.prototype.publishPkg = function (pkgName) { |
234 | + var chunks = [] | |
240 | 235 | var self = this |
241 | - var remoteAddress = self.req.socket.remoteAddress | |
242 | - if (!(remoteAddress in localhosts)) { | |
243 | - return self.respondError(403, 'You may not publish as this user.') | |
244 | - } | |
245 | - | |
246 | - var chunks = [] | |
247 | 236 | self.req.on('data', function (data) { |
248 | 237 | chunks.push(data) |
249 | 238 | }) |
250 | 239 | self.req.on('end', function () { |
Built with git-ssb-web