Skip to content

Commit c8f2b12

Browse files
authored
Merge branch 'main' into upstream-server-fixes
2 parents e022788 + 31d5823 commit c8f2b12

File tree

6 files changed

+45
-19
lines changed

6 files changed

+45
-19
lines changed

ci/helm-chart/values.yaml

-12
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ podAnnotations: {}
2828
podSecurityContext: {}
2929
# fsGroup: 2000
3030

31-
securityContext: {}
32-
# capabilities:
33-
# drop:
34-
# - ALL
35-
# readOnlyRootFilesystem: true
36-
# runAsNonRoot: true
37-
# runAsUser: 1000
38-
3931
service:
4032
type: ClusterIP
4133
port: 8080
@@ -127,10 +119,6 @@ persistence:
127119
# existingClaim: ""
128120
# hostPath: /data
129121

130-
serviceAccount:
131-
create: true
132-
name:
133-
134122
## Enable an Specify container in extraContainers.
135123
## This is meant to allow adding code-server dependencies, like docker-dind.
136124
extraContainers: |

docs/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ access it in the browser.
1414
- Preserve battery life when you're on the go; all intensive tasks run on your
1515
server
1616

17+
| 🔔 code-server is a free browser-based IDE while [Coder](https://coder.com/), is our enterprise developer workspace platform. For more information, visit [Coder.com](https://coder.com/docs/comparison)
18+
| ---
19+
1720
## Requirements
1821

1922
See [requirements](requirements.md) for minimum specs, as well as instructions

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"proxy-agent": "^5.0.0",
9595
"proxy-from-env": "^1.1.0",
9696
"qs": "6.10.1",
97-
"rotating-file-stream": "^2.1.1",
97+
"rotating-file-stream": "^3.0.0",
9898
"safe-buffer": "^5.1.1",
9999
"safe-compare": "^1.1.4",
100100
"semver": "^7.1.3",

src/node/routes/errors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { WebsocketRequest } from "../../../typings/pluginapi"
66
import { HttpCode } from "../../common/http"
77
import { rootPath } from "../constants"
88
import { replaceTemplates } from "../http"
9-
import { getMediaMime } from "../util"
9+
import { escapeHtml, getMediaMime } from "../util"
1010

1111
const notFoundCodes = ["ENOENT", "EISDIR"]
1212
export const errorHandler: express.ErrorRequestHandler = async (err, req, res, next) => {
@@ -29,7 +29,7 @@ export const errorHandler: express.ErrorRequestHandler = async (err, req, res, n
2929
replaceTemplates(req, content)
3030
.replace(/{{ERROR_TITLE}}/g, status)
3131
.replace(/{{ERROR_HEADER}}/g, status)
32-
.replace(/{{ERROR_BODY}}/g, err.message),
32+
.replace(/{{ERROR_BODY}}/g, escapeHtml(err.message)),
3333
)
3434
} else {
3535
res.json({

test/unit/node/routes/errors.test.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import express from "express"
2+
import { errorHandler } from "../../../../src/node/routes/errors"
3+
4+
describe("error page is rendered for text/html requests", () => {
5+
it("escapes any html in the error messages", async () => {
6+
const next = jest.fn()
7+
const err = {
8+
code: "ENOENT",
9+
statusCode: 404,
10+
message: ";>hello<script>alert(1)</script>",
11+
}
12+
const req = createRequest()
13+
const res = {
14+
status: jest.fn().mockReturnValue(this),
15+
send: jest.fn().mockReturnValue(this),
16+
set: jest.fn().mockReturnValue(this),
17+
} as unknown as express.Response
18+
19+
await errorHandler(err, req, res, next)
20+
expect(res.status).toHaveBeenCalledWith(404)
21+
expect(res.send).toHaveBeenCalledWith(expect.not.stringContaining("<script>"))
22+
})
23+
})
24+
25+
function createRequest(): express.Request {
26+
return {
27+
headers: {
28+
accept: ["text/html"],
29+
},
30+
originalUrl: "http://example.com/test",
31+
query: {
32+
to: "test",
33+
},
34+
} as unknown as express.Request
35+
}

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -3701,10 +3701,10 @@ rimraf@^3.0.2:
37013701
dependencies:
37023702
glob "^7.1.3"
37033703

3704-
rotating-file-stream@^2.1.1:
3705-
version "2.1.5"
3706-
resolved "https://registry.yarnpkg.com/rotating-file-stream/-/rotating-file-stream-2.1.5.tgz#6490d0a09e11dd4d441aa5d4d3676debed4a44e4"
3707-
integrity sha512-wnYazkT8oD5HXTj44WhB030aKo74OyICrPz/QKCUah59QD7Np4OhdoTC0WNZfhMx1ClsZp4lYMlAdof+DIkZ1Q==
3704+
rotating-file-stream@^3.0.0:
3705+
version "3.0.0"
3706+
resolved "https://registry.yarnpkg.com/rotating-file-stream/-/rotating-file-stream-3.0.0.tgz#5193da921808dc98e1e60595fb2f32d33d622884"
3707+
integrity sha512-qKk1AAjrKxFYIqRU/GBSzwMLM7wqHYxztKXk7h55728n5EU2sKlPNlcXjqfbK11TiOUZChbtAHDCDIGCE6cg5g==
37083708

37093709
37103710
version "2.0.0-alpha.1"

0 commit comments

Comments
 (0)