@kosha-ai/integration-postgres 0.4.2 → 0.5.1
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'pg';
|
|
2
|
-
import {
|
|
2
|
+
import { assertAllowedHost, basic as basicAuth, defineIntegration, packageDirs, } from '@kosha-ai/integration-sdk';
|
|
3
3
|
const { docsPath, migrationsPath } = packageDirs(import.meta.url);
|
|
4
4
|
export class PostgresConnectionError extends Error {
|
|
5
5
|
constructor(message) {
|
|
@@ -110,7 +110,7 @@ async function withReadOnlyClient(fields, credential, fn) {
|
|
|
110
110
|
// Re-checked on every call, not only when the configuration was saved: a
|
|
111
111
|
// hostname that answered publicly yesterday can point inside the network
|
|
112
112
|
// today (DNS rebinding).
|
|
113
|
-
await
|
|
113
|
+
await assertAllowedHost(target.host);
|
|
114
114
|
let client;
|
|
115
115
|
try {
|
|
116
116
|
client = await connectClient(target);
|
package/docs/setup.md
CHANGED
|
@@ -9,14 +9,9 @@ each person who will end up running a query.
|
|
|
9
9
|
When you create the configuration, give Kosha:
|
|
10
10
|
|
|
11
11
|
- **URL** — the database host, optionally with `:port` (e.g. `db.acme.test`
|
|
12
|
-
or `db.acme.test:5432`; defaults to `5432`).
|
|
13
|
-
|
|
14
|
-
link-local address is refused
|
|
15
|
-
operator could otherwise reach inside the network Kosha runs in.
|
|
16
|
-
|
|
17
|
-
The hostname may be public or private; it only needs to resolve from the
|
|
18
|
-
Kosha server network. This supports private databases such as RDS instances
|
|
19
|
-
in the same VPC.
|
|
12
|
+
or `db.acme.test:5432`; defaults to `5432`). It may be public or private,
|
|
13
|
+
such as an RDS instance in the same VPC, as long as it resolves from the
|
|
14
|
+
Kosha server network. A link-local address (`169.254.x.x`) is refused.
|
|
20
15
|
|
|
21
16
|
- **Database** — the database name.
|
|
22
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosha-ai/integration-postgres",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Postgres integration for Kosha: read-only queries against a connected database",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kosha",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"key": "postgres"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@kosha-ai/integration-sdk": "0.
|
|
51
|
+
"@kosha-ai/integration-sdk": "0.5.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/pg": "^8.11.0",
|
|
55
|
-
"@kosha-ai/integration-sdk": "0.
|
|
55
|
+
"@kosha-ai/integration-sdk": "0.5.1"
|
|
56
56
|
}
|
|
57
57
|
}
|