opal-security 4.0.4 → 5.0.0

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.
@@ -23,6 +23,7 @@ export var AccessOption;
23
23
  export var AccessReviewAction;
24
24
  (function (AccessReviewAction) {
25
25
  AccessReviewAction["Accept"] = "ACCEPT";
26
+ AccessReviewAction["AdminRevoke"] = "ADMIN_REVOKE";
26
27
  AccessReviewAction["NoAction"] = "NO_ACTION";
27
28
  AccessReviewAction["Revoke"] = "REVOKE";
28
29
  AccessReviewAction["Update"] = "UPDATE";
@@ -128,12 +129,6 @@ export var AccessRuleStatus;
128
129
  AccessRuleStatus["Paused"] = "PAUSED";
129
130
  AccessRuleStatus["PausedByFailsafe"] = "PAUSED_BY_FAILSAFE";
130
131
  })(AccessRuleStatus || (AccessRuleStatus = {}));
131
- export var AccessType;
132
- (function (AccessType) {
133
- AccessType["Birthright"] = "BIRTHRIGHT";
134
- AccessType["Expiring"] = "EXPIRING";
135
- AccessType["Longstanding"] = "LONGSTANDING";
136
- })(AccessType || (AccessType = {}));
137
132
  export var AldwinRole;
138
133
  (function (AldwinRole) {
139
134
  AldwinRole["Admin"] = "ADMIN";
@@ -215,37 +210,11 @@ export var AuthSessionStatus;
215
210
  AuthSessionStatus["SessionNotFound"] = "SESSION_NOT_FOUND";
216
211
  AuthSessionStatus["SessionValid"] = "SESSION_VALID";
217
212
  })(AuthSessionStatus || (AuthSessionStatus = {}));
218
- export var AuthType;
219
- (function (AuthType) {
220
- AuthType["ActiveDirectory"] = "ACTIVE_DIRECTORY";
221
- AuthType["Aws"] = "AWS";
222
- AuthType["AwsSso"] = "AWS_SSO";
223
- AuthType["AzureAd"] = "AZURE_AD";
224
- AuthType["Coupa"] = "COUPA";
225
- AuthType["Custom"] = "CUSTOM";
226
- AuthType["CustomConnector"] = "CUSTOM_CONNECTOR";
227
- AuthType["Databricks"] = "DATABRICKS";
228
- AuthType["DatastaxAstra"] = "DATASTAX_ASTRA";
229
- AuthType["Duo"] = "DUO";
230
- AuthType["Gcp"] = "GCP";
231
- AuthType["GitHub"] = "GIT_HUB";
232
- AuthType["GitLab"] = "GIT_LAB";
233
- AuthType["GoogleGroups"] = "GOOGLE_GROUPS";
234
- AuthType["GoogleWorkspace"] = "GOOGLE_WORKSPACE";
235
- AuthType["Ilevel"] = "ILEVEL";
236
- AuthType["Ldap"] = "LDAP";
237
- AuthType["Mongo"] = "MONGO";
238
- AuthType["MongoAtlas"] = "MONGO_ATLAS";
239
- AuthType["Mysqlmariadb"] = "MYSQLMARIADB";
240
- AuthType["OktaDirectory"] = "OKTA_DIRECTORY";
241
- AuthType["Pagerduty"] = "PAGERDUTY";
242
- AuthType["Postgres"] = "POSTGRES";
243
- AuthType["Salesforce"] = "SALESFORCE";
244
- AuthType["Snowflake"] = "SNOWFLAKE";
245
- AuthType["Tailscale"] = "TAILSCALE";
246
- AuthType["Teleport"] = "TELEPORT";
247
- AuthType["Workday"] = "WORKDAY";
248
- })(AuthType || (AuthType = {}));
213
+ export var AzureAdCloudType;
214
+ (function (AzureAdCloudType) {
215
+ AzureAdCloudType["Global"] = "GLOBAL";
216
+ AzureAdCloudType["UsGovernment"] = "US_GOVERNMENT";
217
+ })(AzureAdCloudType || (AzureAdCloudType = {}));
249
218
  export var BundleItemsSortByField;
