-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
859 #864
859 #864
Conversation
|
configVisServer.get('/', async (request, reply) => { | ||
// Obfuscate the config object before sending it to the client | ||
// First get clean copy of the config object | ||
let newConfig = JSON.parse(JSON.stringify(globals.config)); | ||
|
||
if (globals.config.get('Butler-SOS.configVisualisation.obfuscate')) { | ||
// Obfuscate config file before presenting it to the user | ||
// This is done to avoid leaking sensitive information | ||
// to users who should not have access to it. | ||
// The obfuscation is done by replacing parts of the | ||
// config file with masked strings. | ||
newConfig = configObfuscate(newConfig); | ||
} | ||
|
||
// Convert the (potentially obfuscated) config object to YAML format (=string) | ||
const butlerConfigYaml = yaml.dump(newConfig); | ||
|
||
// Read index.html from disk | ||
// dirname points to the directory where this file (app.js) is located, taking into account | ||
// if the app is running as a packaged app or as a Node.js app. | ||
globals.logger.verbose(`----------------3: ${globals.appBasePath}`); | ||
const filePath = path.resolve(globals.appBasePath, 'static/configvis', 'index.html'); | ||
const template = fs.readFileSync(filePath, 'utf8'); | ||
|
||
// Compile handlebars template | ||
const compiledTemplate = handlebars.compile(template); | ||
|
||
// Get config as HTML encoded JSON string | ||
const butlerConfigJsonEncoded = JSON.stringify(newConfig); | ||
|
||
// Render the template | ||
const renderedText = compiledTemplate({ butlerConfigJsonEncoded, butlerConfigYaml }); | ||
|
||
globals.logger.debug(`CONFIG VIS: Rendered text: ${renderedText}`); | ||
|
||
// Send reply as HTML | ||
reply.code(200).header('Content-Type', 'text/html; charset=utf-8').send(renderedText); | ||
}); |
Check failure
Code scanning / CodeQL
Missing rate limiting High
a file system access
tokenize: function (e, n) { | ||
var t = n.rest; | ||
if (t) { | ||
for (var r in t) n[r] = t[r]; |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
user controlled input
var t = n.rest; | ||
if (t) { | ||
for (var r in t) n[r] = t[r]; | ||
delete n.rest; |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
No description provided.