sim 2.2.27 → 2.2.28
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/generated/v2-api.d.ts +7 -0
- package/dist/index.js +39 -11
- package/dist/runtime.js +39 -11
- package/package.json +1 -1
|
@@ -1513,6 +1513,7 @@ export type CreateCredentialWorkloadIdentitySubjectQuery = Record<string, unknow
|
|
|
1513
1513
|
export type CreateCredentialWorkloadIdentitySubjectBody = {
|
|
1514
1514
|
workspaceId: string;
|
|
1515
1515
|
providerId: 'aws-service-account' | 'databricks-service-account' | 'snowflake-service-account' | 'microsoft-app-service-account' | 'google-service-account';
|
|
1516
|
+
subject?: string;
|
|
1516
1517
|
};
|
|
1517
1518
|
type CreateCredentialWorkloadIdentitySubjectResponseRef0 = {
|
|
1518
1519
|
issuer: string;
|
|
@@ -1520,6 +1521,8 @@ type CreateCredentialWorkloadIdentitySubjectResponseRef0 = {
|
|
|
1520
1521
|
subject: string;
|
|
1521
1522
|
subjectProof: string;
|
|
1522
1523
|
expiresAt: string;
|
|
1524
|
+
subjectIssuedAt: string;
|
|
1525
|
+
subjectHeldUntil: string;
|
|
1523
1526
|
keylessConfig: {
|
|
1524
1527
|
authType: string;
|
|
1525
1528
|
subject: string;
|
|
@@ -12929,6 +12932,10 @@ export declare const V2_OPERATIONS: {
|
|
|
12929
12932
|
readonly values: readonly ['aws-service-account', 'databricks-service-account', 'snowflake-service-account', 'microsoft-app-service-account', 'google-service-account'];
|
|
12930
12933
|
readonly describe: 'Service-account provider the keyless credential will be created under; pass the same value to Create service-account credential. The response and List credential providers name the fields its keyless configuration needs.';
|
|
12931
12934
|
};
|
|
12935
|
+
readonly subject: {
|
|
12936
|
+
readonly kind: 'string';
|
|
12937
|
+
readonly describe: 'A subject Sim issued to you earlier that no credential has saved yet. Renews its proof instead of issuing a new subject, so a trust configuration that already allows it keeps working. Refused with `WORKLOAD_IDENTITY_SUBJECT_NOT_PENDING` once a credential saves it, after its hold ends, or for a subject issued to someone else.';
|
|
12938
|
+
};
|
|
12932
12939
|
};
|
|
12933
12940
|
};
|
|
12934
12941
|
readonly createCustomTool: {
|
package/dist/index.js
CHANGED
|
@@ -10264,6 +10264,10 @@ var V2_OPERATIONS = {
|
|
|
10264
10264
|
"google-service-account"
|
|
10265
10265
|
],
|
|
10266
10266
|
describe: "Service-account provider the keyless credential will be created under; pass the same value to Create service-account credential. The response and List credential providers name the fields its keyless configuration needs."
|
|
10267
|
+
},
|
|
10268
|
+
subject: {
|
|
10269
|
+
kind: "string",
|
|
10270
|
+
describe: "A subject Sim issued to you earlier that no credential has saved yet. Renews its proof instead of issuing a new subject, so a trust configuration that already allows it keeps working. Refused with `WORKLOAD_IDENTITY_SUBJECT_NOT_PENDING` once a credential saves it, after its hold ends, or for a subject issued to someone else."
|
|
10267
10271
|
}
|
|
10268
10272
|
}
|
|
10269
10273
|
},
|
|
@@ -23289,14 +23293,16 @@ var KEYLESS_SUBJECT_RESULT = {
|
|
|
23289
23293
|
{ header: "subject" },
|
|
23290
23294
|
{ header: "subject proof", path: "subjectProof" },
|
|
23291
23295
|
{ header: "expires", path: "expiresAt", format: "timestamp" },
|
|
23296
|
+
{ header: "held until", path: "subjectHeldUntil", format: "timestamp" },
|
|
23292
23297
|
{ header: "auth type", path: "keylessConfig.authType" },
|
|
23293
23298
|
{ header: "required fields", path: "requiredConfigFields" },
|
|
23294
23299
|
{ header: "optional fields", path: "optionalConfigFields" }
|
|
23295
23300
|
]
|
|
23296
23301
|
};
|
|
23297
23302
|
var KEYLESS_PROVIDER_IDS = V2_OPERATIONS.createCredentialWorkloadIdentitySubject.body.providerId.values;
|
|
23303
|
+
var KEYLESS_PROOF_EXPIRED = "WORKLOAD_IDENTITY_PROOF_EXPIRED";
|
|
23304
|
+
var KEYLESS_NOT_PENDING = "WORKLOAD_IDENTITY_SUBJECT_NOT_PENDING";
|
|
23298
23305
|
var KEYLESS_RETRY_CODES = new Set([
|
|
23299
|
-
"WORKLOAD_IDENTITY_PROOF_EXPIRED",
|
|
23300
23306
|
"WORKLOAD_IDENTITY_PROOF_INVALID",
|
|
23301
23307
|
"WORKLOAD_IDENTITY_SUBJECT_REQUIRED",
|
|
23302
23308
|
"WORKLOAD_IDENTITY_SUBJECT_IN_USE"
|
|
@@ -23310,7 +23316,9 @@ var KEYLESS_FLOW_HELP = [
|
|
|
23310
23316
|
"",
|
|
23311
23317
|
"Step 2: add those values to keylessConfig and pass it to `sim credentials create <providerId> --credentials @file`.",
|
|
23312
23318
|
"",
|
|
23313
|
-
|
|
23319
|
+
"The proof expires after 24 hours and works only for the user who requested it, with the same providerId. Sim holds the subject for you for 30 days until a credential saves it, so a trust configuration that takes longer to apply still works: renew the proof with `sim credentials keyless-subject <providerId> --subject <subject>`. The subject stays the same, and each renewal restarts the 30 days. Sim holds up to 20 unsaved subjects per person and provider in a workspace; issuing more drops the one shown least recently.",
|
|
23320
|
+
"",
|
|
23321
|
+
`If creation reports ${KEYLESS_PROOF_EXPIRED}, renew the proof and retry. If it reports ${[...KEYLESS_RETRY_CODES].join(", ")}, run step 1 again, trust the new subject, and retry.`,
|
|
23314
23322
|
"",
|
|
23315
23323
|
"Examples:",
|
|
23316
23324
|
" $ sim credentials keyless-subject aws-service-account --output json > subject.json",
|
|
@@ -23369,16 +23377,36 @@ function asServiceAccountJson(values, provider) {
|
|
|
23369
23377
|
const configuration = values.subject !== undefined && values.subjectProof !== undefined || provider.keyless !== undefined && values.authType === provider.keyless.authType || values.authType !== undefined && values.serviceAccountJson === undefined && !provider.fields.some((field) => field.id === "authType") && offersConfigurationAlternative(provider);
|
|
23370
23378
|
return configuration ? { serviceAccountJson: JSON.stringify(values) } : values;
|
|
23371
23379
|
}
|
|
23372
|
-
function
|
|
23380
|
+
function keylessHint(code, providerId) {
|
|
23381
|
+
if (code === KEYLESS_PROOF_EXPIRED) {
|
|
23382
|
+
return `Run \`sim credentials keyless-subject ${providerId} --subject <subject>\` to renew the proof for the same subject, and retry.`;
|
|
23383
|
+
}
|
|
23384
|
+
if (code === KEYLESS_NOT_PENDING) {
|
|
23385
|
+
return `Run \`sim credentials keyless-subject ${providerId}\` without --subject for a new subject, trust it in your cloud, and retry.`;
|
|
23386
|
+
}
|
|
23387
|
+
if (code !== null && KEYLESS_RETRY_CODES.has(code)) {
|
|
23388
|
+
return `Run \`sim credentials keyless-subject ${providerId}\` for a new subject, trust it in your cloud, and retry.`;
|
|
23389
|
+
}
|
|
23390
|
+
return null;
|
|
23391
|
+
}
|
|
23392
|
+
function withKeylessHint(error, providerId) {
|
|
23373
23393
|
if (!(error instanceof SimApiError))
|
|
23374
23394
|
return error;
|
|
23375
|
-
const
|
|
23376
|
-
if (
|
|
23395
|
+
const hint = keylessHint(refusalCode(error), providerId);
|
|
23396
|
+
if (hint === null)
|
|
23377
23397
|
return error;
|
|
23378
|
-
return new SimApiError(`${error.message}
|
|
23398
|
+
return new SimApiError(`${error.message} ${hint}`, error.status, error.code, error.details, error.exitCode, error.requestId);
|
|
23379
23399
|
}
|
|
23380
|
-
async function createKeylessSubject({ client, profile }, providerId) {
|
|
23381
|
-
const response = await client.request("createCredentialWorkloadIdentitySubject", {
|
|
23400
|
+
async function createKeylessSubject({ client, profile }, providerId, options) {
|
|
23401
|
+
const response = await client.request("createCredentialWorkloadIdentitySubject", {
|
|
23402
|
+
body: {
|
|
23403
|
+
workspaceId: client.requireWorkspace(),
|
|
23404
|
+
providerId,
|
|
23405
|
+
...options.subject !== undefined ? { subject: options.subject } : {}
|
|
23406
|
+
}
|
|
23407
|
+
}).catch((error) => {
|
|
23408
|
+
throw withKeylessHint(error, providerId);
|
|
23409
|
+
});
|
|
23382
23410
|
renderResult("createCredentialWorkloadIdentitySubject", profile.output, response.data, KEYLESS_SUBJECT_RESULT);
|
|
23383
23411
|
}
|
|
23384
23412
|
async function createServiceAccount({ client, profile }, providerId, options) {
|
|
@@ -23402,7 +23430,7 @@ async function createServiceAccount({ client, profile }, providerId, options) {
|
|
|
23402
23430
|
credentials: JSON.stringify(credentialFields)
|
|
23403
23431
|
}
|
|
23404
23432
|
}).catch((error) => {
|
|
23405
|
-
throw
|
|
23433
|
+
throw withKeylessHint(error, providerId);
|
|
23406
23434
|
});
|
|
23407
23435
|
renderResult("createServiceAccountCredential", profile.output, response.data, SERVICE_ACCOUNT_RESULT);
|
|
23408
23436
|
}
|
|
@@ -23447,8 +23475,8 @@ function attachCredentialCommands(program) {
|
|
|
23447
23475
|
]);
|
|
23448
23476
|
keylessSubject.addArgument(new Argument("<providerId>", "Service-account provider for the keyless credential").choices([
|
|
23449
23477
|
...KEYLESS_PROVIDER_IDS
|
|
23450
|
-
])).description(describeOperation(V2_OPERATIONS.createCredentialWorkloadIdentitySubject, "Issue the subject and proof for a new keyless (workload identity) credential")).addHelpText("after", `
|
|
23451
|
-
${KEYLESS_FLOW_HELP}`).action((providerId) => createKeylessSubject(connectKeylessSubject(), providerId));
|
|
23478
|
+
])).description(describeOperation(V2_OPERATIONS.createCredentialWorkloadIdentitySubject, "Issue the subject and proof for a new keyless (workload identity) credential")).option("--subject <subject>", "Renew the proof for a subject Sim issued to you earlier, instead of issuing a new one").addHelpText("after", `
|
|
23479
|
+
${KEYLESS_FLOW_HELP}`).action((providerId, options) => createKeylessSubject(connectKeylessSubject(), providerId, options));
|
|
23452
23480
|
const [connect, connectLink] = apiCommand(credentials, "connect", ["createCredentialConnection"]);
|
|
23453
23481
|
connect.argument("<providerId>", "OAuth provider to connect").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for connecting an OAuth provider")).requiredOption("--name <displayName>", "Name shown for the new credential in Sim (required)").action(async (providerId, options) => createConnectionLink(connectLink(), { providerId, displayName: options.name }));
|
|
23454
23482
|
const [reconnect, reconnectLink] = apiCommand(credentials, "reconnect", [
|
package/dist/runtime.js
CHANGED
|
@@ -10313,6 +10313,10 @@ var V2_OPERATIONS = {
|
|
|
10313
10313
|
"google-service-account"
|
|
10314
10314
|
],
|
|
10315
10315
|
describe: "Service-account provider the keyless credential will be created under; pass the same value to Create service-account credential. The response and List credential providers name the fields its keyless configuration needs."
|
|
10316
|
+
},
|
|
10317
|
+
subject: {
|
|
10318
|
+
kind: "string",
|
|
10319
|
+
describe: "A subject Sim issued to you earlier that no credential has saved yet. Renews its proof instead of issuing a new subject, so a trust configuration that already allows it keeps working. Refused with `WORKLOAD_IDENTITY_SUBJECT_NOT_PENDING` once a credential saves it, after its hold ends, or for a subject issued to someone else."
|
|
10316
10320
|
}
|
|
10317
10321
|
}
|
|
10318
10322
|
},
|
|
@@ -23338,14 +23342,16 @@ var KEYLESS_SUBJECT_RESULT = {
|
|
|
23338
23342
|
{ header: "subject" },
|
|
23339
23343
|
{ header: "subject proof", path: "subjectProof" },
|
|
23340
23344
|
{ header: "expires", path: "expiresAt", format: "timestamp" },
|
|
23345
|
+
{ header: "held until", path: "subjectHeldUntil", format: "timestamp" },
|
|
23341
23346
|
{ header: "auth type", path: "keylessConfig.authType" },
|
|
23342
23347
|
{ header: "required fields", path: "requiredConfigFields" },
|
|
23343
23348
|
{ header: "optional fields", path: "optionalConfigFields" }
|
|
23344
23349
|
]
|
|
23345
23350
|
};
|
|
23346
23351
|
var KEYLESS_PROVIDER_IDS = V2_OPERATIONS.createCredentialWorkloadIdentitySubject.body.providerId.values;
|
|
23352
|
+
var KEYLESS_PROOF_EXPIRED = "WORKLOAD_IDENTITY_PROOF_EXPIRED";
|
|
23353
|
+
var KEYLESS_NOT_PENDING = "WORKLOAD_IDENTITY_SUBJECT_NOT_PENDING";
|
|
23347
23354
|
var KEYLESS_RETRY_CODES = new Set([
|
|
23348
|
-
"WORKLOAD_IDENTITY_PROOF_EXPIRED",
|
|
23349
23355
|
"WORKLOAD_IDENTITY_PROOF_INVALID",
|
|
23350
23356
|
"WORKLOAD_IDENTITY_SUBJECT_REQUIRED",
|
|
23351
23357
|
"WORKLOAD_IDENTITY_SUBJECT_IN_USE"
|
|
@@ -23359,7 +23365,9 @@ var KEYLESS_FLOW_HELP = [
|
|
|
23359
23365
|
"",
|
|
23360
23366
|
"Step 2: add those values to keylessConfig and pass it to `sim credentials create <providerId> --credentials @file`.",
|
|
23361
23367
|
"",
|
|
23362
|
-
|
|
23368
|
+
"The proof expires after 24 hours and works only for the user who requested it, with the same providerId. Sim holds the subject for you for 30 days until a credential saves it, so a trust configuration that takes longer to apply still works: renew the proof with `sim credentials keyless-subject <providerId> --subject <subject>`. The subject stays the same, and each renewal restarts the 30 days. Sim holds up to 20 unsaved subjects per person and provider in a workspace; issuing more drops the one shown least recently.",
|
|
23369
|
+
"",
|
|
23370
|
+
`If creation reports ${KEYLESS_PROOF_EXPIRED}, renew the proof and retry. If it reports ${[...KEYLESS_RETRY_CODES].join(", ")}, run step 1 again, trust the new subject, and retry.`,
|
|
23363
23371
|
"",
|
|
23364
23372
|
"Examples:",
|
|
23365
23373
|
" $ sim credentials keyless-subject aws-service-account --output json > subject.json",
|
|
@@ -23418,16 +23426,36 @@ function asServiceAccountJson(values, provider) {
|
|
|
23418
23426
|
const configuration = values.subject !== undefined && values.subjectProof !== undefined || provider.keyless !== undefined && values.authType === provider.keyless.authType || values.authType !== undefined && values.serviceAccountJson === undefined && !provider.fields.some((field) => field.id === "authType") && offersConfigurationAlternative(provider);
|
|
23419
23427
|
return configuration ? { serviceAccountJson: JSON.stringify(values) } : values;
|
|
23420
23428
|
}
|
|
23421
|
-
function
|
|
23429
|
+
function keylessHint(code, providerId) {
|
|
23430
|
+
if (code === KEYLESS_PROOF_EXPIRED) {
|
|
23431
|
+
return `Run \`sim credentials keyless-subject ${providerId} --subject <subject>\` to renew the proof for the same subject, and retry.`;
|
|
23432
|
+
}
|
|
23433
|
+
if (code === KEYLESS_NOT_PENDING) {
|
|
23434
|
+
return `Run \`sim credentials keyless-subject ${providerId}\` without --subject for a new subject, trust it in your cloud, and retry.`;
|
|
23435
|
+
}
|
|
23436
|
+
if (code !== null && KEYLESS_RETRY_CODES.has(code)) {
|
|
23437
|
+
return `Run \`sim credentials keyless-subject ${providerId}\` for a new subject, trust it in your cloud, and retry.`;
|
|
23438
|
+
}
|
|
23439
|
+
return null;
|
|
23440
|
+
}
|
|
23441
|
+
function withKeylessHint(error, providerId) {
|
|
23422
23442
|
if (!(error instanceof SimApiError))
|
|
23423
23443
|
return error;
|
|
23424
|
-
const
|
|
23425
|
-
if (
|
|
23444
|
+
const hint = keylessHint(refusalCode(error), providerId);
|
|
23445
|
+
if (hint === null)
|
|
23426
23446
|
return error;
|
|
23427
|
-
return new SimApiError(`${error.message}
|
|
23447
|
+
return new SimApiError(`${error.message} ${hint}`, error.status, error.code, error.details, error.exitCode, error.requestId);
|
|
23428
23448
|
}
|
|
23429
|
-
async function createKeylessSubject({ client, profile }, providerId) {
|
|
23430
|
-
const response = await client.request("createCredentialWorkloadIdentitySubject", {
|
|
23449
|
+
async function createKeylessSubject({ client, profile }, providerId, options) {
|
|
23450
|
+
const response = await client.request("createCredentialWorkloadIdentitySubject", {
|
|
23451
|
+
body: {
|
|
23452
|
+
workspaceId: client.requireWorkspace(),
|
|
23453
|
+
providerId,
|
|
23454
|
+
...options.subject !== undefined ? { subject: options.subject } : {}
|
|
23455
|
+
}
|
|
23456
|
+
}).catch((error) => {
|
|
23457
|
+
throw withKeylessHint(error, providerId);
|
|
23458
|
+
});
|
|
23431
23459
|
renderResult("createCredentialWorkloadIdentitySubject", profile.output, response.data, KEYLESS_SUBJECT_RESULT);
|
|
23432
23460
|
}
|
|
23433
23461
|
async function createServiceAccount({ client, profile }, providerId, options) {
|
|
@@ -23451,7 +23479,7 @@ async function createServiceAccount({ client, profile }, providerId, options) {
|
|
|
23451
23479
|
credentials: JSON.stringify(credentialFields)
|
|
23452
23480
|
}
|
|
23453
23481
|
}).catch((error) => {
|
|
23454
|
-
throw
|
|
23482
|
+
throw withKeylessHint(error, providerId);
|
|
23455
23483
|
});
|
|
23456
23484
|
renderResult("createServiceAccountCredential", profile.output, response.data, SERVICE_ACCOUNT_RESULT);
|
|
23457
23485
|
}
|
|
@@ -23496,8 +23524,8 @@ function attachCredentialCommands(program) {
|
|
|
23496
23524
|
]);
|
|
23497
23525
|
keylessSubject.addArgument(new Argument("<providerId>", "Service-account provider for the keyless credential").choices([
|
|
23498
23526
|
...KEYLESS_PROVIDER_IDS
|
|
23499
|
-
])).description(describeOperation(V2_OPERATIONS.createCredentialWorkloadIdentitySubject, "Issue the subject and proof for a new keyless (workload identity) credential")).addHelpText("after", `
|
|
23500
|
-
${KEYLESS_FLOW_HELP}`).action((providerId) => createKeylessSubject(connectKeylessSubject(), providerId));
|
|
23527
|
+
])).description(describeOperation(V2_OPERATIONS.createCredentialWorkloadIdentitySubject, "Issue the subject and proof for a new keyless (workload identity) credential")).option("--subject <subject>", "Renew the proof for a subject Sim issued to you earlier, instead of issuing a new one").addHelpText("after", `
|
|
23528
|
+
${KEYLESS_FLOW_HELP}`).action((providerId, options) => createKeylessSubject(connectKeylessSubject(), providerId, options));
|
|
23501
23529
|
const [connect, connectLink] = apiCommand(credentials, "connect", ["createCredentialConnection"]);
|
|
23502
23530
|
connect.argument("<providerId>", "OAuth provider to connect").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for connecting an OAuth provider")).requiredOption("--name <displayName>", "Name shown for the new credential in Sim (required)").action(async (providerId, options) => createConnectionLink(connectLink(), { providerId, displayName: options.name }));
|
|
23503
23531
|
const [reconnect, reconnectLink] = apiCommand(credentials, "reconnect", [
|