Skip to content

Commit

Permalink
replace dependancy 'entities' with 'html-entities'
Browse files Browse the repository at this point in the history
This is due to licensing consern. 'html-entities' is distributed with the MIT license .
  • Loading branch information
SiCoe committed Oct 2, 2023
1 parent c5fc6c4 commit 185bfdb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
8 changes: 4 additions & 4 deletions authn/openid.index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const auth = require('./auth.js');
const nonce = require('./nonce.js');
const axios = require('axios');
const url = require('url');
const entities = require('entities');
const entities = require('html-entities');

var discoveryDocument;
var jwks;
Expand Down Expand Up @@ -337,9 +337,9 @@ function unauthorized(error, error_description, error_uri, callback) {
</html>
`;

page = page.replace(/%error%/g, entities.encodeHTML(error));
page = page.replace(/%error_description%/g, entities.encodeHTML(error_description));
page = page.replace(/%error_uri%/g, entities.encodeHTML(error_uri));
page = page.replace(/%error%/g, entities.encode(error));
page = page.replace(/%error_description%/g, entities.encode(error_description));
page = page.replace(/%error_uri%/g, entities.encode(error_uri));

// Unauthorized access attempt. Reset token and nonce cookies
const response = {
Expand Down
8 changes: 4 additions & 4 deletions authn/pkce.index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const codeChallenge = require('./code-challenge.js');
const cfg = require('./config.js');
const axios = require('axios');
const url = require('url');
const entities = require('entities');
const entities = require('html-entities');

var discoveryDocument;
var jwks;
Expand Down Expand Up @@ -364,9 +364,9 @@ function unauthorized(error, error_description, error_uri, callback) {
</html>
`;

page = page.replace(/%error%/g, entities.encodeHTML(error));
page = page.replace(/%error_description%/g, entities.encodeHTML(error_description));
page = page.replace(/%error_uri%/g, entities.encodeHTML(error_uri));
page = page.replace(/%error%/g, entities.encode(error));
page = page.replace(/%error_description%/g, entities.encode(error_description));
page = page.replace(/%error_uri%/g, entities.encode(error_uri));

// Unauthorized access attempt. Reset token and nonce cookies
const response = {
Expand Down
38 changes: 21 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"dependencies": {
"axios": "^0.21.1",
"cookie": "^0.3.1",
"entities": "^4.5.0",
"es6-dynamic-template": "^2.0.0",
"html-entities": "^2.4.0",
"jsonwebtoken": "^8.1.0",
"jwk-to-pem": "^1.2.6",
"nonce": "^1.0.4",
Expand Down

0 comments on commit 185bfdb

Please sign in to comment.