From 8cfe9552cca4d3b07fa61bc0c7aedf332359ba8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:40:48 +0000 Subject: [PATCH 1/2] Bump path-parse from 1.0.6 to 1.0.7 Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6c0cbd0..469df99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fiware-pep-proxy", - "version": "7.9.2", + "version": "8.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -4728,9 +4728,9 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "path-to-glob-pattern": { From 8360f1598165ea2b1e3fa029ac1a0065b9f3120b Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Wed, 25 Aug 2021 11:24:23 +0200 Subject: [PATCH 2/2] Fix #130 - support PEP_PROXY_PASSWORD Backwards compatible fix to support `PEP_PROXY_PASSWORD` and `PEP_PASSWORD` `PEP_TOKEN_SECRET` and `PEP_TRUSTED_APPS` are also supported with and without `_PROXY_` --- Dockerfile | 8 ++++---- doc/admin_guide.md | 6 +++--- extras/docker/Dockerfile | 8 ++++---- extras/docker/README.md | 2 +- lib/config_service.js | 31 ++++++++++++++++++++++++------- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 122725d..5bb006e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,8 +32,8 @@ RUN sed -i -r "/^(root|nobody)/!d" /etc/passwd /etc/shadow /etc/group \ # variable. # # - PEP_PROXY_USERNAME -# - PEP_PASSWORD -# - PEP_TOKEN_SECRET +# - PEP_PROXY_PASSWORD +# - PEP_PROXY_TOKEN_SECRET # ######################################################################################## @@ -80,8 +80,8 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=60s \ # PEP_PROXY_ORG_HEADER # PEP_PROXY_APP_ID # PEP_PROXY_USERNAME -# PEP_PASSWORD -# PEP_TOKEN_SECRET +# PEP_PROXY_PASSWORD +# PEP_PROXY_TOKEN_SECRET # PEP_PROXY_AUTH_ENABLED # PEP_PROXY_PDP # PEP_PROXY_AZF_PROTOCOL diff --git a/doc/admin_guide.md b/doc/admin_guide.md index b0bf9a0..c492394 100644 --- a/doc/admin_guide.md +++ b/doc/admin_guide.md @@ -430,9 +430,9 @@ overrides. | PEP_PROXY_ORG_HEADER | `organizations.header` | | PEP_PROXY_APP_ID | `pep.app_id` | | PEP_PROXY_USERNAME | `pep.username` | -| PEP_PASSWORD | `pep.password` | -| PEP_TOKEN_SECRET | `pep.token` | -| PEP_TRUSTED_APPS | `pep.trusted_apps` | +| PEP_PROXY_PASSWORD | `pep.password` | +| PEP_PROXY_TOKEN_SECRET | `pep.token` | +| PEP_PROXY_TRUSTED_APPS | `pep.trusted_apps` | | PEP_PROXY_AUTH_ENABLED | `authorization.enabled` | | PEP_PROXY_PDP | `authorization.pdp` | | PEP_PROXY_AZF_PROTOCOL | `authorization.azf.protocol` | diff --git a/extras/docker/Dockerfile b/extras/docker/Dockerfile index add07a1..0c7583c 100644 --- a/extras/docker/Dockerfile +++ b/extras/docker/Dockerfile @@ -85,8 +85,8 @@ RUN sed -i -r "/^(root|nobody)/!d" /etc/passwd /etc/shadow /etc/group \ # variable. # # - PEP_PROXY_USERNAME -# - PEP_PASSWORD -# - PEP_TOKEN_SECRET +# - PEP_PROXY_ASSWORD +# - PEP_PROXY_TOKEN_SECRET # ######################################################################################## @@ -174,8 +174,8 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=60s \ # PEP_PROXY_ORG_HEADER # PEP_PROXY_APP_ID # PEP_PROXY_USERNAME -# PEP_PASSWORD -# PEP_TOKEN_SECRET +# PEP_PROXY_PASSWORD +# PEP_PROXY_TOKEN_SECRET # PEP_PROXY_AUTH_ENABLED # PEP_PROXY_PDP # PEP_PROXY_AZF_PROTOCOL diff --git a/extras/docker/README.md b/extras/docker/README.md index cf5d3c7..25cb018 100644 --- a/extras/docker/README.md +++ b/extras/docker/README.md @@ -91,7 +91,7 @@ sudo docker run -d --name pep-proxy-container -v [host_config_file]:/opt/fiware- - `PEP_PROXY_APP_SSL_ENABLED` - default value is `false` - Use `true` if the app server listens in HTTPS - `PEP_PROXY_APP_ID` - default value is left blank and must be overridden - `PEP_PROXY_USERNAME` - default value is left blank and must be overridden -- `PEP_PASSWORD` - default value is left blank and must be overridden +- `PEP_PROXY_PASSWORD` - default value is left blank and must be overridden - `PEP_PROXY_AUTH_ENABLED` - default value is `false` - `PEP_PROXY_PDP` - default value is `idm` can be set tp `authzforce` - `PEP_PROXY_AZF_PROTOCOL` - default value is `http` diff --git a/lib/config_service.js b/lib/config_service.js index 184fc4c..ea97fac 100644 --- a/lib/config_service.js +++ b/lib/config_service.js @@ -57,9 +57,12 @@ function process_environment_variables(verbose) { 'PEP_PROXY_ORG_HEADER', 'PEP_PROXY_APP_ID', 'PEP_PROXY_USERNAME', - 'PEP_PASSWORD', - 'PEP_TOKEN_SECRET', - 'PEP_TRUSTED_APPS', + 'PEP_PROXY_PASSWORD', + 'PEP_PROXY_TOKEN_SECRET', + 'PEP_PROXY_TRUSTED_APPS', + 'PEP_PASSWORD', // Deprecated + 'PEP_TOKEN_SECRET', // Deprecated + 'PEP_TRUSTED_APPS', // Deprecated 'PEP_PROXY_AUTH_ENABLED', 'PEP_PROXY_PDP', 'PEP_PROXY_AZF_PROTOCOL', @@ -78,7 +81,15 @@ function process_environment_variables(verbose) { 'PEP_PROXY_DEBUG' ]; - const protected_variables = ['PEP_PROXY_USERNAME', 'PEP_PASSWORD', 'PEP_TOKEN_SECRET', 'PEP_TRUSTED_APPS']; + const protected_variables = [ + 'PEP_PROXY_USERNAME', + 'PEP_PROXY_PASSWORD', + 'PEP_PROXY_TOKEN_SECRET', + 'PEP_PROXY_TRUSTED_APPS', + 'PEP_PASSWORD', // Deprecated + 'PEP_TOKEN_SECRET', // Deprecated + 'PEP_TRUSTED_APPS' // Deprecated + ]; // Substitute Docker Secret Variables where set. protected_variables.forEach((key) => { @@ -154,17 +165,23 @@ function process_environment_variables(verbose) { if (process.env.PEP_PROXY_USERNAME) { config.pep.username = process.env.PEP_PROXY_USERNAME; } - if (process.env.PEP_PASSWORD) { + if (process.env.PEP_PROXY_PASSWORD) { + config.pep.password = process.env.PEP_PROXY_PASSWORD; + } else if (process.env.PEP_PASSWORD) { config.pep.password = process.env.PEP_PASSWORD; } config.pep.token = config.pep.token || {}; - if (process.env.PEP_TOKEN_SECRET) { + if (process.env.PEP_PROXY_TOKEN_SECRET) { + config.pep.token.secret = process.env.PEP_PROXY_TOKEN_SECRET; + } else if (process.env.PEP_TOKEN_SECRET) { config.pep.token.secret = process.env.PEP_TOKEN_SECRET; } config.pep.trusted_apps = config.pep.trusted_apps || []; - if (process.env.PEP_TRUSTED_APPS) { + if (process.env.PEP_PROXY_TRUSTED_APPS) { + config.pep.trusted_apps = to_array(process.env.PEP_PROXY_TRUSTED_APPS, []); + } else if (process.env.PEP_TRUSTED_APPS) { config.pep.trusted_apps = to_array(process.env.PEP_TRUSTED_APPS, []); }