Update secrets.js

This commit is contained in:
berbant 2024-02-22 23:55:57 +04:00 committed by GitHub
parent eb89337f51
commit bc2010a762
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -213,12 +213,13 @@ router.post('/view', jsonParser, async (_, response) => {
router.post('/find', jsonParser, (request, response) => { router.post('/find', jsonParser, (request, response) => {
const allowKeysExposure = getConfigValue('allowKeysExposure', false); const allowKeysExposure = getConfigValue('allowKeysExposure', false);
if (!allowKeysExposure) { const key = request.body.key;
if (!allowKeysExposure && key.slice(key.length-4) !== '_url' ) {
console.error('Cannot fetch secrets unless allowKeysExposure in config.yaml is set to true'); console.error('Cannot fetch secrets unless allowKeysExposure in config.yaml is set to true');
return response.sendStatus(403); return response.sendStatus(403);
} }
const key = request.body.key;
try { try {
const secret = readSecret(key); const secret = readSecret(key);