@forge/cli-shared 9.11.0-next.9 → 10.0.0-next.13

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
@@ -1,5 +1,31 @@
1
1
  # @forge/cli-shared
2
2
 
3
+ ## 10.0.0-next.13
4
+
5
+ ### Major Changes
6
+
7
+ - f93687f: Replace Keytar with a dedicated credential file protected by macOS and Linux permissions or Windows ACLs. This is a breaking authentication change: users with credentials stored in the OS keychain must run `forge login` once after upgrading. `FORGE_EMAIL` and `FORGE_API_TOKEN` continue to take precedence over saved credentials.
8
+
9
+ ## 10.0.0-next.12
10
+
11
+ ### Major Changes
12
+
13
+ - a4b2f56: Rename --no-install to --skip-dependencies for create and module add
14
+
15
+ ## 9.11.0-next.11
16
+
17
+ ### Minor Changes
18
+
19
+ - 112c0c6: Add `isAgentV2` and `isCIV2` to the attribution payload (`atl-attribution` header and analytics events), detecting whether a named agent or CI runs the command without reading the `CI` variable: `isCIV2` is `"true"` when `ci-info` names a CI tool, not when `CI=true`, and `isAgentV2` is `"true"` when an agent names itself, with or without a terminal. A named agent in a CI tool is both. `isAgent` and `isCI` are unchanged. Also send `ciHint` (the CI tool's `ci-info` id), `isTerminal` (stdin is a terminal) and `isUnrecognizedNonTTY`. The new fields are strings so the backend keeps them as wildcard fields. With the `non-interactive` setting `auto`, non-interactive mode turns on for a named agent (`isAgentV2`), in CI or not; CI, scripts and unnamed agents keep today's behaviour
20
+
21
+ Bump `@vercel/detect-agent` to 1.2.7 and add `ci-info` 4.4.0
22
+
23
+ ## 9.11.0-next.10
24
+
25
+ ### Patch Changes
26
+
27
+ - 32cccae: Use native `Array.prototype.flat` and `flatMap` instead of the `array.prototype.flatmap` polyfill.
28
+
3
29
  ## 9.11.0-next.9
4
30
 
5
31
  ### Patch Changes
@@ -6,7 +6,7 @@ export interface CreateAppCommandInput extends CreateAppClientInput {
6
6
  template: string;
7
7
  directory: string;
8
8
  compatibility?: AppCompatibility;
9
- install?: boolean;
9
+ skipDependencies?: boolean;
10
10
  prependAppName?: boolean;
11
11
  beforeRegister?: (directory: string) => Promise<void>;
12
12
  }
@@ -24,7 +24,7 @@ export declare class CreateAppCommand {
24
24
  private readonly packageInstaller;
25
25
  private readonly statsig;
26
26
  constructor(templater: Templater, registerAppCommand: RegisterAppCommand, packageInstaller: PackageInstaller, statsig: StatsigService);
27
- execute({ name, description, template, directory, compatibility, developerSpaceId, billingConsent, appFeatures, install, prependAppName, beforeRegister }: CreateAppCommandInput): Promise<CreateAppCommandResult>;
27
+ execute({ name, description, template, directory, compatibility, developerSpaceId, billingConsent, appFeatures, skipDependencies, prependAppName, beforeRegister }: CreateAppCommandInput): Promise<CreateAppCommandResult>;
28
28
  getAvailableTemplates(): Promise<string[]>;
29
29
  filterAvailableProducts<T extends string>(products: T[], teamworkGraph: T, crossContext: T): Promise<T[]>;
30
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-an-app.d.ts","sourceRoot":"","sources":["../../src/apps/create-an-app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED,qBAAa,gBAAiB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CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAI1C;AAED,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG;IACvD,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAHP,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,cAAc;IAG7B,OAAO,CAAC,EACnB,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,cAAqB,EACrB,cAAc,EACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAmC7C,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAS1C,uBAAuB,CAAC,CAAC,SAAS,MAAM,EACnD,QAAQ,EAAE,CAAC,EAAE,EACb,aAAa,EAAE,CAAC,EAChB,YAAY,EAAE,CAAC,GACd,OAAO,CAAC,CAAC,EAAE,CAAC;CAchB"}
@@ -20,7 +20,7 @@ class CreateAppCommand {
20
20
  this.packageInstaller = packageInstaller;
21
21
  this.statsig = statsig;
22
22
  }
23
- async execute({ name, description, template, directory, compatibility, developerSpaceId, billingConsent, appFeatures, install, prependAppName = true, beforeRegister }) {
23
+ async execute({ name, description, template, directory, compatibility, developerSpaceId, billingConsent, appFeatures, skipDependencies, prependAppName = true, beforeRegister }) {
24
24
  await this.templater.downloadAndExtract(template, directory);
25
25
  if (beforeRegister) {
26
26
  try {
@@ -41,7 +41,7 @@ class CreateAppCommand {
41
41
  shouldPrependAppName: prependAppName,
42
42
  compatibility
43
43
  });
44
- if (install !== false) {
44
+ if (!skipDependencies) {
45
45
  await this.packageInstaller.install(directory);
46
46
  }
47
47
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"get-app-owner.d.ts","sourceRoot":"","sources":["../../src/apps/get-app-owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,qBAAa,oBAAqB,SAAQ,KAAK;;CAI9C;AAED,eAAO,MAAM,aAAa;QAuC0lmgH,8CAAc;GA9BhomgH,CAAC;AAEH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,iBAAiB;IAGrC,OAAO;;;;;;;;;;;;;YAMN,WAAW;CAe1B"}
1
+ {"version":3,"file":"get-app-owner.d.ts","sourceRoot":"","sources":["../../src/apps/get-app-owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,qBAAa,oBAAqB,SAAQ,KAAK;;CAI9C;AAED,eAAO,MAAM,aAAa;QAuC+68gH,8CAAc;GA9Br98gH,CAAC;AAEH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,iBAAiB;IAGrC,OAAO;;;;;;;;;;;;;YAMN,WAAW;CAe1B"}
@@ -1,15 +1,8 @@
1
1
  import * as t from 'io-ts';
2
- import { CachedConf } from '../../cache';
3
2
  import { UserError } from '../../shared';
4
- import { Logger } from '../../ui';
5
3
  import { UserRepository } from './user-repository';
6
4
  export declare const EMAIL_KEY = "FORGE_EMAIL";
7
5
  export declare const API_TOKEN_KEY = "FORGE_API_TOKEN";
8
- export interface Keytar {
9
- getPassword(service: string, account: string): Promise<string | null>;
10
- setPassword(service: string, account: string, password: string): Promise<void>;
11
- deletePassword(service: string, account: string): Promise<void>;
12
- }
13
6
  export declare const personalApiCredentialsShape: t.TypeC<{
14
7
  email: t.StringC;
15
8
  token: t.StringC;
@@ -24,10 +17,8 @@ export type PersonalApiCredentialsValidated = t.TypeOf<typeof personalApiCredent
24
17
  export declare class NoTokenInStoreError extends UserError {
25
18
  constructor();
26
19
  }
27
- export declare class NoKeytarError extends UserError {
28
- constructor();
29
- }
30
- export declare class KeytarAccessError extends UserError {
20
+ export declare class CredentialStoreSecurityError extends UserError {
21
+ constructor(cause?: unknown);
31
22
  }
32
23
  export interface CredentialGetter {
33
24
  getCredentials(): Promise<PersonalApiCredentialsValidated>;
@@ -36,22 +27,25 @@ export interface CredentialStore extends CredentialGetter {
36
27
  setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
37
28
  deleteCredentials(): Promise<void>;
38
29
  }
39
- export declare class CredentialStoreImpl implements CredentialStore {
40
- private readonly logger;
41
- private readonly instructionsURL;
42
- private readonly keytar;
43
- private readonly cachedConfig;
30
+ export type CredentialStoreCommandRunner = (command: string, args: readonly string[]) => Promise<string>;
31
+ export declare function getCredentialsFilePath(currentPlatform?: NodeJS.Platform, environment?: NodeJS.ProcessEnv, userHome?: string): string;
32
+ export declare class FileCredentialStore implements CredentialStore {
44
33
  private readonly userRepository;
45
- private keytarAccount;
46
- constructor(logger: Logger, instructionsURL: string, keytar: Keytar | null, cachedConfig: CachedConf, userRepository: UserRepository);
47
- private wrapKeytarError;
48
- decodeCredentials(credentialsString: string | null): PersonalApiCredentialsValidated;
49
- getCredentialsKeytar(keytar: Keytar): Promise<PersonalApiCredentialsValidated | undefined>;
50
- popInsecurePlaintextCredentials(): PersonalApiCredentialsValidated | undefined;
51
- deleteInsecurePlaintextCredentials(): void;
34
+ private readonly account;
35
+ private readonly credentialsFilePath;
36
+ private readonly currentPlatform;
37
+ private readonly commandRunner;
38
+ private windowsUserSid;
39
+ constructor(userRepository: UserRepository, account: string, credentialsFilePath?: string, currentPlatform?: NodeJS.Platform, commandRunner?: CredentialStoreCommandRunner);
40
+ private getWindowsUserSid;
41
+ private applyWindowsAcl;
42
+ private secureWindowsStorage;
43
+ private securePosixStorage;
44
+ private secureStorage;
45
+ private readCredentialsFile;
52
46
  getCredentials(): Promise<PersonalApiCredentialsValidated>;
53
47
  setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
54
48
  deleteCredentials(): Promise<void>;
55
49
  }
56
- export declare function getCredentialStore(logger: Logger, userRepository: UserRepository): CredentialStore;
50
+ export declare function getCredentialStore(userRepository: UserRepository): CredentialStore;
57
51
  //# sourceMappingURL=credential-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credential-store.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/credential-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAuB,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,MAAM,EAAQ,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,SAAS,gBAAgB,CAAC;AACvC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAa/C,MAAM,WAAW,MAAM;IACrB,WAAW,CAAC,OAAO,EAA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c,GAAG,eAAe,CAElF"}
@@ -1,36 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CredentialStoreImpl = exports.KeytarAccessError = exports.NoKeytarError = exports.NoTokenInStoreError = exports.personalApiCredentialsValidatedShape = exports.personalApiCredentialsShape = exports.API_TOKEN_KEY = exports.EMAIL_KEY = void 0;
3
+ exports.FileCredentialStore = exports.CredentialStoreSecurityError = exports.NoTokenInStoreError = exports.personalApiCredentialsValidatedShape = exports.personalApiCredentialsShape = exports.API_TOKEN_KEY = exports.EMAIL_KEY = void 0;
4
+ exports.getCredentialsFilePath = getCredentialsFilePath;
4
5
  exports.getCredentialStore = getCredentialStore;
5
6
  const tslib_1 = require("tslib");
7
+ const child_process_1 = require("child_process");
8
+ const fs_1 = require("fs");
6
9
  const os_1 = require("os");
10
+ const path_1 = tslib_1.__importDefault(require("path"));
11
+ const util_1 = require("util");
7
12
  const Either_1 = require("fp-ts/lib/Either");
8
13
  const t = tslib_1.__importStar(require("io-ts"));
9
- const cache_1 = require("../../cache");
10
- const instruction_1 = require("../instruction");
11
14
  const graphql_1 = require("../../graphql");
12
15
  const shared_1 = require("../../shared");
13
16
  const ui_1 = require("../../ui");
14
17
  exports.EMAIL_KEY = 'FORGE_EMAIL';
15
18
  exports.API_TOKEN_KEY = 'FORGE_API_TOKEN';
16
- const KEYTAR_SERVICE = 'Atlassian';
17
- const CACHE_CREDENTIALS_KEY = 'forge-credentials';
18
- var KeytarAccount;
19
- (function (KeytarAccount) {
20
- KeytarAccount["DEV"] = "Ecosystem-staging";
21
- KeytarAccount["STG"] = "Ecosystem-staging";
22
- KeytarAccount["PROD"] = "Ecosystem";
23
- KeytarAccount["FEDRAMP_MODERATE_STAGING"] = "Ecosystem-fedm-staging";
24
- KeytarAccount["FEDRAMP_MODERATE_PROD"] = "Ecosystem-fedm-prod";
25
- })(KeytarAccount || (KeytarAccount = {}));
26
- function getKeytar() {
27
- try {
28
- return require('keytar');
29
- }
30
- catch {
31
- return null;
32
- }
33
- }
19
+ const CREDENTIALS_FILE_NAME = 'credentials.json';
20
+ const CREDENTIALS_DIRECTORY_MODE = 0o700;
21
+ const CREDENTIALS_FILE_MODE = 0o600;
22
+ const PERMISSION_BITS_MASK = 0o777;
23
+ const WINDOWS_SYSTEM_SID = 'S-1-5-18';
24
+ const WINDOWS_ADMINISTRATORS_SID = 'S-1-5-32-544';
25
+ var CredentialAccount;
26
+ (function (CredentialAccount) {
27
+ CredentialAccount["DEV"] = "Ecosystem-staging";
28
+ CredentialAccount["STG"] = "Ecosystem-staging";
29
+ CredentialAccount["PROD"] = "Ecosystem";
30
+ CredentialAccount["FEDRAMP_MODERATE_STAGING"] = "Ecosystem-fedm-staging";
31
+ CredentialAccount["FEDRAMP_MODERATE_PROD"] = "Ecosystem-fedm-prod";
32
+ })(CredentialAccount || (CredentialAccount = {}));
34
33
  exports.personalApiCredentialsShape = t.type({
35
34
  email: t.string,
36
35
  token: t.string
@@ -46,146 +45,234 @@ class NoTokenInStoreError extends shared_1.UserError {
46
45
  }
47
46
  }
48
47
  exports.NoTokenInStoreError = NoTokenInStoreError;
49
- class NoKeytarError extends shared_1.UserError {
50
- constructor() {
51
- super(ui_1.Text.error.noKeytar);
48
+ class CredentialStoreSecurityError extends shared_1.UserError {
49
+ constructor(cause) {
50
+ super(ui_1.Text.error.credentialsFilePermissions);
51
+ this.cause = cause;
52
52
  }
53
53
  }
54
- exports.NoKeytarError = NoKeytarError;
55
- class KeytarAccessError extends shared_1.UserError {
54
+ exports.CredentialStoreSecurityError = CredentialStoreSecurityError;
55
+ const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
56
+ const runCredentialStoreCommand = async (command, args) => {
57
+ const { stdout } = await execFileAsync(command, [...args], { encoding: 'utf8', windowsHide: true });
58
+ return stdout;
59
+ };
60
+ const credentialsByAccountShape = t.record(t.string, exports.personalApiCredentialsValidatedShape);
61
+ function isFileNotFoundError(error) {
62
+ return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
56
63
  }
57
- exports.KeytarAccessError = KeytarAccessError;
58
- class CredentialStoreImpl {
59
- logger;
60
- instructionsURL;
61
- keytar;
62
- cachedConfig;
64
+ function getCredentialsFilePath(currentPlatform = (0, os_1.platform)(), environment = process.env, userHome = (0, os_1.homedir)()) {
65
+ const platformPath = currentPlatform === 'win32' ? path_1.default.win32 : path_1.default.posix;
66
+ let credentialsDirectory;
67
+ switch (currentPlatform) {
68
+ case 'darwin':
69
+ credentialsDirectory = platformPath.join(userHome, 'Library', 'Application Support', 'Atlassian', 'Forge');
70
+ break;
71
+ case 'win32':
72
+ credentialsDirectory = platformPath.join(environment.LOCALAPPDATA || platformPath.join(userHome, 'AppData', 'Local'), 'Atlassian', 'Forge');
73
+ break;
74
+ default:
75
+ credentialsDirectory = platformPath.join(environment.XDG_DATA_HOME || platformPath.join(userHome, '.local', 'share'), 'Atlassian', 'Forge');
76
+ }
77
+ return platformPath.join(credentialsDirectory, CREDENTIALS_FILE_NAME);
78
+ }
79
+ class FileCredentialStore {
63
80
  userRepository;
64
- keytarAccount;
65
- constructor(logger, instructionsURL, keytar, cachedConfig, userRepository) {
66
- this.logger = logger;
67
- this.instructionsURL = instructionsURL;
68
- this.keytar = keytar;
69
- this.cachedConfig = cachedConfig;
81
+ account;
82
+ credentialsFilePath;
83
+ currentPlatform;
84
+ commandRunner;
85
+ windowsUserSid;
86
+ constructor(userRepository, account, credentialsFilePath = getCredentialsFilePath(), currentPlatform = (0, os_1.platform)(), commandRunner = runCredentialStoreCommand) {
70
87
  this.userRepository = userRepository;
71
- this.keytarAccount = (0, graphql_1.getEnvironmentConfig)(KeytarAccount);
88
+ this.account = account;
89
+ this.credentialsFilePath = credentialsFilePath;
90
+ this.currentPlatform = currentPlatform;
91
+ this.commandRunner = commandRunner;
72
92
  }
73
- wrapKeytarError(e) {
74
- const message = (0, shared_1.wrapError)(e).message;
75
- let error;
76
- const currentPlatform = (0, os_1.platform)();
77
- switch (currentPlatform) {
78
- case 'darwin':
79
- error = ui_1.Text.error.keytarAccessError.mac(message);
80
- break;
81
- case 'linux':
82
- error = ui_1.Text.error.keytarAccessError.linux(message);
83
- break;
84
- case 'win32':
85
- error = ui_1.Text.error.keytarAccessError.windows(message);
86
- break;
87
- default:
88
- error = ui_1.Text.error.keytarAccessError.other(message);
89
- }
90
- throw new KeytarAccessError(error);
93
+ async getWindowsUserSid() {
94
+ this.windowsUserSid ??= this.commandRunner('whoami.exe', ['/user', '/fo', 'csv', '/nh']).then((output) => {
95
+ const sid = output.trim().match(/"?(S-\d(?:-\d+)+)"?$/)?.[1];
96
+ if (!sid) {
97
+ throw new Error('Could not determine the current Windows user SID');
98
+ }
99
+ return sid;
100
+ });
101
+ return this.windowsUserSid;
91
102
  }
92
- decodeCredentials(credentialsString) {
93
- if (!credentialsString) {
94
- throw new NoTokenInStoreError();
95
- }
96
- let credentials;
103
+ async applyWindowsAcl(targetPath, directory) {
104
+ const userSid = await this.getWindowsUserSid();
105
+ const permission = directory ? '(OI)(CI)F' : 'F';
106
+ await this.commandRunner('icacls.exe', [
107
+ targetPath,
108
+ '/inheritance:r',
109
+ '/grant:r',
110
+ `*${userSid}:${permission}`,
111
+ `*${WINDOWS_SYSTEM_SID}:${permission}`,
112
+ `*${WINDOWS_ADMINISTRATORS_SID}:${permission}`
113
+ ]);
114
+ }
115
+ async secureWindowsStorage(createFile) {
116
+ let fileExists = true;
97
117
  try {
98
- credentials = JSON.parse(credentialsString);
118
+ await fs_1.promises.access(this.credentialsFilePath);
99
119
  }
100
- catch {
101
- throw new NoTokenInStoreError();
120
+ catch (error) {
121
+ if (!isFileNotFoundError(error)) {
122
+ throw error;
123
+ }
124
+ fileExists = false;
102
125
  }
103
- const decodeResult = exports.personalApiCredentialsValidatedShape.decode(credentials);
104
- if ((0, Either_1.isLeft)(decodeResult)) {
105
- throw new NoTokenInStoreError();
126
+ if (!fileExists && !createFile) {
127
+ return;
106
128
  }
107
- return decodeResult.right;
129
+ const credentialsDirectory = path_1.default.dirname(this.credentialsFilePath);
130
+ await fs_1.promises.mkdir(credentialsDirectory, { recursive: true });
131
+ await this.applyWindowsAcl(credentialsDirectory, true);
132
+ if (!fileExists) {
133
+ await fs_1.promises.writeFile(this.credentialsFilePath, '', { flag: 'wx' });
134
+ }
135
+ await this.applyWindowsAcl(this.credentialsFilePath, false);
108
136
  }
109
- async getCredentialsKeytar(keytar) {
110
- let stringifiedPersonalApiCredentials;
137
+ async securePosixStorage(createFile) {
138
+ let fileExists = true;
111
139
  try {
112
- stringifiedPersonalApiCredentials = await keytar.getPassword(KEYTAR_SERVICE, this.keytarAccount);
140
+ await fs_1.promises.access(this.credentialsFilePath);
113
141
  }
114
- catch (e) {
115
- this.wrapKeytarError(e);
142
+ catch (error) {
143
+ if (!isFileNotFoundError(error)) {
144
+ throw error;
145
+ }
146
+ fileExists = false;
116
147
  }
117
- if (!stringifiedPersonalApiCredentials) {
118
- return undefined;
148
+ if (!fileExists && !createFile) {
149
+ return;
119
150
  }
120
- return this.decodeCredentials(stringifiedPersonalApiCredentials);
121
- }
122
- popInsecurePlaintextCredentials() {
123
- const result = this.cachedConfig.get(CACHE_CREDENTIALS_KEY);
124
- if (result) {
125
- this.logger.warn(ui_1.Text.warning.plaintextCredentialsFound(this.instructionsURL));
126
- this.deleteInsecurePlaintextCredentials();
151
+ const credentialsDirectory = path_1.default.dirname(this.credentialsFilePath);
152
+ await fs_1.promises.mkdir(credentialsDirectory, {
153
+ recursive: true,
154
+ mode: CREDENTIALS_DIRECTORY_MODE
155
+ });
156
+ await fs_1.promises.chmod(credentialsDirectory, CREDENTIALS_DIRECTORY_MODE);
157
+ const directoryStat = await fs_1.promises.stat(credentialsDirectory);
158
+ const currentUserId = process.getuid?.();
159
+ if (currentUserId === undefined ||
160
+ !directoryStat.isDirectory() ||
161
+ directoryStat.uid !== currentUserId ||
162
+ (directoryStat.mode & PERMISSION_BITS_MASK) !== CREDENTIALS_DIRECTORY_MODE) {
163
+ throw new Error('The credentials directory is not owned exclusively by the current user');
164
+ }
165
+ if (!fileExists) {
166
+ const file = await fs_1.promises.open(this.credentialsFilePath, 'wx', CREDENTIALS_FILE_MODE);
167
+ await file.close();
168
+ }
169
+ await fs_1.promises.chmod(this.credentialsFilePath, CREDENTIALS_FILE_MODE);
170
+ const fileStat = await fs_1.promises.stat(this.credentialsFilePath);
171
+ if (!fileStat.isFile() ||
172
+ fileStat.uid !== currentUserId ||
173
+ (fileStat.mode & PERMISSION_BITS_MASK) !== CREDENTIALS_FILE_MODE) {
174
+ throw new Error('Could not restrict access to the credentials file');
127
175
  }
128
- return result;
129
- }
130
- deleteInsecurePlaintextCredentials() {
131
- this.cachedConfig.delete(CACHE_CREDENTIALS_KEY);
132
176
  }
133
- async getCredentials() {
134
- let result;
135
- const plaintextCredentials = this.popInsecurePlaintextCredentials();
136
- if (plaintextCredentials) {
137
- if (this.keytar) {
138
- await this.setCredentials(plaintextCredentials);
139
- this.logger.warn(ui_1.Text.warning.plaintextCredentialsMigrated);
177
+ async secureStorage(createFile) {
178
+ try {
179
+ if (this.currentPlatform === 'win32') {
180
+ await this.secureWindowsStorage(createFile);
140
181
  }
141
182
  else {
142
- this.logger.warn(ui_1.Text.warning.plaintextCredentialsNotMigrated);
183
+ await this.securePosixStorage(createFile);
184
+ }
185
+ }
186
+ catch (error) {
187
+ await fs_1.promises.rm(this.credentialsFilePath, { force: true }).catch(() => undefined);
188
+ throw new CredentialStoreSecurityError(error);
189
+ }
190
+ }
191
+ async readCredentialsFile() {
192
+ let contents;
193
+ try {
194
+ await this.secureStorage(false);
195
+ contents = await fs_1.promises.readFile(this.credentialsFilePath, 'utf8');
196
+ }
197
+ catch (error) {
198
+ if (isFileNotFoundError(error)) {
199
+ return {};
143
200
  }
201
+ throw error;
144
202
  }
203
+ let parsed;
204
+ try {
205
+ parsed = JSON.parse(contents);
206
+ }
207
+ catch {
208
+ throw new NoTokenInStoreError();
209
+ }
210
+ const decodeResult = credentialsByAccountShape.decode(parsed);
211
+ if ((0, Either_1.isLeft)(decodeResult)) {
212
+ throw new NoTokenInStoreError();
213
+ }
214
+ return decodeResult.right;
215
+ }
216
+ async getCredentials() {
145
217
  if (process.env[exports.API_TOKEN_KEY] && process.env[exports.EMAIL_KEY]) {
146
218
  const credentials = {
147
219
  email: process.env[exports.EMAIL_KEY],
148
220
  token: process.env[exports.API_TOKEN_KEY]
149
221
  };
150
222
  const { accountId } = await this.userRepository.getUser(credentials);
151
- result = { ...credentials, accountId };
223
+ return { ...credentials, accountId };
152
224
  }
153
- else if (this.keytar) {
154
- result = await this.getCredentialsKeytar(this.keytar);
155
- }
156
- if (result) {
157
- return result;
225
+ const credentials = (await this.readCredentialsFile())[this.account];
226
+ if (!credentials) {
227
+ throw new NoTokenInStoreError();
158
228
  }
159
- throw new NoTokenInStoreError();
229
+ return credentials;
160
230
  }
161
231
  async setCredentials(credentials) {
162
- if (this.keytar) {
163
- try {
164
- await this.keytar.setPassword(KEYTAR_SERVICE, this.keytarAccount, JSON.stringify(credentials));
165
- }
166
- catch (e) {
167
- throw new NoKeytarError();
168
- }
232
+ let credentialsByAccount;
233
+ try {
234
+ credentialsByAccount = await this.readCredentialsFile();
169
235
  }
170
- else {
171
- throw new NoKeytarError();
236
+ catch (error) {
237
+ if (!(error instanceof NoTokenInStoreError)) {
238
+ throw error;
239
+ }
240
+ credentialsByAccount = {};
172
241
  }
242
+ credentialsByAccount[this.account] = credentials;
243
+ await this.secureStorage(true);
244
+ await fs_1.promises.writeFile(this.credentialsFilePath, `${JSON.stringify(credentialsByAccount, null, 2)}\n`, 'utf8');
245
+ await this.secureStorage(false);
173
246
  }
174
247
  async deleteCredentials() {
175
- if (this.keytar) {
248
+ let credentialsByAccount;
249
+ try {
250
+ credentialsByAccount = await this.readCredentialsFile();
251
+ }
252
+ catch (error) {
253
+ if (!(error instanceof NoTokenInStoreError)) {
254
+ throw error;
255
+ }
256
+ await fs_1.promises.rm(this.credentialsFilePath, { force: true });
257
+ return;
258
+ }
259
+ delete credentialsByAccount[this.account];
260
+ if (Object.keys(credentialsByAccount).length === 0) {
176
261
  try {
177
- await this.keytar.deletePassword(KEYTAR_SERVICE, this.keytarAccount);
262
+ await fs_1.promises.unlink(this.credentialsFilePath);
178
263
  }
179
- catch (e) {
264
+ catch (error) {
265
+ if (!isFileNotFoundError(error)) {
266
+ throw error;
267
+ }
180
268
  }
269
+ return;
181
270
  }
182
- this.deleteInsecurePlaintextCredentials();
271
+ await fs_1.promises.writeFile(this.credentialsFilePath, `${JSON.stringify(credentialsByAccount, null, 2)}\n`, 'utf8');
272
+ await this.secureStorage(false);
183
273
  }
184
274
  }
185
- exports.CredentialStoreImpl = CredentialStoreImpl;
186
- function getCredentialStore(logger, userRepository) {
187
- const keytar = getKeytar();
188
- const cachedConfig = cache_1.CachedConf.getCache(cache_1.CONFIG_PROJECT_NAME);
189
- const instructionsUrl = (0, instruction_1.getInstructionsUrl)();
190
- return new CredentialStoreImpl(logger, instructionsUrl, keytar, cachedConfig, userRepository);
275
+ exports.FileCredentialStore = FileCredentialStore;
276
+ function getCredentialStore(userRepository) {
277
+ return new FileCredentialStore(userRepository, (0, graphql_1.getEnvironmentConfig)(CredentialAccount));
191
278
  }
@@ -19,7 +19,7 @@ class PersonalTokenAuthenticator {
19
19
  if (process.env[credential_store_1.API_TOKEN_KEY] && process.env[credential_store_1.EMAIL_KEY]) {
20
20
  return ui_1.Text.error.invalidTokenInEnv(instructionsUrl, credential_store_1.EMAIL_KEY, credential_store_1.API_TOKEN_KEY);
21
21
  }
22
- return ui_1.Text.error.invalidTokenInKeytar;
22
+ return ui_1.Text.error.invalidTokenInCredentialFile;
23
23
  }
24
24
  }
25
25
  exports.PersonalTokenAuthenticator = PersonalTokenAuthenticator;
@@ -1 +1 @@
1
- {"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../src/config/config-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA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AAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1G,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,wBAAwB;IAkBhC,OAAO,CAAC,6BAA6B;IAkBrC,OAAO,CAAC,gBAAgB;IAIX,oBAAoB,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,EAAE,CAAC;IAqClF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAe1E,YAAY,CAAC,aAAa,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAsB1E,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKzD,OAAO,CAAC,eAAe;CAkCxB"}
@@ -181,7 +181,7 @@ class ConfigFile {
181
181
  this.writeManifest(currentConfigDoc);
182
182
  }
183
183
  getHostedResourceModules(modules) {
184
- const modulesArray = (0, shared_1.flat)(Object.values(modules));
184
+ const modulesArray = Object.values(modules).flat();
185
185
  return modulesArray.filter(config_1.isHostedResourceModule);
186
186
  }
187
187
  assertNoMissingResources(modules, resources) {
@@ -1 +1 @@
1
- {"version":3,"file":"file-system-reader.d.ts","sourceRoot":"","sources":["../../src/file-system/file-system-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,IAAI,CAAC;AAU9C,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC;AAEjE,qBAAa,gBAAgB;IACpB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIrC,QAAQ,CAAC,QAAQ,EAAE,MAAM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,MAAM,GAAG,OAAO;IAIrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQxC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAS5D,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBtG,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAiB,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAmB3G,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI7C,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQ9C,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IASxE,gBAAgB,IAAI,MAAM;IAI1B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAO3C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQvC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAU/E,OAAO,CAAC,eAAe;IAQV,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAIpE"}
@@ -8,7 +8,6 @@ const os_1 = require("os");
8
8
  const path_1 = tslib_1.__importStar(require("path"));
9
9
  const util_1 = require("util");
10
10
  const recursive_readdir_1 = tslib_1.__importDefault(require("recursive-readdir"));
11
- const shared_1 = require("../shared");
12
11
  const FILE_NOT_FOUND_CODE = 'ENOENT';
13
12
  class FileSystemReader {
14
13
  fileExists(filePath) {
@@ -46,14 +45,14 @@ class FileSystemReader {
46
45
  async readGlob({ pattern, filesOnly = false }) {
47
46
  let results = await (0, glob_1.glob)(pattern, {});
48
47
  if (filesOnly) {
49
- results = (0, shared_1.flat)(await Promise.all(results.map(async (result) => {
48
+ results = (await Promise.all(results.map(async (result) => {
50
49
  if ((await fs_1.default.promises.lstat(result)).isFile()) {
51
50
  return [result];
52
51
  }
53
52
  else {
54
53
  return [];
55
54
  }
56
- })));
55
+ }))).flat();
57
56
  }
58
57
  results.sort();
59
58
  return results;
@@ -113,7 +112,7 @@ class FileSystemReader {
113
112
  }
114
113
  async getFileGlobList(globList) {
115
114
  const files = await Promise.all(globList.map((pattern) => this.readGlob({ pattern, filesOnly: true })));
116
- return (0, shared_1.flat)(files);
115
+ return files.flat();
117
116
  }
118
117
  }
119
118
  exports.FileSystemReader = FileSystemReader;