@checkstack/backend-api 0.15.1 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/package.json +7 -7
- package/src/markdown.test.ts +15 -0
- package/src/markdown.ts +16 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# @checkstack/backend-api
|
|
2
2
|
|
|
3
|
+
## 0.15.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1909a61: Address open CodeQL code-scanning findings:
|
|
8
|
+
|
|
9
|
+
- **`@checkstack/ui` (`LinksEditor`)**: validate URL scheme on render and on
|
|
10
|
+
add; only `http:` / `https:` URLs are accepted, defeating stored XSS via
|
|
11
|
+
`javascript:` / `data:` schemes in user-supplied hotlinks
|
|
12
|
+
(`js/xss-through-dom`).
|
|
13
|
+
- **`@checkstack/backend-api` (`markdownToPlainText`)**: decode HTML entities
|
|
14
|
+
before stripping tags, then strip tags in a loop until the output
|
|
15
|
+
stabilizes. Decoding `&` last avoids reintroducing tag delimiters
|
|
16
|
+
via `<` round-trips (`js/double-escaping`,
|
|
17
|
+
`js/incomplete-multi-character-sanitization`).
|
|
18
|
+
- **`@checkstack/backend` (`createScopedWsRegistry`)**: drop the
|
|
19
|
+
identity-replacement on the path suffix; the leading-slash invariant
|
|
20
|
+
is documented on `WebSocketRouteRegistry` (`js/identity-replacement`).
|
|
21
|
+
|
|
22
|
+
- b33fb4d: Refresh `bun.lock` to clear MEDIUM-severity Trivy advisories on transitive
|
|
23
|
+
runtime dependencies. No public API change — bumping every workspace
|
|
24
|
+
package that lists `@orpc/server` as a direct dep so consumers re-resolve
|
|
25
|
+
the optional `ws` peer to the patched release on their next install.
|
|
26
|
+
|
|
27
|
+
- `ws` `8.20.0` → `8.20.1` (CVE-2026-45736). Pulled into the install tree
|
|
28
|
+
as `@orpc/server`'s optional WebSocket peer; Bun auto-installs it into
|
|
29
|
+
every backend package that depends on `@orpc/server`, so a stale 8.20.0
|
|
30
|
+
ships in the consumer's `node_modules` until the parent package
|
|
31
|
+
re-resolves.
|
|
32
|
+
- `brace-expansion` `5.0.5` → `5.0.6` (CVE-2026-45149). Pulled in only
|
|
33
|
+
through dev tooling (`minimatch@10` via `@typescript-eslint` and
|
|
34
|
+
`storybook`'s `glob@13`), so it does not ship to consumers and no
|
|
35
|
+
workspace `package.json` lists it; the lockfile bump alone clears the
|
|
36
|
+
finding for the Docker image and the local dev tree. No version bump
|
|
37
|
+
is attributed to this advisory.
|
|
38
|
+
|
|
39
|
+
The fix lives entirely in `bun.lock` — no `package.json`, `overrides`, or
|
|
40
|
+
`resolutions` change is needed because both parent ranges (`minimatch@10
|
|
41
|
+
→ brace-expansion@^5.0.5`, `@orpc/server / storybook / happy-dom →
|
|
42
|
+
ws@>=8.18.x`) already accept the patched releases, and `bun install`
|
|
43
|
+
keeps the resolved versions sticky after the initial `bun update`.
|
|
44
|
+
|
|
45
|
+
- @checkstack/cache-api@0.3.2
|
|
46
|
+
- @checkstack/queue-api@0.3.2
|
|
47
|
+
|
|
48
|
+
## 0.15.2
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [9016526]
|
|
53
|
+
- @checkstack/common@0.10.0
|
|
54
|
+
- @checkstack/healthcheck-common@1.1.0
|
|
55
|
+
- @checkstack/signal-common@0.2.3
|
|
56
|
+
- @checkstack/cache-api@0.3.1
|
|
57
|
+
- @checkstack/queue-api@0.3.1
|
|
58
|
+
|
|
3
59
|
## 0.15.1
|
|
4
60
|
|
|
5
61
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/backend-api",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"license": "Elastic-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"lint:code": "eslint . --max-warnings 0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@checkstack/common": "0.
|
|
14
|
-
"@checkstack/healthcheck-common": "1.0
|
|
15
|
-
"@checkstack/cache-api": "0.
|
|
16
|
-
"@checkstack/queue-api": "0.
|
|
17
|
-
"@checkstack/signal-common": "0.2.
|
|
13
|
+
"@checkstack/common": "0.10.0",
|
|
14
|
+
"@checkstack/healthcheck-common": "1.1.0",
|
|
15
|
+
"@checkstack/cache-api": "0.3.1",
|
|
16
|
+
"@checkstack/queue-api": "0.3.1",
|
|
17
|
+
"@checkstack/signal-common": "0.2.3",
|
|
18
18
|
"@orpc/client": "^1.13.14",
|
|
19
19
|
"@orpc/contract": "^1.13.14",
|
|
20
20
|
"@orpc/openapi": "^1.13.2",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/bun": "latest",
|
|
30
30
|
"@checkstack/tsconfig": "0.0.7",
|
|
31
|
-
"@checkstack/scripts": "0.3.
|
|
31
|
+
"@checkstack/scripts": "0.3.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"hono": "^4.12.14",
|
package/src/markdown.test.ts
CHANGED
|
@@ -76,6 +76,21 @@ describe("markdownToPlainText", () => {
|
|
|
76
76
|
const result = markdownToPlainText("A & B");
|
|
77
77
|
expect(result).toBe("A & B");
|
|
78
78
|
});
|
|
79
|
+
|
|
80
|
+
it("does not double-unescape < back into a tag delimiter", () => {
|
|
81
|
+
// Without ordering the & decode last, `&lt;` would become `<`
|
|
82
|
+
// after entity decoding, reintroducing a control character.
|
|
83
|
+
const result = markdownToPlainText("A &lt; B");
|
|
84
|
+
expect(result).toBe("A < B");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("strips nested tag attempts in raw HTML", () => {
|
|
88
|
+
// marked passes raw HTML through; the tag stripper must loop until
|
|
89
|
+
// stable so nested constructs cannot leak through.
|
|
90
|
+
const result = markdownToPlainText("<<script>script>alert(1)</script>");
|
|
91
|
+
expect(result).not.toContain("<script");
|
|
92
|
+
expect(result).not.toContain("</script");
|
|
93
|
+
});
|
|
79
94
|
});
|
|
80
95
|
|
|
81
96
|
describe("markdownToSlackMrkdwn", () => {
|
package/src/markdown.ts
CHANGED
|
@@ -47,17 +47,26 @@ export function markdownToPlainText(markdown: string): string {
|
|
|
47
47
|
// Convert to HTML first, then strip tags
|
|
48
48
|
const html = markdownToHtml(markdown);
|
|
49
49
|
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
text =
|
|
55
|
-
.replaceAll("&", "&")
|
|
50
|
+
// Decode HTML entities FIRST so any escaped markup like `<script>`
|
|
51
|
+
// is exposed to the tag stripper in the next pass. `&` must be
|
|
52
|
+
// decoded last; otherwise `&lt;` would round-trip to `<` and
|
|
53
|
+
// reintroduce a control character (CodeQL js/double-escaping).
|
|
54
|
+
let text = html
|
|
56
55
|
.replaceAll("<", "<")
|
|
57
56
|
.replaceAll(">", ">")
|
|
58
57
|
.replaceAll(""", '"')
|
|
59
58
|
.replaceAll("'", "'")
|
|
60
|
-
.replaceAll(" ", " ")
|
|
59
|
+
.replaceAll(" ", " ")
|
|
60
|
+
.replaceAll("&", "&");
|
|
61
|
+
|
|
62
|
+
// Strip HTML tags. Loop until the output stabilizes so adversarial inputs
|
|
63
|
+
// like `<scr<script>ipt>` cannot leave a residual `<script>` substring
|
|
64
|
+
// after a single pass (CodeQL js/incomplete-multi-character-sanitization).
|
|
65
|
+
let previous: string;
|
|
66
|
+
do {
|
|
67
|
+
previous = text;
|
|
68
|
+
text = text.replaceAll(/<[^>]*>/g, "");
|
|
69
|
+
} while (text !== previous);
|
|
61
70
|
|
|
62
71
|
// Collapse multiple whitespace/newlines
|
|
63
72
|
text = text.replaceAll(/\n\s*\n/g, "\n").trim();
|