@prenta/platform-aws 1.0.1 → 1.0.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 +12 -0
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +3 -1
- package/dist/database.js.map +1 -1
- package/dist/pg-ssl-mode.d.ts +28 -0
- package/dist/pg-ssl-mode.d.ts.map +1 -0
- package/dist/pg-ssl-mode.js +56 -0
- package/dist/pg-ssl-mode.js.map +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @actuate-media/platform-aws
|
|
2
2
|
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d18a823: The RDS database adapter now rewrites `sslmode=require`, `prefer` and `verify-ca` to `verify-full` before connecting, which stops pg's SECURITY WARNING and keeps full certificate verification under pg 9.
|
|
8
|
+
|
|
9
|
+
## 1.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5230917: Point repository links at github.com/Prenta-dev/prenta, where the source now lives. The `repository` field on npm, the importer adapters' docs links, the section editor's help link and the docs link `create-prenta` prints all moved from `actuate-media/prenta`. No behaviour changes.
|
|
14
|
+
|
|
3
15
|
## 1.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/database.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAenD,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,EAAE,OAAO,GAAG;QAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7D,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAUD,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,eAAe,CAsEjF"}
|
package/dist/database.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withExplicitSslMode } from './pg-ssl-mode.js';
|
|
1
2
|
export function createRdsAdapter(options = {}) {
|
|
2
3
|
const connectionString = options.connectionString ?? process.env.DATABASE_URL ?? '';
|
|
3
4
|
let pool = null;
|
|
@@ -30,7 +31,8 @@ export function createRdsAdapter(options = {}) {
|
|
|
30
31
|
pg.Pool);
|
|
31
32
|
const ssl = await resolveSsl();
|
|
32
33
|
pool = new Pool({
|
|
33
|
-
|
|
34
|
+
// `resolveSsl` reads the string as given; pg gets the explicit mode.
|
|
35
|
+
connectionString: withExplicitSslMode(connectionString),
|
|
34
36
|
...(options.max !== undefined ? { max: options.max } : {}),
|
|
35
37
|
...(ssl ? { ssl } : {}),
|
|
36
38
|
});
|
package/dist/database.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AA0CtD,MAAM,UAAU,gBAAgB,CAAC,UAA6B,EAAE;IAC9D,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAA;IAEnF,IAAI,IAAI,GAAkB,IAAI,CAAA;IAE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ca` as aliases
|
|
5
|
+
* for `verify-full`, and logs a SECURITY WARNING the first time it parses
|
|
6
|
+
* one, to say that `pg` 9 will weaken them to libpq's meaning (no
|
|
7
|
+
* certificate verification for `require`). Hosted providers hand out
|
|
8
|
+
* `sslmode=require` strings, so the warning shows up on every cold start.
|
|
9
|
+
*
|
|
10
|
+
* Rewriting those modes to `verify-full` asks for exactly what `pg` 8
|
|
11
|
+
* already does: the warning stops, and full certificate verification stays
|
|
12
|
+
* when `pg` 9 arrives.
|
|
13
|
+
*
|
|
14
|
+
* A string that opts in to libpq semantics with `uselibpqcompat=true` is
|
|
15
|
+
* left alone, as is one with no `sslmode`, `sslmode=disable` or
|
|
16
|
+
* `sslmode=no-verify`.
|
|
17
|
+
*
|
|
18
|
+
* The query is read the way `pg` reads it: names and values are
|
|
19
|
+
* percent-decoded, and the last of a repeated parameter wins. Only the one
|
|
20
|
+
* `sslmode` segment that takes effect is replaced; every other character,
|
|
21
|
+
* credentials included, is returned as it was given.
|
|
22
|
+
*
|
|
23
|
+
* A copy of `packages/cms-core/src/db/pg-ssl-mode.ts`. Core keeps the helper
|
|
24
|
+
* internal, and `@prenta/platform-aws` supports `@prenta/core` versions that
|
|
25
|
+
* do not have it, so it cannot import it from core. Keep the copies in step.
|
|
26
|
+
*/
|
|
27
|
+
export declare function withExplicitSslMode<T extends string | undefined>(connectionString: T): T;
|
|
28
|
+
//# sourceMappingURL=pg-ssl-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pg-ssl-mode.d.ts","sourceRoot":"","sources":["../src/pg-ssl-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,EAAE,gBAAgB,EAAE,CAAC,GAAG,CAAC,CAyBxF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make a Postgres connection string's TLS mode explicit.
|
|
3
|
+
*
|
|
4
|
+
* `pg` 8 treats `sslmode=prefer`, `require` and `verify-ca` as aliases
|
|
5
|
+
* for `verify-full`, and logs a SECURITY WARNING the first time it parses
|
|
6
|
+
* one, to say that `pg` 9 will weaken them to libpq's meaning (no
|
|
7
|
+
* certificate verification for `require`). Hosted providers hand out
|
|
8
|
+
* `sslmode=require` strings, so the warning shows up on every cold start.
|
|
9
|
+
*
|
|
10
|
+
* Rewriting those modes to `verify-full` asks for exactly what `pg` 8
|
|
11
|
+
* already does: the warning stops, and full certificate verification stays
|
|
12
|
+
* when `pg` 9 arrives.
|
|
13
|
+
*
|
|
14
|
+
* A string that opts in to libpq semantics with `uselibpqcompat=true` is
|
|
15
|
+
* left alone, as is one with no `sslmode`, `sslmode=disable` or
|
|
16
|
+
* `sslmode=no-verify`.
|
|
17
|
+
*
|
|
18
|
+
* The query is read the way `pg` reads it: names and values are
|
|
19
|
+
* percent-decoded, and the last of a repeated parameter wins. Only the one
|
|
20
|
+
* `sslmode` segment that takes effect is replaced; every other character,
|
|
21
|
+
* credentials included, is returned as it was given.
|
|
22
|
+
*
|
|
23
|
+
* A copy of `packages/cms-core/src/db/pg-ssl-mode.ts`. Core keeps the helper
|
|
24
|
+
* internal, and `@prenta/platform-aws` supports `@prenta/core` versions that
|
|
25
|
+
* do not have it, so it cannot import it from core. Keep the copies in step.
|
|
26
|
+
*/
|
|
27
|
+
export function withExplicitSslMode(connectionString) {
|
|
28
|
+
if (!connectionString)
|
|
29
|
+
return connectionString;
|
|
30
|
+
const queryStart = connectionString.indexOf('?');
|
|
31
|
+
if (queryStart === -1)
|
|
32
|
+
return connectionString;
|
|
33
|
+
const base = connectionString.slice(0, queryStart);
|
|
34
|
+
const afterQuestionMark = connectionString.slice(queryStart + 1);
|
|
35
|
+
const fragmentStart = afterQuestionMark.indexOf('#');
|
|
36
|
+
const query = fragmentStart === -1 ? afterQuestionMark : afterQuestionMark.slice(0, fragmentStart);
|
|
37
|
+
const fragment = fragmentStart === -1 ? '' : afterQuestionMark.slice(fragmentStart);
|
|
38
|
+
const params = new URLSearchParams(query);
|
|
39
|
+
// pg honours this flag only as the exact value "true".
|
|
40
|
+
if (params.getAll('uselibpqcompat').pop() === 'true')
|
|
41
|
+
return connectionString;
|
|
42
|
+
const mode = params.getAll('sslmode').pop();
|
|
43
|
+
if (mode !== 'prefer' && mode !== 'require' && mode !== 'verify-ca')
|
|
44
|
+
return connectionString;
|
|
45
|
+
const segments = query.split('&');
|
|
46
|
+
let effective = -1;
|
|
47
|
+
segments.forEach((segment, index) => {
|
|
48
|
+
if (new URLSearchParams(segment).has('sslmode'))
|
|
49
|
+
effective = index;
|
|
50
|
+
});
|
|
51
|
+
if (effective === -1)
|
|
52
|
+
return connectionString;
|
|
53
|
+
segments[effective] = 'sslmode=verify-full';
|
|
54
|
+
return (base + '?' + segments.join('&') + fragment);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=pg-ssl-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pg-ssl-mode.js","sourceRoot":"","sources":["../src/pg-ssl-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,mBAAmB,CAA+B,gBAAmB;IACnF,IAAI,CAAC,gBAAgB;QAAE,OAAO,gBAAgB,CAAA;IAC9C,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAChD,IAAI,UAAU,KAAK,CAAC,CAAC;QAAE,OAAO,gBAAgB,CAAA;IAE9C,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAA;IAClD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;IAChE,MAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACpD,MAAM,KA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1
1
|
{
|
|
2
2
|
"name": "@prenta/platform-aws",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/Prenta-dev/prenta.git",
|
|
8
8
|
"directory": "packages/platform-aws"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"ioredis": "^5.4.2",
|
|
58
58
|
"pg": "^8.20.0",
|
|
59
59
|
"typescript": "^5.7.0",
|
|
60
|
-
"vitest": "^4.1.
|
|
61
|
-
"@prenta/core": "8.
|
|
60
|
+
"vitest": "^4.1.12",
|
|
61
|
+
"@prenta/core": "8.21.12"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "tsc -p tsconfig.build.json",
|