Skip to content

Commit d51301a

Browse files
Release 0.15.4 (#1472)
* Fix for sso access key reading (#1469)
1 parent a594606 commit d51301a

22 files changed

+86
-134
lines changed

.github/workflows/docker-release.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-22.04
1515

1616
steps:
1717
- name: Checkout repository
@@ -41,6 +41,10 @@ jobs:
4141
exit 1
4242
fi
4343
echo "VERSION=$VERSION" >> $GITHUB_ENV
44+
echo "GITHUB REF TYPE: ${{ github.ref_type }}"
45+
echo "GITHUB REF NAME: ${{ github.ref_name }}"
46+
echo "EVENT INPUT VERSION: ${{ github.event.inputs.version }}"
47+
echo "ENV VERSION: $VERSION"
4448
4549
- name: Build and push Docker image
4650
uses: docker/build-push-action@v5

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121

2222
# IDE - VSCode
2323
.vscode/*
24-
!.vscode/settings.json
25-
!.vscode/tasks.json
26-
!.vscode/launch.json
27-
!.vscode/extensions.json
2824

2925
# misc
3026
/.angular/cache

.vscode/launch.json

-20
This file was deleted.

.vscode/settings.json

-13
This file was deleted.

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ARG BASE_DISTRO="node:alpine"
1+
ARG BASE_DISTRO="node:20-alpine"
22

3-
FROM --platform=${BUILDPLATFORM} ${BASE_DISTRO} as builder
3+
FROM --platform=${BUILDPLATFORM} ${BASE_DISTRO} AS builder
44

55
WORKDIR /RTL
66

@@ -20,7 +20,7 @@ RUN npm run buildbackend
2020
# Remove non production necessary modules
2121
RUN npm prune --omit=dev --legacy-peer-deps
2222

23-
FROM --platform=${TARGETPLATFORM} ${BASE_DISTRO} as runner
23+
FROM --platform=${TARGETPLATFORM} ${BASE_DISTRO} AS runner
2424

2525
RUN apk add --no-cache tini
2626

backend/controllers/shared/RTLConf.js

+27-35
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Database } from '../../utils/database.js';
88
import { Logger } from '../../utils/logger.js';
99
import { Common } from '../../utils/common.js';
1010
import { WSServer } from '../../utils/webSocketServer.js';
11-
import { Authentication, SSO } from '../../models/config.model.js';
11+
import { Authentication } from '../../models/config.model.js';
1212
const options = { url: '' };
1313
const logger = Logger;
1414
const common = Common;
@@ -96,41 +96,33 @@ export const getFile = (req, res, next) => {
9696
};
9797
export const getApplicationSettings = (req, res, next) => {
9898
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Getting RTL Configuration..' });
99-
const confFile = common.appConfig.rtlConfFilePath + sep + 'RTL-Config.json';
100-
fs.readFile(confFile, 'utf8', (errRes, data) => {
101-
if (errRes) {
102-
const errMsg = 'Get Node Config Error';
103-
const err = common.handleError({ statusCode: 500, message: errMsg, error: errRes }, 'RTLConf', errMsg, req.session.selectedNode);
104-
return res.status(err.statusCode).json({ message: err.error, error: err.error });
105-
}
106-
else {
107-
const appConfData = common.removeSecureData(JSON.parse(data));
108-
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
109-
appConfData.enable2FA = common.appConfig.enable2FA;
110-
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
111-
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
112-
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
113-
jwt.verify(token, common.secret_key, (err, user) => {
114-
if (err) {
115-
// Delete unnecessary data for initial response (without security token)
116-
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
117-
appConfData.SSO = new SSO();
118-
appConfData.secret2FA = '';
119-
appConfData.dbDirectoryPath = '';
120-
appConfData.nodes[selNodeIdx].authentication = new Authentication();
121-
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
122-
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
123-
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
124-
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
125-
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
126-
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
127-
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
128-
appConfData.nodes = [appConfData.nodes[selNodeIdx]];
129-
}
130-
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
131-
res.status(200).json(appConfData);
132-
});
99+
const appConfData = common.removeSecureData(JSON.parse(JSON.stringify(common.appConfig)));
100+
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
101+
appConfData.enable2FA = common.appConfig.enable2FA;
102+
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
103+
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
104+
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
105+
jwt.verify(token, common.secret_key, (err, user) => {
106+
if (err) {
107+
// Delete unnecessary data for initial response (without security token)
108+
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
109+
delete appConfData.SSO.rtlCookiePath;
110+
delete appConfData.SSO.cookieValue;
111+
delete appConfData.SSO.logoutRedirectLink;
112+
appConfData.secret2FA = '';
113+
appConfData.dbDirectoryPath = '';
114+
appConfData.nodes[selNodeIdx].authentication = new Authentication();
115+
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
116+
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
117+
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
118+
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
119+
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
120+
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
121+
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
122+
appConfData.nodes = [appConfData.nodes[selNodeIdx]];
133123
}
124+
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
125+
res.status(200).json(appConfData);
134126
});
135127
};
136128
export const updateSelectedNode = (req, res, next) => {

backend/controllers/shared/authenticate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const verifyToken = (twoFAToken) => !!(common.appConfig.secret2FA && comm
4848
export const authenticateUser = (req, res, next) => {
4949
const { authenticateWith, authenticationValue, twoFAToken } = req.body;
5050
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Authenticating User..' });
51-
if (+common.appConfig.SSO.rtlSso) {
51+
if (+common.appConfig.SSO.rtlSSO) {
5252
if (authenticateWith === 'JWT' && jwt.verify(authenticationValue, common.secret_key)) {
5353
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'User Authenticated' });
5454
res.status(406).json({ message: 'SSO Authentication Error', error: 'Login with Password is not allowed with SSO.' });
@@ -103,7 +103,7 @@ export const authenticateUser = (req, res, next) => {
103103
export const resetPassword = (req, res, next) => {
104104
const { currPassword, newPassword } = req.body;
105105
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Resetting Password..' });
106-
if (+common.appConfig.SSO.rtlSso) {
106+
if (+common.appConfig.SSO.rtlSSO) {
107107
const errMsg = 'Password cannot be reset for SSO authentication';
108108
const err = common.handleError({ statusCode: 401, message: 'Password Reset Error', error: errMsg }, 'Authenticate', errMsg, req.session.selectedNode);
109109
return res.status(err.statusCode).json({ message: err.message, error: err.error });

backend/models/config.model.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export class SSO {
2-
constructor(rtlSso, rtlCookiePath, logoutRedirectLink, cookieValue) {
3-
this.rtlSso = rtlSso;
2+
constructor(rtlSSO, rtlCookiePath, logoutRedirectLink, cookieValue) {
3+
this.rtlSSO = rtlSSO;
44
this.rtlCookiePath = rtlCookiePath;
55
this.logoutRedirectLink = logoutRedirectLink;
66
this.cookieValue = cookieValue;

backend/utils/common.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class CommonService {
99
this.logger = Logger;
1010
this.nodes = [];
1111
this.selectedNode = null;
12-
this.ssoInit = { rtlSso: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
12+
this.ssoInit = { rtlSSO: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
1313
this.appConfig = { defaultNodeIndex: 0, selectedNodeIndex: 0, rtlConfFilePath: '', dbDirectoryPath: join(dirname(fileURLToPath(import.meta.url)), '..', '..'), rtlPass: '', allowPasswordUpdate: true, enable2FA: false, secret2FA: '', SSO: this.ssoInit, nodes: [] };
1414
this.port = 3000;
1515
this.host = '';
@@ -528,7 +528,7 @@ export class CommonService {
528528
const selNode = req.session.selectedNode;
529529
if (selNode && selNode.index) {
530530
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup:', msg: JSON.stringify(this.removeSecureData(JSON.parse(JSON.stringify(this.appConfig)))) });
531-
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSso });
531+
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSSO });
532532
}
533533
};
534534
this.filterData = (dataKey, lnImplementation) => {

backend/utils/config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ export class ConfigService {
318318
};
319319
this.setSSOParams = (config) => {
320320
if (process?.env?.RTL_SSO) {
321-
config.SSO.rtlSso = +process?.env?.RTL_SSO;
321+
config.SSO.rtlSSO = +process?.env?.RTL_SSO;
322322
}
323323
else if (config.SSO && config.SSO.rtlSSO) {
324-
config.SSO.rtlSso = config.SSO.rtlSSO;
324+
config.SSO.rtlSSO = config.SSO.rtlSSO;
325325
}
326326
if (process?.env?.RTL_COOKIE_PATH) {
327327
config.SSO.rtlCookiePath = process?.env?.RTL_COOKIE_PATH;
@@ -338,7 +338,7 @@ export class ConfigService {
338338
else if (config.SSO && config.SSO.logoutRedirectLink) {
339339
config.SSO.logoutRedirectLink = config.SSO.logoutRedirectLink;
340340
}
341-
if (+config.SSO.rtlSso) {
341+
if (+config.SSO.rtlSSO) {
342342
if (!config.SSO.rtlCookiePath || config.SSO.rtlCookiePath.trim() === '') {
343343
this.errMsg = 'Please set rtlCookiePath value for single sign on option!';
344344
}

frontend/index.html

+1-1
Large diffs are not rendered by default.

frontend/main.6e2567250e1fcca3.js

-1
This file was deleted.

frontend/main.89468e89473d89c7.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rtl",
3-
"version": "0.15.3-beta",
3+
"version": "0.15.4-beta",
44
"license": "MIT",
55
"type": "module",
66
"scripts": {

server/controllers/shared/RTLConf.ts

+27-34
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Database, DatabaseService } from '../../utils/database.js';
88
import { Logger, LoggerService } from '../../utils/logger.js';
99
import { Common, CommonService } from '../../utils/common.js';
1010
import { WSServer } from '../../utils/webSocketServer.js';
11-
import { Authentication, SSO } from '../../models/config.model.js';
11+
import { Authentication } from '../../models/config.model.js';
1212

1313
const options = { url: '' };
1414
const logger: LoggerService = Logger;
@@ -99,40 +99,33 @@ export const getFile = (req, res, next) => {
9999

100100
export const getApplicationSettings = (req, res, next) => {
101101
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Getting RTL Configuration..' });
102-
const confFile = common.appConfig.rtlConfFilePath + sep + 'RTL-Config.json';
103-
fs.readFile(confFile, 'utf8', (errRes, data) => {
104-
if (errRes) {
105-
const errMsg = 'Get Node Config Error';
106-
const err = common.handleError({ statusCode: 500, message: errMsg, error: errRes }, 'RTLConf', errMsg, req.session.selectedNode);
107-
return res.status(err.statusCode).json({ message: err.error, error: err.error });
108-
} else {
109-
const appConfData = common.removeSecureData(JSON.parse(data));
110-
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
111-
appConfData.enable2FA = common.appConfig.enable2FA;
112-
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
113-
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
114-
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
115-
jwt.verify(token, common.secret_key, (err, user) => {
116-
if (err) {
117-
// Delete unnecessary data for initial response (without security token)
118-
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
119-
appConfData.SSO = new SSO();
120-
appConfData.secret2FA = '';
121-
appConfData.dbDirectoryPath = '';
122-
appConfData.nodes[selNodeIdx].authentication = new Authentication();
123-
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
124-
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
125-
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
126-
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
127-
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
128-
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
129-
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
130-
appConfData.nodes = [appConfData.nodes[selNodeIdx]];
131-
}
132-
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
133-
res.status(200).json(appConfData);
134-
});
102+
const appConfData = common.removeSecureData(JSON.parse(JSON.stringify(common.appConfig)));
103+
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
104+
appConfData.enable2FA = common.appConfig.enable2FA;
105+
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
106+
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
107+
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
108+
jwt.verify(token, common.secret_key, (err, user) => {
109+
if (err) {
110+
// Delete unnecessary data for initial response (without security token)
111+
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
112+
delete appConfData.SSO.rtlCookiePath;
113+
delete appConfData.SSO.cookieValue;
114+
delete appConfData.SSO.logoutRedirectLink;
115+
appConfData.secret2FA = '';
116+
appConfData.dbDirectoryPath = '';
117+
appConfData.nodes[selNodeIdx].authentication = new Authentication();
118+
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
119+
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
120+
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
121+
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
122+
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
123+
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
124+
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
125+
appConfData.nodes = [appConfData.nodes[selNodeIdx]];
135126
}
127+
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
128+
res.status(200).json(appConfData);
136129
});
137130
};
138131

server/controllers/shared/authenticate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const verifyToken = (twoFAToken) => !!(common.appConfig.secret2FA && comm
5252
export const authenticateUser = (req, res, next) => {
5353
const { authenticateWith, authenticationValue, twoFAToken } = req.body;
5454
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Authenticating User..' });
55-
if (+common.appConfig.SSO.rtlSso) {
55+
if (+common.appConfig.SSO.rtlSSO) {
5656
if (authenticateWith === 'JWT' && jwt.verify(authenticationValue, common.secret_key)) {
5757
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'User Authenticated' });
5858
res.status(406).json({ message: 'SSO Authentication Error', error: 'Login with Password is not allowed with SSO.' });
@@ -100,7 +100,7 @@ export const authenticateUser = (req, res, next) => {
100100
export const resetPassword = (req, res, next) => {
101101
const { currPassword, newPassword } = req.body;
102102
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Resetting Password..' });
103-
if (+common.appConfig.SSO.rtlSso) {
103+
if (+common.appConfig.SSO.rtlSSO) {
104104
const errMsg = 'Password cannot be reset for SSO authentication';
105105
const err = common.handleError({ statusCode: 401, message: 'Password Reset Error', error: errMsg }, 'Authenticate', errMsg, req.session.selectedNode);
106106
return res.status(err.statusCode).json({ message: err.message, error: err.error });

server/models/config.model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export class SSO {
22

33
constructor(
4-
public rtlSso?: number,
4+
public rtlSSO?: number,
55
public rtlCookiePath?: string,
66
public logoutRedirectLink?: string,
77
public cookieValue?: string

server/utils/common.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class CommonService {
1111
public logger: LoggerService = Logger;
1212
public nodes: SelectedNode[] = [];
1313
public selectedNode: SelectedNode = null;
14-
public ssoInit = { rtlSso: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
14+
public ssoInit = { rtlSSO: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
1515
public appConfig: ApplicationConfig = { defaultNodeIndex: 0, selectedNodeIndex: 0, rtlConfFilePath: '', dbDirectoryPath: join(dirname(fileURLToPath(import.meta.url)), '..', '..'), rtlPass: '', allowPasswordUpdate: true, enable2FA: false, secret2FA: '', SSO: this.ssoInit, nodes: [] };
1616
public port = 3000;
1717
public host = '';
@@ -542,7 +542,7 @@ export class CommonService {
542542
const selNode = <SelectedNode>req.session.selectedNode;
543543
if (selNode && selNode.index) {
544544
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup:', msg: JSON.stringify(this.removeSecureData(JSON.parse(JSON.stringify(this.appConfig)))) });
545-
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSso });
545+
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSSO });
546546
}
547547
};
548548

0 commit comments

Comments
 (0)