git ssb

3+

cel / ssb-npm-registry



Commit 4c7d541a176f2e064fa573b2a960014b4bc088d5

Allow publish only from local host

cel committed on 9/25/2017, 2:37:34 AM
Parent: ac87f1608fda8b0d7298cb255af198e0c0d9fe64

Files changed

index.jschanged
index.jsView
@@ -18,9 +18,9 @@
1818 getAddress: 'async'
1919 }
2020 exports.init = function (sbot, config) {
2121 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'
2323 var registryAddress
2424 var getAddressCbs = []
2525
2626 var server = http.createServer(exports.respond(sbot, config))
@@ -229,22 +229,11 @@
229229 getMention(null, next)
230230 })
231231 }
232232
233-var localhosts = {
234- '127.0.0.1': true,
235- '::1': true,
236- '::ffff:127.0.0.1': true,
237-}
238-
239233 Req.prototype.publishPkg = function (pkgName) {
234+ var chunks = []
240235 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 = []
247236 self.req.on('data', function (data) {
248237 chunks.push(data)
249238 })
250239 self.req.on('end', function () {

Built with git-ssb-web