2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-11-11 13:10:41 +00:00

Issue #37 LFI Vulnerability Removal, Side Menu collapse on toggle, macaroon spelling correction

This commit is contained in:
ShahanaFarooqui 2019-01-18 22:04:16 -05:00
parent 59f3be564a
commit be71869994
10 changed files with 46 additions and 12 deletions

View File

@ -467,6 +467,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
@angular/material/tree
@angular/material/radio
@angular/material/sidenav
@angular/material/toolbar
@ -679,8 +681,6 @@ Apache-2.0
@angular/material/radio
@angular/material/slide-toggle
d3-drag

View File

@ -8,5 +8,5 @@
<link rel="stylesheet" href="styles.6acb6bfec10bb1e126bd.css"></head>
<body>
<rtl-app></rtl-app>
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.418928a701f2040ada02.js"></script><script type="text/javascript" src="main.6638a0b001fe98e8f64b.js"></script></body>
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.418928a701f2040ada02.js"></script><script type="text/javascript" src="main.8ff799723ff745ec504c.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,8 @@
var common = {};
common.lnd_server_url = '';
common.lnd_config_path = '';
common.bitcoind_config_path = '';
common.enable_logging = false;
common.convertToBTC = (num) => {

View File

@ -12,9 +12,10 @@ var log_file_path = path.normalize(__dirname) + '/RTL.log';
var defaultConfig = {
Authentication: {
lndServerUrl:'https://localhost:8080/v1',
macroonPath:'',
macaroonPath:'',
nodeAuthType:'DEFAULT',
lndConfigPath:'',
bitcoindConfigPath: '',
rtlPass:'',
enableLogging: false
},
@ -35,6 +36,9 @@ var setMacaroonPath = (clArgs, config) => {
if(config.Authentication.macroonPath !== '') {
macaroonPath = config.Authentication.macroonPath;
}
if(config.Authentication.macaroonPath !== '') {
macaroonPath = config.Authentication.macaroonPath;
}
}
}
@ -55,6 +59,12 @@ var validateConfigFile = (macaroonPath, config) => {
if(upperCase(config.Authentication.nodeAuthType) === 'DEFAULT' && (config.Authentication.lndConfigPath === '' || undefined === config.Authentication.lndConfigPath)) {
errMsg = errMsg + '\nDefault Node Authentication can be set with LND Config Path only. Please set LND Config Path in RTL.conf';
} else {
common.lnd_config_path = config.Authentication.lndConfigPath;
}
if(config.Authentication.bitcoindConfigPath !== '' || undefined !== config.Authentication.bitcoindConfigPath) {
common.bitcoind_config_path = config.Authentication.bitcoindConfigPath;
}
if(upperCase(config.Authentication.nodeAuthType) === 'CUSTOM' && (config.Authentication.rtlPass === '' || undefined === config.Authentication.rtlPass)) {

View File

@ -3,6 +3,7 @@ var path = require('path');
var fs = require('fs');
var file_path = path.normalize(__dirname + '/..') + '/RTL.conf';
var logger = require('./logger');
var common = require('../common');
exports.getRTLConfig = (req, res, next) => {
logger.info('\r\nConf: 7: ' + JSON.stringify(Date.now()) + ': INFO: Getting RTL Config');
@ -15,7 +16,12 @@ exports.getRTLConfig = (req, res, next) => {
});
} else {
const jsonConfig = ini.parse(data);
res.status(200).json({settings: jsonConfig.Settings, nodeAuthType: (jsonConfig.Authentication.nodeAuthType) ? jsonConfig.Authentication.nodeAuthType : 'DEFAULT'});
authSettings = {
nodeAuthType: (jsonConfig.Authentication.nodeAuthType) ? jsonConfig.Authentication.nodeAuthType : 'DEFAULT',
lndConfigPath: (jsonConfig.Authentication.lndConfigPath) ? jsonConfig.Authentication.lndConfigPath : '',
bitcoindConfigPath: (jsonConfig.Authentication.bitcoindConfigPath) ? jsonConfig.Authentication.bitcoindConfigPath : ''
};
res.status(200).json({settings: jsonConfig.Settings, authSettings: authSettings});
}
});
};
@ -38,10 +44,26 @@ exports.updateUISettings = (req, res, next) => {
});
};
exports.getLNDConfig = (req, res, next) => {
fs.readFile(req.headers.filepath, 'utf8', function(err, data) {
exports.getConfig = (req, res, next) => {
let confFilePath = '';
switch (req.params.nodeType) {
case 'lnd':
confFilePath = common.lnd_config_path
break;
case 'bitcoind':
confFilePath = common.bitcoind_config_path
break;
case 'rtl':
confFilePath = file_path;
break;
default:
confFilePath = '';
break;
}
logger.info('\r\nConf: 43: ' + JSON.stringify(Date.now()) + ': INFO: Node Type: ' + req.params.nodeType + ', File Path: ' + confFilePath);
fs.readFile(confFilePath, 'utf8', function(err, data) {
if (err) {
logger.error('\r\nConf: 43: ' + JSON.stringify(Date.now()) + ': ERROR: Reading Conf Failed!');
logger.error('\r\nConf: 59: ' + JSON.stringify(Date.now()) + ': ERROR: Reading Conf Failed!');
res.status(500).json({
message: "Reading Config File Failed!",
error: err

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.1.12-alpha",
"version": "0.1.13-alpha",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.1.12-alpha",
"version": "0.1.13-alpha",
"license": "MIT",
"scripts": {
"ng": "ng",

View File

@ -5,6 +5,6 @@ const authCheck = require("./authCheck");
router.get("/rtlconf", RTLConfController.getRTLConfig);
router.post("/", authCheck, RTLConfController.updateUISettings);
router.get("/lndconfig", authCheck, RTLConfController.getLNDConfig);
router.get("/config/:nodeType", authCheck, RTLConfController.getConfig);
module.exports = router;