Skip to content

Commit

Permalink
Merge pull request #62 from braintree/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
jplukarski authored Sep 6, 2023
2 parents 32c1f1e + 99c3d6e commit 105c386
Show file tree
Hide file tree
Showing 8 changed files with 1,196 additions and 1,373 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"
node-version: "18.x"
- run: npm install
- run: npm test
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CHANGELOG

# Unreleased

- Move constant declarations from index file to `constants.ts` file
- Update to node v18

- Dev Dependency Updates
- Update to TypeScript 5
- Other minor dependency updates

## 6.0.4

- Add additional null byte sanitization prior to html decoding (#48)
Expand Down
2,519 changes: 1,162 additions & 1,357 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"devDependencies": {
"@types/jest": "^29.4.0",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@vitest/coverage-v8": "^0.33.0",
"@vitest/coverage-v8": "^0.34.2",
"chai": "^4.3.7",
"eslint": "^8.36.0",
"eslint-config-braintree": "^6.0.0-typescript-prep-rc.2",
"eslint-plugin-prettier": "^4.2.1",
"happy-dom": "^10.5.2",
"happy-dom": "^10.10.4",
"prettier": "^2.8.4",
"typescript": "^4.9.5",
"vitest": "^0.33.0"
"typescript": "^5.1.6",
"vitest": "^0.34.2"
}
}
3 changes: 2 additions & 1 deletion src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-script-url */
import { sanitizeUrl, BLANK_URL } from "..";
import { sanitizeUrl } from "..";
import { BLANK_URL } from "../constants";

describe("sanitizeUrl", () => {
it("does not alter http URLs with alphanumeric characters", () => {
Expand Down
8 changes: 8 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
export const htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
export const htmlCtrlEntityRegex = /&(newline|tab);/gi;
export const ctrlCharactersRegex =
/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
export const urlSchemeRegex = /^.+(:|:)/gim;
export const relativeFirstCharacters = [".", "/"];
export const BLANK_URL = "about:blank";
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
const htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
const htmlCtrlEntityRegex = /&(newline|tab);/gi;
const ctrlCharactersRegex =
/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
const urlSchemeRegex = /^.+(:|:)/gim;
const relativeFirstCharacters = [".", "/"];

export const BLANK_URL = "about:blank";
import {
BLANK_URL,
ctrlCharactersRegex,
htmlCtrlEntityRegex,
htmlEntitiesRegex,
invalidProtocolRegex,
relativeFirstCharacters,
urlSchemeRegex,
} from "./constants";

function isRelativeUrlWithoutProtocol(url: string): boolean {
return relativeFirstCharacters.indexOf(url[0]) > -1;
Expand Down

0 comments on commit 105c386

Please sign in to comment.