@abapify/adt-auth 0.4.45 → 0.4.46
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/dist/utils/env.mjs +1 -1
- package/dist/utils/env.mjs.map +1 -1
- package/package.json +2 -2
package/dist/utils/env.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
13
13
|
function readServiceKey(filePath) {
|
|
14
14
|
const trimmed = filePath.trim();
|
|
15
15
|
if (trimmed.startsWith("{")) throw new Error("Expected a path to a JSON file, but received a raw JSON string.\nWrite the service key JSON to a file and pass the file path instead.\nExample: /path/to/service-key.json");
|
|
16
|
-
if (
|
|
16
|
+
if (/\\.\\./.test(trimmed)) throw new Error("Service key path must not contain path traversal segments");
|
|
17
17
|
if (!existsSync(trimmed)) throw new Error(`Service key file not found: ${trimmed}`);
|
|
18
18
|
const raw = readFileSync(trimmed, "utf-8");
|
|
19
19
|
return ServiceKeyParser.parse(raw);
|
package/dist/utils/env.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.mjs","names":[],"sources":["../../src/utils/env.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs';\nimport type { Destination } from '../auth-manager';\nimport { ServiceKeyParser, type BTPServiceKey } from '../types/service-key';\n\n/**\n * Read a BTP service key from a file path.\n *\n * @param filePath - Path to a JSON file containing the BTP service key\n * @returns Parsed and validated `BTPServiceKey`\n * @throws Error if the input looks like raw JSON (a file path is required)\n * @throws Error if the file does not exist\n */\nexport function readServiceKey(filePath: string): BTPServiceKey {\n const trimmed = filePath.trim();\n\n if (trimmed.startsWith('{')) {\n throw new Error(\n 'Expected a path to a JSON file, but received a raw JSON string.\\n' +\n 'Write the service key JSON to a file and pass the file path instead.\\n' +\n 'Example: /path/to/service-key.json',\n );\n }\n\n if (
|
|
1
|
+
{"version":3,"file":"env.mjs","names":[],"sources":["../../src/utils/env.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs';\nimport type { Destination } from '../auth-manager';\nimport { ServiceKeyParser, type BTPServiceKey } from '../types/service-key';\n\n/**\n * Read a BTP service key from a file path.\n *\n * @param filePath - Path to a JSON file containing the BTP service key\n * @returns Parsed and validated `BTPServiceKey`\n * @throws Error if the input looks like raw JSON (a file path is required)\n * @throws Error if the file does not exist\n */\nexport function readServiceKey(filePath: string): BTPServiceKey {\n const trimmed = filePath.trim();\n\n if (trimmed.startsWith('{')) {\n throw new Error(\n 'Expected a path to a JSON file, but received a raw JSON string.\\n' +\n 'Write the service key JSON to a file and pass the file path instead.\\n' +\n 'Example: /path/to/service-key.json',\n );\n }\n\n if (/\\\\.\\\\./.test(trimmed)) {\n throw new Error(\n 'Service key path must not contain path traversal segments',\n );\n }\n\n if (!existsSync(trimmed)) {\n throw new Error(`Service key file not found: ${trimmed}`);\n }\n\n const raw = readFileSync(trimmed, 'utf-8');\n return ServiceKeyParser.parse(raw);\n}\n\n/**\n * Resolves a service key destination from the `ADT_SERVICE_KEY` environment\n * variable.\n *\n * The value can be a path to a JSON file or a raw JSON string (for backward\n * compatibility with CI pipelines that store the key as a secret JSON value).\n *\n * @returns A `Destination` object for the service-key plugin, or `null` if\n * `ADT_SERVICE_KEY` is not set.\n */\nexport function resolveServiceKeyFromEnv(): Destination | null {\n const raw = process.env['ADT_SERVICE_KEY'];\n\n if (!raw) {\n return null;\n }\n\n const trimmed = raw.trim();\n\n // Accept both a raw JSON string and a file path so that CI environments that\n // store the key as a secret JSON value continue to work without changes.\n let serviceKey: BTPServiceKey;\n if (trimmed.startsWith('{')) {\n serviceKey = ServiceKeyParser.parse(trimmed);\n } else {\n serviceKey = readServiceKey(trimmed);\n }\n\n return {\n type: '@abapify/adt-auth/plugins/service-key',\n options: {\n url: serviceKey.url,\n serviceKey,\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,eAAe,UAAiC;CAC9D,MAAM,UAAU,SAAS,KAAK;CAE9B,IAAI,QAAQ,WAAW,GAAG,GACxB,MAAM,IAAI,MACR,2KAGF;CAGF,IAAI,SAAS,KAAK,OAAO,GACvB,MAAM,IAAI,MACR,2DACF;CAGF,IAAI,CAAC,WAAW,OAAO,GACrB,MAAM,IAAI,MAAM,+BAA+B,SAAS;CAG1D,MAAM,MAAM,aAAa,SAAS,OAAO;CACzC,OAAO,iBAAiB,MAAM,GAAG;AACnC;;;;;;;;;;;AAYA,SAAgB,2BAA+C;CAC7D,MAAM,MAAM,QAAQ,IAAI;CAExB,IAAI,CAAC,KACH,OAAO;CAGT,MAAM,UAAU,IAAI,KAAK;CAIzB,IAAI;CACJ,IAAI,QAAQ,WAAW,GAAG,GACxB,aAAa,iBAAiB,MAAM,OAAO;MAE3C,aAAa,eAAe,OAAO;CAGrC,OAAO;EACL,MAAM;EACN,SAAS;GACP,KAAK,WAAW;GAChB;EACF;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.4.
|
|
6
|
+
"version": "0.4.46",
|
|
7
7
|
"description": "Authentication package for SAP ADT systems - supports multiple auth methods",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"types": "./dist/index.d.mts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"README.md"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@abapify/logger": "0.4.
|
|
24
|
+
"@abapify/logger": "0.4.46",
|
|
25
25
|
"open": "^11.0.4",
|
|
26
26
|
"proxy-agent": "^6.4.0"
|
|
27
27
|
},
|