http: do not allow dumping of master key without admin privileges.
This commit is contained in:
parent
18e742a092
commit
f0fb7c4db3
@ -160,14 +160,18 @@ HTTPServer.prototype._init = function _init() {
|
|||||||
this.use(function(req, res, send, next) {
|
this.use(function(req, res, send, next) {
|
||||||
var hash;
|
var hash;
|
||||||
|
|
||||||
if (this.options.noAuth)
|
if (this.options.noAuth) {
|
||||||
|
req.admin = true;
|
||||||
return next();
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
hash = hash256(req.password);
|
hash = hash256(req.password);
|
||||||
|
|
||||||
// Regular API key gives access to everything.
|
// Regular API key gives access to everything.
|
||||||
if (crypto.ccmp(hash, this.apiHash))
|
if (crypto.ccmp(hash, this.apiHash)) {
|
||||||
|
req.admin = true;
|
||||||
return next();
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
// If they're hitting the wallet services,
|
// If they're hitting the wallet services,
|
||||||
// they can use the less powerful API key.
|
// they can use the less powerful API key.
|
||||||
@ -762,6 +766,9 @@ HTTPServer.prototype._init = function _init() {
|
|||||||
|
|
||||||
// Get wallet master key
|
// Get wallet master key
|
||||||
this.get('/wallet/:id/master', function(req, res, send, next) {
|
this.get('/wallet/:id/master', function(req, res, send, next) {
|
||||||
|
if (!req.admin)
|
||||||
|
return send(403, { error: 'Admin access required.' });
|
||||||
|
|
||||||
send(200, req.wallet.master.toJSON(true));
|
send(200, req.wallet.master.toJSON(true));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user