@ui5/server 4.0.3 → 4.0.5

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 CHANGED
@@ -2,7 +2,19 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v4.0.3...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v4.0.5...HEAD).
6
+
7
+ <a name="v4.0.5"></a>
8
+ ## [v4.0.5] - 2024-09-11
9
+ ### Dependency Updates
10
+ - Bump path-to-regexp and router [`f713647`](https://github.com/SAP/ui5-server/commit/f713647258c89df7355c78a6c3b86817167027ed)
11
+
12
+
13
+ <a name="v4.0.4"></a>
14
+ ## [v4.0.4] - 2024-08-27
15
+ ### Bug Fixes
16
+ - Ensure SSL credentials are only readable by owner [`7220dbb`](https://github.com/SAP/ui5-server/commit/7220dbb2237dbf3104dcb88c15c1ca86b61ba49d)
17
+
6
18
 
7
19
  <a name="v4.0.3"></a>
8
20
  ## [v4.0.3] - 2024-08-09
@@ -381,6 +393,8 @@ Only Node.js v10 or higher is supported.
381
393
 
382
394
  <a name="v0.0.1"></a>
383
395
  ## v0.0.1 - 2018-06-06
396
+ [v4.0.5]: https://github.com/SAP/ui5-server/compare/v4.0.4...v4.0.5
397
+ [v4.0.4]: https://github.com/SAP/ui5-server/compare/v4.0.3...v4.0.4
384
398
  [v4.0.3]: https://github.com/SAP/ui5-server/compare/v4.0.2...v4.0.3
385
399
  [v4.0.2]: https://github.com/SAP/ui5-server/compare/v4.0.1...v4.0.2
386
400
  [v4.0.1]: https://github.com/SAP/ui5-server/compare/v4.0.0...v4.0.1
package/lib/sslUtil.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import os from "node:os";
2
- import {stat, readFile, writeFile, mkdir} from "node:fs/promises";
2
+ import {stat, readFile, writeFile, mkdir, chmod, constants} from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import {getLogger} from "@ui5/logger";
5
5
 
@@ -27,18 +27,36 @@ export function getSslCertificate(
27
27
  ) {
28
28
  // checks the certificates if they are present
29
29
  return Promise.all([
30
- fileExists(keyPath).then((bExists) => {
31
- if (!bExists) {
30
+ fileExists(keyPath).then(async (statsOrFalse) => {
31
+ if (!statsOrFalse) {
32
32
  log.verbose(`No SSL private key found at ${keyPath}`);
33
33
  return false;
34
34
  }
35
+ if (statsOrFalse.mode & constants.S_IWUSR || statsOrFalse.mode & constants.S_IROTH) {
36
+ // Note: According to the Node.js docs, "On Windows, only S_IRUSR and S_IWUSR are available"
37
+ // Therefore we first check for "writable by owner" (S_IWUSR), even though we are more interested in
38
+ // "readable by others", which we still check on platforms where it's supported
39
+ log.verbose(`Detected outdated file permissions for private key file at ${keyPath}. ` +
40
+ `Fixing permissions...`);
41
+ await chmod(keyPath, 0o400).catch((err) => {
42
+ log.error(`Failed to update permissions of private key file at ${keyPath}: ${err}`);
43
+ });
44
+ }
35
45
  return readFile(keyPath);
36
46
  }),
37
- fileExists(certPath).then((bExists) => {
38
- if (!bExists) {
47
+ fileExists(certPath).then(async (statsOrFalse) => {
48
+ if (!statsOrFalse) {
39
49
  log.verbose(`No SSL certificate found at ${certPath}`);
40
50
  return false;
41
51
  }
52
+
53
+ if (statsOrFalse.mode & constants.S_IWUSR || statsOrFalse.mode & constants.S_IROTH) {
54
+ log.verbose(`Detected outdated file permissions for certificate file at ${keyPath}. ` +
55
+ `Fixing permissions...`);
56
+ await chmod(certPath, 0o400).catch((err) => {
57
+ log.error(`Failed to update permissions of certificate file at ${certPath}: ${err}`);
58
+ });
59
+ }
42
60
  return readFile(certPath);
43
61
  })
44
62
  ]).then(function([key, cert]) {
@@ -84,14 +102,14 @@ async function createAndInstallCertificate(keyPath, certPath) {
84
102
  await Promise.all([
85
103
  // Write certificates to the ui5 certificate folder
86
104
  // such that they are used by default upon next startup
87
- mkdir(path.dirname(keyPath), {recursive: true}).then(() => writeFile(keyPath, key)),
88
- mkdir(path.dirname(certPath), {recursive: true}).then(() => writeFile(certPath, cert))
105
+ mkdir(path.dirname(keyPath), {recursive: true}).then(() => writeFile(keyPath, key, {mode: 0o400})),
106
+ mkdir(path.dirname(certPath), {recursive: true}).then(() => writeFile(certPath, cert, {mode: 0o400}))
89
107
  ]);
90
108
  return {key, cert};
91
109
  }
92
110
 
93
111
  function fileExists(filePath) {
94
- return stat(filePath).then(() => true, (err) => {
112
+ return stat(filePath).then((s) => s, (err) => {
95
113
  if (err.code === "ENOENT") { // "File or directory does not exist"
96
114
  return false;
97
115
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/server",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "UI5 Tooling - Server",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -117,8 +117,8 @@
117
117
  "url": "git@github.com:SAP/ui5-server.git"
118
118
  },
119
119
  "dependencies": {
120
- "@ui5/builder": "^4.0.1",
121
- "@ui5/fs": "^4.0.0",
120
+ "@ui5/builder": "^4.0.3",
121
+ "@ui5/fs": "^4.0.1",
122
122
  "@ui5/logger": "^4.0.1",
123
123
  "body-parser": "^1.20.2",
124
124
  "compression": "^1.7.4",
@@ -126,37 +126,37 @@
126
126
  "devcert-sanscache": "^0.5.1",
127
127
  "escape-html": "^1.0.3",
128
128
  "etag": "^1.8.1",
129
- "express": "^4.19.2",
129
+ "express": "^4.20.0",
130
130
  "fresh": "^0.5.2",
131
131
  "graceful-fs": "^4.2.11",
132
132
  "mime-types": "^2.1.35",
133
133
  "parseurl": "^1.3.3",
134
134
  "portscanner": "^2.2.0",
135
135
  "replacestream": "^4.0.3",
136
- "router": "^1.3.8",
136
+ "router": "^2.0.0",
137
137
  "spdy": "^4.0.2",
138
138
  "yesno": "^0.4.0"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@eslint/js": "^9.8.0",
142
142
  "@istanbuljs/esm-loader-hook": "^0.2.0",
143
- "@ui5/project": "^4.0.2",
143
+ "@ui5/project": "^4.0.3",
144
144
  "ava": "^6.1.3",
145
145
  "chokidar-cli": "^3.0.0",
146
146
  "cross-env": "^7.0.3",
147
147
  "depcheck": "^1.4.7",
148
148
  "docdash": "^2.0.2",
149
- "eslint": "^9.8.0",
149
+ "eslint": "^9.10.0",
150
150
  "eslint-config-google": "^0.14.0",
151
151
  "eslint-plugin-ava": "^15.0.1",
152
- "eslint-plugin-jsdoc": "^48.11.0",
152
+ "eslint-plugin-jsdoc": "^50.2.2",
153
153
  "esmock": "^2.6.7",
154
154
  "globals": "^15.9.0",
155
155
  "jsdoc": "^4.0.3",
156
156
  "nyc": "^17.0.0",
157
157
  "open-cli": "^8.0.0",
158
158
  "rimraf": "^6.0.1",
159
- "sinon": "^18.0.0",
159
+ "sinon": "^18.0.1",
160
160
  "supertest": "^7.0.0",
161
161
  "tap-xunit": "^2.4.1"
162
162
  }