250
219
  (function (BundleItemsSortByField) {
251
220
  BundleItemsSortByField["CreatedAt"] = "CREATED_AT";
@@ -261,6 +230,7 @@ export var BundlesSortByField;
261
230
  export var ConnectionType;
262
231
  (function (ConnectionType) {
263
232
  ConnectionType["ActiveDirectory"] = "ACTIVE_DIRECTORY";
233
+ ConnectionType["Anthropic"] = "ANTHROPIC";
264
234
  /**
265
235
  * Deprecated. Legacy integration no longer offered - use AWS_SSO instead.
266
236
  * @deprecated Legacy integration no longer offered - use AWS_SSO instead.
@@ -269,6 +239,7 @@ export var ConnectionType;
269
239
  ConnectionType["AwsSso"] = "AWS_SSO";
270
240
  ConnectionType["AzureAd"] = "AZURE_AD";
271
241
  ConnectionType["Coupa"] = "COUPA";
242
+ ConnectionType["Cursor"] = "CURSOR";
272
243
  ConnectionType["Custom"] = "CUSTOM";
273
244
  ConnectionType["CustomConnector"] = "CUSTOM_CONNECTOR";
274
245
  ConnectionType["Databricks"] = "DATABRICKS";
@@ -287,6 +258,8 @@ export var ConnectionType;
287
258
  ConnectionType["Mysql"] = "MYSQL";
288
259
  ConnectionType["OktaDirectory"] = "OKTA_DIRECTORY";
289
260
  ConnectionType["Opal"] = "OPAL";
261
+ ConnectionType["OpenaiPlatform"] = "OPENAI_PLATFORM";
262
+ ConnectionType["OracleFusion"] = "ORACLE_FUSION";
290
263
  ConnectionType["Pagerduty"] = "PAGERDUTY";
291
264
  ConnectionType["Postgres"] = "POSTGRES";
292
265
  ConnectionType["Salesforce"] = "SALESFORCE";
@@ -438,6 +411,9 @@ export var EventType;
438
411
  EventType["BundleGroupsRemoved"] = "BUNDLE_GROUPS_REMOVED";
439
412
  EventType["BundleResourcesAdded"] = "BUNDLE_RESOURCES_ADDED";
440
413
  EventType["BundleResourcesRemoved"] = "BUNDLE_RESOURCES_REMOVED";
414
+ EventType["CatalogItemHidden"] = "CATALOG_ITEM_HIDDEN";
415
+ EventType["CatalogItemUnhidden"] = "CATALOG_ITEM_UNHIDDEN";
416
+ EventType["CatalogUpdated"] = "CATALOG_UPDATED";
441
417
  EventType["ConfigurationTemplateAdminOwnerUpdated"] = "CONFIGURATION_TEMPLATE_ADMIN_OWNER_UPDATED";
442
418
  EventType["ConfigurationTemplateAuditMessageChannelUpdated"] = "CONFIGURATION_TEMPLATE_AUDIT_MESSAGE_CHANNEL_UPDATED";
443
419
  EventType["ConfigurationTemplateBreakGlassUsersUpdated"] = "CONFIGURATION_TEMPLATE_BREAK_GLASS_USERS_UPDATED";
@@ -769,6 +745,7 @@ export var GeneralSettingType;
769
745
  GeneralSettingType["DisableRequestDelegation"] = "DISABLE_REQUEST_DELEGATION";
770
746
  GeneralSettingType["GlobalRequesterRole"] = "GLOBAL_REQUESTER_ROLE";
771
747
  GeneralSettingType["NestedGroups"] = "NESTED_GROUPS";
748
+ GeneralSettingType["OnlyAllowDelegationToActiveUsers"] = "ONLY_ALLOW_DELEGATION_TO_ACTIVE_USERS";
772
749
  GeneralSettingType["RequireManagerCc"] = "REQUIRE_MANAGER_CC";
773
750
  GeneralSettingType["RequireOpalMfaForLogins"] = "REQUIRE_OPAL_MFA_FOR_LOGINS";
774
751
  GeneralSettingType["RequireSupportTicket"] = "REQUIRE_SUPPORT_TICKET";
@@ -953,6 +930,7 @@ export var PropagationStatusCode;
953
930
  PropagationStatusCode["ErrRemoteProvisioningViaIdpFailed"] = "ERR_REMOTE_PROVISIONING_VIA_IDP_FAILED";
954
931
  PropagationStatusCode["ErrRemoteResourceNotFound"] = "ERR_REMOTE_RESOURCE_NOT_FOUND";
955
932
  PropagationStatusCode["ErrRemoteThrottle"] = "ERR_REMOTE_THROTTLE";
933
+ PropagationStatusCode["ErrRemoteTicketNotFound"] = "ERR_REMOTE_TICKET_NOT_FOUND";
956
934
  PropagationStatusCode["ErrRemoteUnrecoverableError"] = "ERR_REMOTE_UNRECOVERABLE_ERROR";
957
935
  PropagationStatusCode["ErrRemoteUserNotFound"] = "ERR_REMOTE_USER_NOT_FOUND";
958
936
  PropagationStatusCode["ErrRemoteUserNotLinked"] = "ERR_REMOTE_USER_NOT_LINKED";
@@ -1091,6 +1069,7 @@ export var RequestApprovalType;
1091
1069
  RequestApprovalType["Manager"] = "MANAGER";
1092
1070
  RequestApprovalType["Owner"] = "OWNER";
1093
1071
  RequestApprovalType["SkipManager"] = "SKIP_MANAGER";
1072
+ RequestApprovalType["User"] = "USER";
1094
1073
  })(RequestApprovalType || (RequestApprovalType = {}));
1095
1074
  export var RequestMessageCode;
1096
1075
  (function (RequestMessageCode) {
@@ -1113,6 +1092,13 @@ export var RequestReviewerDelegationsSortByField;
1113
1092
  RequestReviewerDelegationsSortByField["EndTime"] = "END_TIME";
1114
1093
  RequestReviewerDelegationsSortByField["StartTime"] = "START_TIME";
1115
1094
  })(RequestReviewerDelegationsSortByField || (RequestReviewerDelegationsSortByField = {}));
1095
+ export var RequestSource;
1096
+ (function (RequestSource) {
1097
+ RequestSource["Api"] = "API";
1098
+ RequestSource["Cli"] = "CLI";
1099
+ RequestSource["Slack"] = "SLACK";
1100
+ RequestSource["Web"] = "WEB";
1101
+ })(RequestSource || (RequestSource = {}));
1116
1102
  export var RequestStatus;
1117
1103
  (function (RequestStatus) {
1118
1104
  RequestStatus["Approved"] = "APPROVED";
@@ -1142,6 +1128,7 @@ export var RequestsSortByField;
1142
1128
  })(RequestsSortByField || (RequestsSortByField = {}));
1143
1129
  export var ResourceType;
1144
1130
  (function (ResourceType) {
1131
+ ResourceType["AnthropicWorkspace"] = "ANTHROPIC_WORKSPACE";
1145
1132
  ResourceType["AwsAccount"] = "AWS_ACCOUNT";
1146
1133
  ResourceType["AwsEc2Instance"] = "AWS_EC2_INSTANCE";
1147
1134
  ResourceType["AwsEksCluster"] = "AWS_EKS_CLUSTER";
@@ -1166,6 +1153,7 @@ export var ResourceType;
1166
1153
  ResourceType["AzureUserAssignedManagedIdentity"] = "AZURE_USER_ASSIGNED_MANAGED_Identity";
1167
1154
  ResourceType["AzureVirtualMachine"] = "AZURE_VIRTUAL_MACHINE";
1168
1155
  ResourceType["CoupaRole"] = "COUPA_ROLE";
1156
+ ResourceType["CursorOrganization"] = "CURSOR_ORGANIZATION";
1169
1157
  ResourceType["Custom"] = "CUSTOM";
1170
1158
  ResourceType["CustomConnector"] = "CUSTOM_CONNECTOR";
1171
1159
  ResourceType["DatabricksAccountServicePrincipal"] = "DATABRICKS_ACCOUNT_SERVICE_PRINCIPAL";
@@ -1181,6 +1169,7 @@ export var ResourceType;
1181
1169
  ResourceType["GcpOrganization"] = "GCP_ORGANIZATION";
1182
1170
  ResourceType["GcpProject"] = "GCP_PROJECT";
1183
1171
  ResourceType["GcpServiceAccount"] = "GCP_SERVICE_ACCOUNT";
1172
+ ResourceType["GitHubOrg"] = "GIT_HUB_ORG";
1184
1173
  ResourceType["GitHubOrgRole"] = "GIT_HUB_ORG_ROLE";
1185
1174
  ResourceType["GitHubRepo"] = "GIT_HUB_REPO";
1186
1175
  ResourceType["GitLabProject"] = "GIT_LAB_PROJECT";
@@ -1194,6 +1183,9 @@ export var ResourceType;
1194
1183
  ResourceType["OktaRole"] = "OKTA_ROLE";
1195
1184
  ResourceType["OpalRole"] = "OPAL_ROLE";
1196
1185
  ResourceType["OpalScopedRole"] = "OPAL_SCOPED_ROLE";
1186
+ ResourceType["OpenaiPlatformProject"] = "OPENAI_PLATFORM_PROJECT";
1187
+ ResourceType["OpenaiPlatformServiceAccount"] = "OPENAI_PLATFORM_SERVICE_ACCOUNT";
1188
+ ResourceType["OracleFusionRole"] = "ORACLE_FUSION_ROLE";
1197
1189
  ResourceType["PagerdutyRole"] = "PAGERDUTY_ROLE";
1198
1190
  ResourceType["PostgresInstance"] = "POSTGRES_INSTANCE";
1199
1191
  ResourceType["SalesforcePermissionSet"] = "SALESFORCE_PERMISSION_SET";
@@ -1236,6 +1228,8 @@ export var ReviewerAction;
1236
1228
  export var ReviewerUserStatus;
1237
1229
  (function (ReviewerUserStatus) {
1238
1230
  ReviewerUserStatus["Accepted"] = "ACCEPTED";
1231
+ ReviewerUserStatus["AdminNeedsEndSystemRevocation"] = "ADMIN_NEEDS_END_SYSTEM_REVOCATION";
1232
+ ReviewerUserStatus["AdminRevoked"] = "ADMIN_REVOKED";
1239
1233
  ReviewerUserStatus["NeedsEndSystemRevocation"] = "NEEDS_END_SYSTEM_REVOCATION";
1240
1234
  ReviewerUserStatus["NeedsUpdateRequestApproval"] = "NEEDS_UPDATE_REQUEST_APPROVAL";
1241
1235
  ReviewerUserStatus["NotRequired"] = "NOT_REQUIRED";
@@ -1286,11 +1280,13 @@ export var RolePermission;
1286
1280
  RolePermission["EditSettings"] = "EDIT_SETTINGS";
1287
1281
  RolePermission["EditSyncSettings"] = "EDIT_SYNC_SETTINGS";
1288
1282
  RolePermission["EditTags"] = "EDIT_TAGS";
1283
+ RolePermission["EditTokens"] = "EDIT_TOKENS";
1289
1284
  RolePermission["Export"] = "EXPORT";
1290
1285
  RolePermission["Import"] = "IMPORT";
1291
1286
  RolePermission["Read"] = "READ";
1292
1287
  RolePermission["ReadAssignments"] = "READ_ASSIGNMENTS";
1293
1288
  RolePermission["ReadSettings"] = "READ_SETTINGS";
1289
+ RolePermission["ReadTokens"] = "READ_TOKENS";
1294
1290
  RolePermission["RequestOnBehalf"] = "REQUEST_ON_BEHALF";
1295
1291
  RolePermission["ResetMfa"] = "RESET_MFA";
1296
1292
  RolePermission["SendReminders"] = "SEND_REMINDERS";
@@ -1306,8 +1302,8 @@ export var RolePermissionTargetType;
1306
1302
  RolePermissionTargetType["Connection"] = "CONNECTION";
1307
1303
  RolePermissionTargetType["EventStream"] = "EVENT_STREAM";
1308
1304
  RolePermissionTargetType["Group"] = "GROUP";
1305
+ RolePermissionTargetType["Owner"] = "OWNER";
1309
1306
  RolePermissionTargetType["PubsubPublishConnection"] = "PUBSUB_PUBLISH_CONNECTION";
1310
- RolePermissionTargetType["PubsubPublishMessage"] = "PUBSUB_PUBLISH_MESSAGE";
1311
1307
  RolePermissionTargetType["RequestTemplate"] = "REQUEST_TEMPLATE";
1312
1308
  RolePermissionTargetType["Resource"] = "RESOURCE";
1313
1309
  RolePermissionTargetType["User"] = "USER";
@@ -1320,10 +1316,12 @@ export var SearchType;
1320
1316
  export var ServiceType;
1321
1317
  (function (ServiceType) {
1322
1318
  ServiceType["ActiveDirectory"] = "ACTIVE_DIRECTORY";
1319
+ ServiceType["Anthropic"] = "ANTHROPIC";
1323
1320
  ServiceType["AwsIam"] = "AWS_IAM";
1324
1321
  ServiceType["AwsSso"] = "AWS_SSO";
1325
1322
  ServiceType["AzureAd"] = "AZURE_AD";
1326
1323
  ServiceType["Coupa"] = "COUPA";
1324
+ ServiceType["Cursor"] = "CURSOR";
1327
1325
  ServiceType["Custom"] = "CUSTOM";
1328
1326
  ServiceType["CustomConnector"] = "CUSTOM_CONNECTOR";
1329
1327
  ServiceType["Databricks"] = "DATABRICKS";
@@ -1344,6 +1342,8 @@ export var ServiceType;
1344
1342
  ServiceType["Mysql"] = "MYSQL";
1345
1343
  ServiceType["OktaDirectory"] = "OKTA_DIRECTORY";
1346
1344
  ServiceType["Opal"] = "OPAL";
1345
+ ServiceType["OpenaiPlatform"] = "OPENAI_PLATFORM";
1346
+ ServiceType["OracleFusion"] = "ORACLE_FUSION";
1347
1347
  ServiceType["Pagerduty"] = "PAGERDUTY";
1348
1348
  ServiceType["Postgres"] = "POSTGRES";
1349
1349
  ServiceType["Salesforce"] = "SALESFORCE";
@@ -1354,6 +1354,14 @@ export var ServiceType;
1354
1354
  ServiceType["Unknown"] = "UNKNOWN";
1355
1355
  ServiceType["Workday"] = "WORKDAY";
1356
1356
  })(ServiceType || (ServiceType = {}));
1357
+ export var ServiceUserAutomationStrategy;
1358
+ (function (ServiceUserAutomationStrategy) {
1359
+ ServiceUserAutomationStrategy["Webhook"] = "WEBHOOK";
1360
+ })(ServiceUserAutomationStrategy || (ServiceUserAutomationStrategy = {}));
1361
+ export var ServiceUserAutomationTrigger;
1362
+ (function (ServiceUserAutomationTrigger) {
1363
+ ServiceUserAutomationTrigger["RequestCreatedForReviewer"] = "REQUEST_CREATED_FOR_REVIEWER";
1364
+ })(ServiceUserAutomationTrigger || (ServiceUserAutomationTrigger = {}));
1357
1365
  export var SortDirection;
1358
1366
  (function (SortDirection) {
1359
1367
  SortDirection["Asc"] = "ASC";
@@ -1451,6 +1459,7 @@ export var TaskTrigger;
1451
1459
  export var ThirdPartyProvider;
1452
1460
  (function (ThirdPartyProvider) {
1453
1461
  ThirdPartyProvider["Auth0"] = "AUTH0";
1462
+ ThirdPartyProvider["FreshService"] = "FRESH_SERVICE";
1454
1463
  ThirdPartyProvider["GitHub"] = "GIT_HUB";
1455
1464
  ThirdPartyProvider["GitHubConnection"] = "GIT_HUB_CONNECTION";
1456
1465
  ThirdPartyProvider["GitHubRegistration"] = "GIT_HUB_REGISTRATION";
@@ -1459,6 +1468,7 @@ export var ThirdPartyProvider;
1459
1468
  ThirdPartyProvider["GoogleChat"] = "GOOGLE_CHAT";
1460
1469
  ThirdPartyProvider["Jira"] = "JIRA";
1461
1470
  ThirdPartyProvider["Linear"] = "LINEAR";
1471
+ ThirdPartyProvider["Notion"] = "NOTION";
1462
1472
  ThirdPartyProvider["Opsgenie"] = "OPSGENIE";
1463
1473
  ThirdPartyProvider["PagerDuty"] = "PAGER_DUTY";
1464
1474
  ThirdPartyProvider["ServiceNow"] = "SERVICE_NOW";
@@ -2059,6 +2069,67 @@ export const CheckAuthSessionQueryDocument = {
2059
2069
  },
2060
2070
  ],
2061
2071
  };
2072
+ export const GetLastMfaAtDocument = {
2073
+ kind: "Document",
2074
+ definitions: [
2075
+ {
2076
+ kind: "OperationDefinition",
2077
+ operation: "query",
2078
+ name: { kind: "Name", value: "GetLastMfaAt" },
2079
+ selectionSet: {
2080
+ kind: "SelectionSet",
2081
+ selections: [
2082
+ { kind: "Field", name: { kind: "Name", value: "lastMfaAt" } },
2083
+ ],
2084
+ },
2085
+ },
2086
+ ],
2087
+ };
2088
+ export const HasValidOidcIdTokenDocument = {
2089
+ kind: "Document",
2090
+ definitions: [
2091
+ {
2092
+ kind: "OperationDefinition",
2093
+ operation: "query",
2094
+ name: { kind: "Name", value: "HasValidOidcIdToken" },
2095
+ variableDefinitions: [
2096
+ {
2097
+ kind: "VariableDefinition",
2098
+ variable: {
2099
+ kind: "Variable",
2100
+ name: { kind: "Name", value: "oidcProviderType" },
2101
+ },
2102
+ type: {
2103
+ kind: "NonNullType",
2104
+ type: {
2105
+ kind: "NamedType",
2106
+ name: { kind: "Name", value: "OIDCProviderType" },
2107
+ },
2108
+ },
2109
+ },
2110
+ ],
2111
+ selectionSet: {
2112
+ kind: "SelectionSet",
2113
+ selections: [
2114
+ {
2115
+ kind: "Field",
2116
+ name: { kind: "Name", value: "hasValidOidcToken" },
2117
+ arguments: [
2118
+ {
2119
+ kind: "Argument",
2120
+ name: { kind: "Name", value: "oidcProviderType" },
2121
+ value: {
2122
+ kind: "Variable",
2123
+ name: { kind: "Name", value: "oidcProviderType" },
2124
+ },
2125
+ },
2126
+ ],
2127
+ },
2128
+ ],
2129
+ },
2130
+ },
2131
+ ],
2132
+ };
2062
2133
  export const CreateRequestDocument = {
2063
2134
  kind: "Document",
2064
2135
  definitions: [
package/build/labels.js CHANGED
@@ -30,6 +30,10 @@ export const connectionTypeLabelByType = {
30
30
  [ConnectionType.Coupa]: "Coupa",
31
31
  [ConnectionType.DatastaxAstra]: "DataStax Astra",
32
32
  [ConnectionType.Ilevel]: "iLEVEL",
33
+ [ConnectionType.Anthropic]: "Anthropic",
34
+ [ConnectionType.Cursor]: "Cursor",
35
+ [ConnectionType.OpenaiPlatform]: "OpenAI Platform",
36
+ [ConnectionType.OracleFusion]: "Oracle Fusion",
33
37
  };
34
38
  export const DisplayLabels = {
35
39
  [EntityType.Resource]: "Resource",
@@ -3,6 +3,6 @@ import type { Command } from "@oclif/core";
3
3
  export declare let client: ApolloClient | null;
4
4
  export declare let cookieStr: string;
5
5
  export declare const printResponse: (command: Command, resp?: ApolloClient.QueryResult) => void;
6
- export declare const handleError: (command: Command, err: unknown, resp?: ApolloClient.QueryResult) => void;
6
+ export declare const handleError: (command: Command, err: unknown, resp?: ApolloClient.QueryResult) => undefined;
7
7
  export declare const initClient: (command: Command, fetchAccessToken?: boolean) => Promise<void>;
8
8
  export declare function getClient(command: Command, fetchAccessToken?: boolean): Promise<ApolloClient>;
@@ -36,7 +36,7 @@ export const handleError = (command, err, resp) => {
36
36
  typeof err.networkError === "object" &&
37
37
  "statusCode" in err.networkError) {
38
38
  // Status code errors are already handled in the global Apollo handler, so we can just return here.
39
- return;
39
+ return undefined;
40
40
  }
41
41
  let errorMsg;
42
42
  if (!err) {
@@ -42,5 +42,6 @@ export const isProduction = (configDir) => {
42
42
  return (configData[urlKey] !== "https://dev.opal.dev" &&
43
43
  configData[urlKey] !== "https://demo.opal.dev" &&
44
44
  configData[urlKey] !== "https://staging.opal.dev" &&
45
+ !configData[urlKey].match(/https:\/\/.*\.testing\.opal\.dev$/) &&
45
46
  !configData[urlKey].match(/https?:\/\/localhost/));
46
47
  };
@@ -2,6 +2,4 @@ export declare const SHARED_FLAGS: {
2
2
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
3
3
  id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
4
4
  accessLevelRemoteId: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
5
- sessionId: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
6
- refresh: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
5
  };
@@ -11,13 +11,4 @@ export const SHARED_FLAGS = {
11
11
  char: "a",
12
12
  description: "The remote ID of the access level with which to access the resource.",
13
13
  }),
14
- sessionId: Flags.string({
15
- multiple: false,
16
- char: "s",
17
- description: "The Opal ID of the session to connect to. Uses an existing session that was created via the web flow.",
18
- }),
19
- refresh: Flags.boolean({
20
- char: "r",
21
- description: "Starts a new session even if one already exists. Useful if a session is about to expire.",
22
- }),
23
14
  };
@@ -1,5 +1,9 @@
1
1
  /**
2
- * Starts a local HTTP server on port 8080 to handle OAuth callback.
3
- * Returns a promise that resolves with the full callback URL when authentication succeeds.
2
+ * Starts a local HTTP server to handle OAuth callback.
3
+ * Tries ports in order: 49152, 49153, 49154
4
+ * Returns a promise that resolves with the actual port and a promise for the callback URL.
4
5
  */
5
- export declare function startLocalServer(): Promise<string>;
6
+ export declare function startLocalServer(): Promise<{
7
+ port: number;
8
+ urlPromise: Promise<string>;
9
+ }>;
@@ -1,14 +1,29 @@
1
1
  import * as http from "node:http";
2
2
  import { authErrorHtml, authMissingCodeHtml, authSuccessHtml, } from "./auth-success-template.js";
3
3
  /**
4
- * Starts a local HTTP server on port 8080 to handle OAuth callback.
5
- * Returns a promise that resolves with the full callback URL when authentication succeeds.
4
+ * Starts a local HTTP server to handle OAuth callback.
5
+ * Tries ports in order: 49152, 49153, 49154
6
+ * Returns a promise that resolves with the actual port and a promise for the callback URL.
6
7
  */
7
8
  export function startLocalServer() {
8
- return new Promise((resolve, reject) => {
9
+ const portsToTry = [49152, 49153, 49154];
10
+ return tryPorts(portsToTry, 0);
11
+ }
12
+ function tryPorts(ports, index) {
13
+ if (index >= ports.length) {
14
+ return Promise.reject(new Error(`Failed to start server: all ports (${ports.join(", ")}) are occupied`));
15
+ }
16
+ const port = ports[index];
17
+ return new Promise((resolveServer, rejectServer) => {
18
+ let resolveUrl;
19
+ let rejectUrl;
20
+ const urlPromise = new Promise((resolve, reject) => {
21
+ resolveUrl = resolve;
22
+ rejectUrl = reject;
23
+ });
9
24
  const server = http.createServer(async (req, res) => {
10
25
  try {
11
- const url = new URL(req.url || "", "http://127.0.0.1:8080");
26
+ const url = new URL(req.url || "", `http://127.0.0.1:${port}`);
12
27
  if (url.pathname === "/callback") {
13
28
  const error = url.searchParams.get("error");
14
29
  if (error) {
@@ -16,17 +31,17 @@ export function startLocalServer() {
16
31
  res.end(authErrorHtml(error));
17
32
  server.closeAllConnections();
18
33
  server.close(() => {
19
- reject(new Error(`Authentication failed: ${error}`));
34
+ rejectUrl(new Error(`Authentication failed: ${error}`));
20
35
  });
21
36
  return;
22
37
  }
23
38
  if (req.url) {
24
39
  res.writeHead(200, { "Content-Type": "text/html" });
25
40
  res.end(authSuccessHtml);
26
- const fullUrl = `http://127.0.0.1:8080${req.url}`;
41
+ const fullUrl = `http://127.0.0.1:${port}${req.url}`;
27
42
  server.closeAllConnections();
28
43
  server.close(() => {
29
- resolve(fullUrl);
44
+ resolveUrl(fullUrl);
30
45
  });
31
46
  }
32
47
  else {
@@ -34,7 +49,7 @@ export function startLocalServer() {
34
49
  res.end(authMissingCodeHtml);
35
50
  server.closeAllConnections();
36
51
  server.close(() => {
37
- reject(new Error("Missing authorization code"));
52
+ rejectUrl(new Error("Missing authorization code"));
38
53
  });
39
54
  }
40
55
  }
@@ -48,21 +63,31 @@ export function startLocalServer() {
48
63
  res.end();
49
64
  server.closeAllConnections();
50
65
  server.close(() => {
51
- reject(err);
66
+ rejectUrl(err);
52
67
  });
53
68
  }
54
69
  });
55
- server.listen(8080, "127.0.0.1", () => {
56
- console.log("Local server started on http://127.0.0.1:8080");
70
+ server.listen(port, "127.0.0.1", () => {
71
+ console.log(`Local server started on http://127.0.0.1:${port}`);
72
+ // Server successfully bound to port, resolve with port and urlPromise
73
+ resolveServer({ port, urlPromise });
57
74
  });
58
75
  server.on("error", (err) => {
59
- reject(err);
76
+ // If port is occupied, try the next one
77
+ if (err.code === "EADDRINUSE") {
78
+ tryPorts(ports, index + 1)
79
+ .then(resolveServer)
80
+ .catch(rejectServer);
81
+ }
82
+ else {
83
+ rejectServer(err);
84
+ }
60
85
  });
61
86
  // Timeout after 5 minutes
62
87
  setTimeout(() => {
63
88
  server.closeAllConnections();
64
89
  server.close(() => {
65
- reject(new Error("Authentication timeout"));
90
+ rejectUrl(new Error("Authentication timeout"));
66
91
  });
67
92
  }, 5 * 60 * 1000);
68
93
  });
@@ -0,0 +1,2 @@
1
+ import { type Command } from "@oclif/core";
2
+ export declare const waitForMfa: (command: Command) => Promise<void>;
@@ -0,0 +1,62 @@
1
+ import { ux } from "@oclif/core";
2
+ import inquirer from "inquirer";
3
+ import open from "open";
4
+ import { graphql } from "../graphql/index.js";
5
+ import { getClient } from "./apollo.js";
6
+ import { getOrCreateConfigData, urlKey } from "./config.js";
7
+ const MFA_TIMEOUT_MS = 5 * 60 * 1000;
8
+ const getLastMfaAt = async (command) => {
9
+ var _a;
10
+ const client = await getClient(command);
11
+ const response = await client.query({
12
+ query: graphql(`
13
+ query GetLastMfaAt {
14
+ lastMfaAt
15
+ }
16
+ `),
17
+ });
18
+ return (_a = response.data) === null || _a === void 0 ? void 0 : _a.lastMfaAt;
19
+ };
20
+ export const waitForMfa = async (command) => {
21
+ const configData = getOrCreateConfigData(command.config.configDir);
22
+ const baseUrl = configData[urlKey];
23
+ const url = `${baseUrl}/browser-mfa/begin`;
24
+ console.log(`
25
+ ⚡ MFA Required
26
+
27
+ To continue, validate your identity:
28
+
29
+ ⚠️ Security Check:
30
+ • Verify the URL starts with: ${url}
31
+ • You should see the Opal logo and a device activation dialog
32
+ `);
33
+ await inquirer.prompt([
34
+ {
35
+ type: "input",
36
+ name: "continue",
37
+ message: "Press Enter to open your browser and continue",
38
+ },
39
+ ]);
40
+ console.log(`
41
+ If your browser doesn't open automatically, go to:
42
+
43
+ ${url}
44
+ `);
45
+ ux.action.start("Waiting for MFA validation...");
46
+ try {
47
+ open(url);
48
+ const lastMfaAt = await getLastMfaAt(command);
49
+ const startTime = Date.now();
50
+ while ((await getLastMfaAt(command)) === lastMfaAt) {
51
+ if (Date.now() - startTime > MFA_TIMEOUT_MS) {
52
+ ux.action.stop("✗ Timed out");
53
+ throw new Error(`Timed out waiting for MFA validation after ${MFA_TIMEOUT_MS / 1000} seconds. Please ensure you've completed the MFA flow in your browser.`);
54
+ }
55
+ await new Promise((resolve) => setTimeout(resolve, 2000));
56
+ }
57
+ ux.action.stop("✓ Completed");
58
+ }
59
+ catch (error) {
60
+ ux.action.stop("✗ Failed");
61
+ }
62
+ };
@@ -0,0 +1,3 @@
1
+ import { type Command } from "@oclif/core";
2
+ import type { OidcProviderType } from "../graphql/graphql.js";
3
+ export declare const waitForValidOidcToken: (command: Command, oidcProviderType: OidcProviderType) => Promise<void>;
@@ -0,0 +1,64 @@
1
+ import { ux } from "@oclif/core";
2
+ import inquirer from "inquirer";
3
+ import open from "open";
4
+ import { graphql } from "../graphql/index.js";
5
+ import { getClient } from "./apollo.js";
6
+ import { getOrCreateConfigData, urlKey } from "./config.js";
7
+ const OIDC_TIMEOUT_MS = 5 * 60 * 1000;
8
+ const hasValidOidcToken = async (command, oidcProviderType) => {
9
+ var _a, _b;
10
+ const client = await getClient(command);
11
+ const response = await client.query({
12
+ query: graphql(`
13
+ query HasValidOidcIdToken($oidcProviderType: OIDCProviderType!) {
14
+ hasValidOidcToken(oidcProviderType: $oidcProviderType)
15
+ }
16
+ `),
17
+ variables: {
18
+ oidcProviderType,
19
+ },
20
+ });
21
+ return (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.hasValidOidcToken) !== null && _b !== void 0 ? _b : false;
22
+ };
23
+ export const waitForValidOidcToken = async (command, oidcProviderType) => {
24
+ const configData = getOrCreateConfigData(command.config.configDir);
25
+ const baseUrl = configData[urlKey];
26
+ const url = `${baseUrl}/browser-oidc/begin?oidc_provider_type=${oidcProviderType}`;
27
+ console.log(`
28
+ 🔑 OIDC Authentication Required
29
+
30
+ To continue, validate your identity with your AWS OIDC provider:
31
+
32
+ ⚠️ Security Check:
33
+ • Verify the URL starts with: ${url}
34
+ • You should see the Opal logo and a device activation dialog
35
+ `);
36
+ await inquirer.prompt([
37
+ {
38
+ type: "input",
39
+ name: "continue",
40
+ message: "Press Enter to open your browser and continue",
41
+ },
42
+ ]);
43
+ console.log(`
44
+ If your browser doesn't open automatically, go to:
45
+
46
+ ${url}
47
+ `);
48
+ ux.action.start("Waiting for OIDC authentication...");
49
+ try {
50
+ open(url);
51
+ const startTime = Date.now();
52
+ while (!(await hasValidOidcToken(command, oidcProviderType))) {
53
+ if (Date.now() - startTime > OIDC_TIMEOUT_MS) {
54
+ ux.action.stop("✗ Timed out");
55
+ throw new Error(`Timed out waiting for OIDC validation after ${OIDC_TIMEOUT_MS / 1000} seconds. Please ensure you've completed the OIDC flow in your browser.`);
56
+ }
57
+ await new Promise((resolve) => setTimeout(resolve, 2000));
58
+ }
59
+ ux.action.stop("✓ Completed");
60
+ }
61
+ catch (error) {
62
+ ux.action.stop("✗ Failed");
63
+ }
64
+ };
@@ -1,4 +1,4 @@
1
1
  import type { Command } from "@oclif/core";
2
- import type { ResourceAccessLevelInput } from "../graphql/graphql.js";
3
- export declare const getOrCreateSession: (command: Command, resourceId: string, accessLevel: ResourceAccessLevelInput, sessionId: string | undefined, metadataFragment: string, wantNewSession?: boolean) => Promise<any>;
4
- export declare const getSessionExpirationMessage: (session: any) => string;
2
+ import type { CreateSessionResult, ResourceAccessLevelInput, Session } from "../graphql/graphql.js";
3
+ export declare const createSession: (command: Command, resourceId: string, accessLevel: ResourceAccessLevelInput, sessionId: string | undefined, metadataFragment: string) => Promise<CreateSessionResult | undefined>;
4
+ export declare const getSessionExpirationMessage: (session: Session) => string;