@firestartr/cli 2.10.0-snapshot-org-secrets-const-1 → 2.10.0-snapshot-org-secrets-4

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/build/index.js CHANGED
@@ -280314,7 +280314,7 @@ function getCronNextInterval(cronLine, tz) {
280314
280314
 
280315
280315
  /***/ }),
280316
280316
 
280317
- /***/ 99029:
280317
+ /***/ 3342:
280318
280318
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
280319
280319
 
280320
280320
  // ESM COMPAT FLAG
@@ -285979,6 +285979,66 @@ async function encryptRepoSecret(owner, repo, section, plaintextValue, octokit)
285979
285979
  }
285980
285980
  }
285981
285981
 
285982
+ ;// CONCATENATED MODULE: ../github/src/orgSecrets.ts
285983
+
285984
+
285985
+
285986
+ async function getOrgPublicKey(org, section, octokit) {
285987
+ logger.info(`Retrieving org public key for ${org} (${section})`);
285988
+ try {
285989
+ if (!octokit) {
285990
+ octokit = await getOctokitForOrg(org);
285991
+ }
285992
+ const { data } = await octokit.rest[`${section}`].getOrgPublicKey({
285993
+ org,
285994
+ });
285995
+ return data;
285996
+ }
285997
+ catch (error) {
285998
+ logger.error(`Error retrieving org public key (${section}) for ${org}: ${error}`);
285999
+ throw error;
286000
+ }
286001
+ }
286002
+ async function encryptOrgSecret(org, section, plaintextValue, preFetchedKey, octokit) {
286003
+ try {
286004
+ const { key_id, key } = preFetchedKey
286005
+ ? preFetchedKey
286006
+ : await getOrgPublicKey(org, section, octokit);
286007
+ await libsodium_wrappers.ready;
286008
+ const publicKey = libsodium_wrappers.from_base64(key, libsodium_wrappers.base64_variants.ORIGINAL);
286009
+ const secretBytes = libsodium_wrappers.from_string(plaintextValue);
286010
+ const encryptedBytes = libsodium_wrappers.crypto_box_seal(secretBytes, publicKey);
286011
+ const encryptedValue = libsodium_wrappers.to_base64(encryptedBytes, libsodium_wrappers.base64_variants.ORIGINAL);
286012
+ return {
286013
+ key_id,
286014
+ encrypted_value: encryptedValue,
286015
+ };
286016
+ }
286017
+ catch (err) {
286018
+ logger.error(`Error encrypting org secret (${section}) for ${org}: ${err}`);
286019
+ throw err;
286020
+ }
286021
+ }
286022
+ async function getOrgSecret(org, section, name, octokit) {
286023
+ logger.info(`Checking org secret ${name} (${section}) for ${org}`);
286024
+ try {
286025
+ if (!octokit) {
286026
+ octokit = await getOctokitForOrg(org);
286027
+ }
286028
+ const response = await octokit.rest[`${section}`].getOrgSecret({
286029
+ org,
286030
+ secret_name: name,
286031
+ });
286032
+ return response.data;
286033
+ }
286034
+ catch (err) {
286035
+ if (err && err.status === 404) {
286036
+ return null;
286037
+ }
286038
+ throw err;
286039
+ }
286040
+ }
286041
+
285982
286042
  ;// CONCATENATED MODULE: ../github/src/profile.ts
285983
286043
  // Profile definitions and store for github package (immutable and ambient profiles)
285984
286044
  const profileStore = new Map();
@@ -286412,6 +286472,7 @@ function withProfile(profileName) {
286412
286472
 
286413
286473
 
286414
286474
 
286475
+
286415
286476
  /* harmony default export */ const github = ({
286416
286477
  org: organization,
286417
286478
  repo: repository,
@@ -286434,6 +286495,9 @@ function withProfile(profileName) {
286434
286495
  encryption: {
286435
286496
  encryptRepoSecret: encryptRepoSecret,
286436
286497
  getRepoPublicKey: getRepoPublicKey,
286498
+ getOrgPublicKey: getOrgPublicKey,
286499
+ encryptOrgSecret: encryptOrgSecret,
286500
+ getOrgSecret: getOrgSecret,
286437
286501
  },
286438
286502
  withProfile: withProfile,
286439
286503
  createProfile: createProfile,
@@ -319334,8 +319398,8 @@ var dist = __nccwpck_require__(44516);
319334
319398
  var dist_default = /*#__PURE__*/__nccwpck_require__.n(dist);
319335
319399
  // EXTERNAL MODULE: ../catalog_common/index.ts + 44 modules
319336
319400
  var catalog_common = __nccwpck_require__(78542);
319337
- // EXTERNAL MODULE: ../github/index.ts + 37 modules
319338
- var github = __nccwpck_require__(99029);
319401
+ // EXTERNAL MODULE: ../github/index.ts + 38 modules
319402
+ var github = __nccwpck_require__(3342);
319339
319403
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/patches/base.ts
319340
319404
  class BasePatches {
319341
319405
  constructor() { }
@@ -327587,7 +327651,6 @@ function toJson_FirestartrGithubOrganizationSecretSectionSpec(obj) {
327587
327651
  'secrets': toJson_FirestartrGithubOrganizationSecretSectionSpecSecrets(obj.secrets),
327588
327652
  'context': toJson_FirestartrGithubOrganizationSecretSectionSpecContext(obj.context),
327589
327653
  'firestartr': toJson_FirestartrGithubOrganizationSecretSectionSpecFirestartr(obj.firestartr),
327590
- 'writeConnectionSecretToRef': toJson_FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef(obj.writeConnectionSecretToRef),
327591
327654
  };
327592
327655
  // filter undefined values
327593
327656
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
@@ -327637,21 +327700,6 @@ function toJson_FirestartrGithubOrganizationSecretSectionSpecFirestartr(obj) {
327637
327700
  // filter undefined values
327638
327701
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327639
327702
  }
327640
- /**
327641
- * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef' to JSON representation.
327642
- */
327643
- /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327644
- function toJson_FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef(obj) {
327645
- if (obj === undefined) {
327646
- return undefined;
327647
- }
327648
- const result = {
327649
- 'name': obj.name,
327650
- 'outputs': obj.outputs?.map(y => toJson_FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs(y)),
327651
- };
327652
- // filter undefined values
327653
- return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327654
- }
327655
327703
  /**
327656
327704
  * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsActions' to JSON representation.
327657
327705
  */
@@ -327731,20 +327779,6 @@ function toJson_FirestartrGithubOrganizationSecretSectionSpecContextProvider(obj
327731
327779
  // filter undefined values
327732
327780
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327733
327781
  }
327734
- /**
327735
- * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs' to JSON representation.
327736
- */
327737
- /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327738
- function toJson_FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs(obj) {
327739
- if (obj === undefined) {
327740
- return undefined;
327741
- }
327742
- const result = {
327743
- 'key': obj.key,
327744
- };
327745
- // filter undefined values
327746
- return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327747
- }
327748
327782
  /**
327749
327783
  * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRef' to JSON representation.
327750
327784
  */
@@ -331332,6 +331366,7 @@ class GithubOrgVariableSectionChart extends BaseGithubChart {
331332
331366
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/orgSecretSectionChart.ts
331333
331367
 
331334
331368
 
331369
+
331335
331370
  class GithubOrgSecretSectionChart extends BaseGithubChart {
331336
331371
  template() {
331337
331372
  const claim = this.get('claim');
@@ -331344,6 +331379,20 @@ class GithubOrgSecretSectionChart extends BaseGithubChart {
331344
331379
  return [];
331345
331380
  return secrets.map((secret) => {
331346
331381
  const parts = secret.value.split(':');
331382
+ const selectedRepositories = (secret.selected_repositories || []).map((ref) => {
331383
+ const match = ref.match(/^component:(.+)$/);
331384
+ if (!match) {
331385
+ throw new ChartRenderError('OrgSettingsClaim', claim.name, `Invalid component ref "${ref}" in selected_repositories. Expected format: component:<name>`);
331386
+ }
331387
+ const componentName = match[1];
331388
+ const resolvedCr = this.refResolver('ComponentClaim', componentName);
331389
+ const org = resolvedCr?.spec?.org;
331390
+ const repoName = resolvedCr?.metadata?.annotations?.['firestartr.dev/external-name'] || resolvedCr?.metadata?.name?.replace(/-[0-9a-f-]{36}$/, '');
331391
+ if (!org || !repoName) {
331392
+ throw new ChartRenderError('OrgSettingsClaim', claim.name, `Referenced component "${componentName}" has no GitHub provider configured`);
331393
+ }
331394
+ return `${org}/${repoName}`;
331395
+ });
331347
331396
  return {
331348
331397
  name: secret.name,
331349
331398
  ref: {
@@ -331352,7 +331401,7 @@ class GithubOrgSecretSectionChart extends BaseGithubChart {
331352
331401
  key: parts[3],
331353
331402
  },
331354
331403
  visibility: secret.visibility || 'all',
331355
- selectedRepositories: secret.selected_repositories || [],
331404
+ selectedRepositories,
331356
331405
  };
331357
331406
  });
331358
331407
  };
@@ -331371,7 +331420,7 @@ class GithubOrgSecretSectionChart extends BaseGithubChart {
331371
331420
  tfStateKey: firestartrId ? `${firestartrId}-secrets` : firestartrId,
331372
331421
  },
331373
331422
  writeConnectionSecretToRef: {
331374
- name: `firestartrgithuborganizationsecretsection-${githubProvider.name}-outputs`.toLowerCase(),
331423
+ name: `firestartrgithuborganizationsecretsection-${githubProvider.name}-secrets-outputs`.toLowerCase(),
331375
331424
  outputs: [{ key: 'managed_secrets' }, { key: 'secret_ids' }],
331376
331425
  },
331377
331426
  },
@@ -335189,6 +335238,7 @@ const kindPluralMap = {
335189
335238
  githuborgwebhooks: 'FirestartrGithubOrgWebhook',
335190
335239
  githuborganizationsettings: 'FirestartrGithubOrganizationSettings',
335191
335240
  githuborganizationvariablesections: 'FirestartrGithubOrganizationVariableSection',
335241
+ githuborganizationsecretsections: 'FirestartrGithubOrganizationSecretSection',
335192
335242
  terraformworkspaces: 'FirestartrTerraformWorkspace',
335193
335243
  terraformworkspaceplans: 'FirestartrTerraformWorkspacePlan',
335194
335244
  providerconfigs: 'FirestartrProviderConfig',
@@ -337167,6 +337217,7 @@ const kindsWithFinalizer = [
337167
337217
  'FirestartrGithubOrgWebhook',
337168
337218
  'FirestartrGithubOrganizationSettings',
337169
337219
  'FirestartrGithubOrganizationVariableSection',
337220
+ 'FirestartrGithubOrganizationSecretSection',
337170
337221
  'FirestartrGithubRepositorySecretsSection',
337171
337222
  ];
337172
337223
  const kindsWithDependants = [
@@ -340116,7 +340167,7 @@ async function configGit() {
340116
340167
  }
340117
340168
  // Import github dynamically to avoid Jest ESM issues when not specifically running this function
340118
340169
  // (see CONSTITUTION and RULES: must not change test machinery)
340119
- const githubModule = await Promise.resolve(/* import() */).then(__nccwpck_require__.bind(__nccwpck_require__, 99029));
340170
+ const githubModule = await Promise.resolve(/* import() */).then(__nccwpck_require__.bind(__nccwpck_require__, 3342));
340120
340171
  const github = githubModule.default || githubModule;
340121
340172
  if (external_fs_.existsSync(gitconfigPath)) {
340122
340173
  external_fs_.rmSync(gitconfigPath);
@@ -343712,6 +343763,11 @@ const MODULES = {
343712
343763
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-org-variables-section',
343713
343764
  ref: '79c1407',
343714
343765
  },
343766
+ FirestartrGithubOrganizationSecretSection: {
343767
+ module: 'git::https://github.com/prefapp/tfm.git//modules/github-org-secrets-section',
343768
+ // feat/1364-feat-add-github-org-secrets-section-module
343769
+ ref: '4380434b158bb38d0b831b0f3d1fc51e7bd509a4',
343770
+ },
343715
343771
  };
343716
343772
  function getFirestartrDefaultTFM(kind) {
343717
343773
  if (kind in MODULES) {
@@ -345602,6 +345658,194 @@ class EntityGHOrgVarsSection extends base_Entity {
345602
345658
  async loadAddressesToImport() { }
345603
345659
  }
345604
345660
 
345661
+ ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgsecretsection/secrets.ts
345662
+
345663
+
345664
+
345665
+
345666
+ const secrets_SECTIONS = ['actions', 'codespaces', 'dependabot'];
345667
+
345668
+ async function provisionOrgSecrets(entity, secrets) {
345669
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} provisioning org secrets`);
345670
+ for (const section of secrets_SECTIONS) {
345671
+ const sectionSecrets = secrets[section] || [];
345672
+ if (sectionSecrets.length === 0)
345673
+ continue;
345674
+ let preFetchedKey;
345675
+ try {
345676
+ preFetchedKey = await fetchOrgPublicKey(entity, section);
345677
+ }
345678
+ catch (err) {
345679
+ const message = err instanceof Error ? err.message : String(err);
345680
+ throw new Error(`[gh-provisioner] ${entity.k8sId} failed to fetch ${section} org public key: ${message}`);
345681
+ }
345682
+ for (const secret of sectionSecrets) {
345683
+ await provisionOrgSecret(entity, section, secret, preFetchedKey);
345684
+ }
345685
+ }
345686
+ }
345687
+ async function fetchOrgPublicKey(entity, section) {
345688
+ return (await entity.runWithGithubProvider(async () => {
345689
+ return await github["default"].encryption.getOrgPublicKey(entity.cr.spec.org, section);
345690
+ }));
345691
+ }
345692
+ async function provisionOrgSecret(entity, section, secret, preFetchedKey) {
345693
+ gh_provisioner_src_logger.info(`[gh-provisioner] provisioning org secret ${entity.k8sId}/${section}/${secret.name}`);
345694
+ if (process.env['AVOID_PROVIDER_SECRET_ENCRYPTION']) {
345695
+ await secrets_createUnencryptedSecret(entity, section, secret);
345696
+ }
345697
+ else {
345698
+ await secrets_createEncryptedSecret(entity, section, secret, preFetchedKey);
345699
+ }
345700
+ gh_provisioner_src_logger.info(`[gh-provisioner] org secret provisioned ${section}/${secret.name}`);
345701
+ }
345702
+ async function secrets_createEncryptedSecret(entity, section, secret, preFetchedKey) {
345703
+ const plainSecret = base_Entity.refResolver(secret.ref);
345704
+ const plainTextSecret = plainSecret.getOutput(secret.ref.key);
345705
+ const plaintextSha256 = external_crypto_default().createHash('sha256')
345706
+ .update(plainTextSecret)
345707
+ .digest('hex');
345708
+ const { encrypted_value } = (await entity.runWithGithubProvider(async () => {
345709
+ return await github["default"].encryption.encryptOrgSecret(entity.cr.spec.org, section, plainTextSecret, preFetchedKey);
345710
+ }));
345711
+ entity.patchData({
345712
+ op: PatchOperations.add,
345713
+ path: `/config/${section}/${secret.name}`,
345714
+ value: encrypted_value,
345715
+ });
345716
+ entity.patchData({
345717
+ op: PatchOperations.add,
345718
+ path: `/config/${section}_sha256/${secret.name}`,
345719
+ value: plaintextSha256,
345720
+ });
345721
+ }
345722
+ async function secrets_createUnencryptedSecret(entity, section, secret) {
345723
+ const plainSecret = base_Entity.refResolver(secret.ref);
345724
+ const plainTextSecret = plainSecret.getOutput(secret.ref.key);
345725
+ const plaintextSha256 = external_crypto_default().createHash('sha256')
345726
+ .update(plainTextSecret)
345727
+ .digest('hex');
345728
+ entity.patchData({
345729
+ op: PatchOperations.add,
345730
+ path: `/config/${section}/${secret.name}`,
345731
+ value: plainTextSecret,
345732
+ });
345733
+ entity.patchData({
345734
+ op: PatchOperations.add,
345735
+ path: `/config/${section}_sha256/${secret.name}`,
345736
+ value: plaintextSha256,
345737
+ });
345738
+ }
345739
+ async function adoptSecretsIfNeeded(entity, secrets) {
345740
+ const managedSecrets = entity.cr.fResolveSelfOutputs('managed_secrets') || [];
345741
+ for (const section of secrets_SECTIONS) {
345742
+ const sectionSecrets = secrets[section] || [];
345743
+ if (sectionSecrets.length === 0)
345744
+ continue;
345745
+ const declaredNames = sectionSecrets.map((s) => s.name);
345746
+ const newToModule = declaredNames.filter((name) => !managedSecrets.includes(name));
345747
+ if (newToModule.length === 0) {
345748
+ gh_provisioner_src_logger.debug(`[gh-provisioner] ${entity.k8sId} all declared ${section} secrets are already managed`);
345749
+ continue;
345750
+ }
345751
+ if (managedSecrets.length === 0) {
345752
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} no managed_secrets output — first reconciliation, treating all ${newToModule.length} ${section} secret(s) as new to module`);
345753
+ }
345754
+ for (const secretName of newToModule) {
345755
+ try {
345756
+ const existing = (await entity.runWithGithubProvider(async () => {
345757
+ return await github["default"].encryption.getOrgSecret(entity.cr.spec.org, section, secretName);
345758
+ }));
345759
+ if (existing) {
345760
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} adopting pre-existing ${section} secret '${secretName}' on GitHub org '${entity.cr.spec.org}'`);
345761
+ const resourceType = `github_${section}_organization_secret`;
345762
+ entity.patchImportData({
345763
+ op: PatchOperations.add,
345764
+ path: '/imports/-',
345765
+ value: {
345766
+ to: `${resourceType}.this["${secretName}"]`,
345767
+ id: secretName,
345768
+ },
345769
+ });
345770
+ const secretEntry = sectionSecrets.find((s) => s.name === secretName);
345771
+ if (secretEntry &&
345772
+ secretEntry.visibility === 'selected' &&
345773
+ (section === 'actions' || section === 'dependabot')) {
345774
+ const bindingType = `github_${section}_organization_secret_repositories`;
345775
+ entity.patchImportData({
345776
+ op: PatchOperations.add,
345777
+ path: '/imports/-',
345778
+ value: {
345779
+ to: `${bindingType}.this["${secretName}"]`,
345780
+ id: secretName,
345781
+ },
345782
+ });
345783
+ }
345784
+ }
345785
+ }
345786
+ catch (err) {
345787
+ if (err && err.status === 404) {
345788
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} ${section} secret '${secretName}' not found on GitHub org '${entity.cr.spec.org}' — will be created by TFM`);
345789
+ }
345790
+ else if (err && (err.status === 401 || err.status === 403)) {
345791
+ gh_provisioner_src_logger.warn(`[gh-provisioner] ${entity.k8sId} token lacks scope to check ${section} secret '${secretName}' on org '${entity.cr.spec.org}' — skipping adoption gracefully`);
345792
+ }
345793
+ else {
345794
+ gh_provisioner_src_logger.warn(`[gh-provisioner] ${entity.k8sId} unexpected error checking ${section} secret '${secretName}' on org '${entity.cr.spec.org}': ${err instanceof Error ? err.message : String(err)}`);
345795
+ }
345796
+ }
345797
+ }
345798
+ }
345799
+ }
345800
+
345801
+ ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgsecretsection/index.ts
345802
+
345803
+
345804
+
345805
+ class EntityGHOrgSecretSection extends base_Entity {
345806
+ constructor(artifact) {
345807
+ super(artifact, {
345808
+ config: {
345809
+ org: '',
345810
+ actions: {},
345811
+ codespaces: {},
345812
+ dependabot: {},
345813
+ actions_sha256: {},
345814
+ codespaces_sha256: {},
345815
+ dependabot_sha256: {},
345816
+ },
345817
+ });
345818
+ }
345819
+ async loadResources(tfOp) {
345820
+ gh_provisioner_src_logger.info(`[gh-provisioner] running ${tfOp} on ${this.k8sId}`);
345821
+ try {
345822
+ const cr = this.cr;
345823
+ const org = cr.spec.org;
345824
+ const secrets = cr.spec.secrets || {};
345825
+ this.patchData({
345826
+ op: PatchOperations.replace,
345827
+ path: '/config/org',
345828
+ value: org,
345829
+ });
345830
+ await provisionOrgSecrets(this, secrets);
345831
+ const redactedDoc = JSON.parse(JSON.stringify(this._document, (key, value) => typeof value === 'string' && value.length > 50 ? '[REDACTED]' : value));
345832
+ this.synthMessage(`[gh-provisioner] ${this.k8sId} config:\n${JSON.stringify(redactedDoc, null, 2)}`);
345833
+ this.synthEnd(`[gh-provisioner] ${this.k8sId} loaded its data`);
345834
+ if (tfOp === 'apply') {
345835
+ await adoptSecretsIfNeeded(this, secrets);
345836
+ }
345837
+ gh_provisioner_src_logger.debug(`[gh-provisioner] ${this.k8sId} loaded its data`);
345838
+ }
345839
+ catch (err) {
345840
+ const message = err instanceof Error ? err.message : String(err);
345841
+ gh_provisioner_src_logger.error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
345842
+ throw new Error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
345843
+ }
345844
+ }
345845
+ async postProvision(_tfOp) { }
345846
+ async loadAddressesToImport() { }
345847
+ }
345848
+
345605
345849
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgwebhook/index.ts
345606
345850
 
345607
345851
 
@@ -345679,6 +345923,7 @@ class EntityGHOrgWebHook extends base_Entity {
345679
345923
 
345680
345924
 
345681
345925
 
345926
+
345682
345927
  function entities_getEntity(cr) {
345683
345928
  const entityClass = getEntityClass(cr.kind);
345684
345929
  return new entityClass(cr);
@@ -345701,6 +345946,8 @@ function getEntityClass(kind) {
345701
345946
  return EntityGHOrgSettings;
345702
345947
  case 'FirestartrGithubOrganizationVariableSection':
345703
345948
  return EntityGHOrgVarsSection;
345949
+ case 'FirestartrGithubOrganizationSecretSection':
345950
+ return EntityGHOrgSecretSection;
345704
345951
  default:
345705
345952
  throw new Error(`kind ${kind} has no entity associated`);
345706
345953
  }
@@ -347450,6 +347697,7 @@ const provisionImplementations = {
347450
347697
  githuborgwebhooks: process_operation_processOperation,
347451
347698
  githuborganizationsettings: process_operation_processOperation,
347452
347699
  githuborganizationvariablesections: process_operation_processOperation,
347700
+ githuborganizationsecretsections: process_operation_processOperation,
347453
347701
  fsdummiesa: processFirestartrDummies,
347454
347702
  fsdummiesb: processFirestartrDummies,
347455
347703
  fsdummiesc: processFirestartrDummies,
@@ -526268,7 +526516,7 @@ const crsStatusSubcommand = {
526268
526516
  };
526269
526517
 
526270
526518
  ;// CONCATENATED MODULE: ./package.json
526271
- const package_namespaceObject = JSON.parse('{"i8":"2.10.0-snapshot-org-secrets-const-1"}');
526519
+ const package_namespaceObject = JSON.parse('{"i8":"2.10.0-snapshot-org-secrets-4"}');
526272
526520
  ;// CONCATENATED MODULE: ../../package.json
526273
526521
  const package_namespaceObject_1 = {"i8":"2.9.0"};
526274
526522
  // EXTERNAL MODULE: ../../node_modules/semver/index.js
@@ -595,10 +595,6 @@ export interface FirestartrGithubOrganizationSecretSectionSpec {
595
595
  * @schema FirestartrGithubOrganizationSecretSectionSpec#firestartr
596
596
  */
597
597
  readonly firestartr: FirestartrGithubOrganizationSecretSectionSpecFirestartr;
598
- /**
599
- * @schema FirestartrGithubOrganizationSecretSectionSpec#writeConnectionSecretToRef
600
- */
601
- readonly writeConnectionSecretToRef: FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef;
602
598
  }
603
599
  /**
604
600
  * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpec' to JSON representation.
@@ -657,23 +653,6 @@ export interface FirestartrGithubOrganizationSecretSectionSpecFirestartr {
657
653
  * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecFirestartr' to JSON representation.
658
654
  */
659
655
  export declare function toJson_FirestartrGithubOrganizationSecretSectionSpecFirestartr(obj: FirestartrGithubOrganizationSecretSectionSpecFirestartr | undefined): Record<string, any> | undefined;
660
- /**
661
- * @schema FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef
662
- */
663
- export interface FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef {
664
- /**
665
- * @schema FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef#name
666
- */
667
- readonly name: string;
668
- /**
669
- * @schema FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef#outputs
670
- */
671
- readonly outputs: FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs[];
672
- }
673
- /**
674
- * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef' to JSON representation.
675
- */
676
- export declare function toJson_FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef(obj: FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRef | undefined): Record<string, any> | undefined;
677
656
  /**
678
657
  * @schema FirestartrGithubOrganizationSecretSectionSpecSecretsActions
679
658
  */
@@ -799,19 +778,6 @@ export interface FirestartrGithubOrganizationSecretSectionSpecContextProvider {
799
778
  * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecContextProvider' to JSON representation.
800
779
  */
801
780
  export declare function toJson_FirestartrGithubOrganizationSecretSectionSpecContextProvider(obj: FirestartrGithubOrganizationSecretSectionSpecContextProvider | undefined): Record<string, any> | undefined;
802
- /**
803
- * @schema FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs
804
- */
805
- export interface FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs {
806
- /**
807
- * @schema FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs#key
808
- */
809
- readonly key: string;
810
- }
811
- /**
812
- * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs' to JSON representation.
813
- */
814
- export declare function toJson_FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs(obj: FirestartrGithubOrganizationSecretSectionSpecWriteConnectionSecretToRefOutputs | undefined): Record<string, any> | undefined;
815
781
  /**
816
782
  * A reference to the Kubernetes Secret resource that contains the value.
817
783
  *
@@ -0,0 +1,7 @@
1
+ import { Entity } from '../base';
2
+ export declare class EntityGHOrgSecretSection extends Entity {
3
+ constructor(artifact: any);
4
+ loadResources(tfOp: string): Promise<void>;
5
+ postProvision(_tfOp: string): Promise<void>;
6
+ loadAddressesToImport(): Promise<void>;
7
+ }
@@ -0,0 +1,16 @@
1
+ import type { EntityGHOrgSecretSection } from '.';
2
+ import { type OrgSecretsSection } from 'github';
3
+ export type SecretEntry = {
4
+ name: string;
5
+ ref: {
6
+ kind: string;
7
+ name: string;
8
+ key: string;
9
+ };
10
+ visibility: string;
11
+ selectedRepositories?: string[];
12
+ };
13
+ declare const SECTIONS: OrgSecretsSection[];
14
+ export { SECTIONS };
15
+ export declare function provisionOrgSecrets(entity: EntityGHOrgSecretSection, secrets: Record<string, SecretEntry[]>): Promise<void>;
16
+ export declare function adoptSecretsIfNeeded(entity: EntityGHOrgSecretSection, secrets: Record<string, SecretEntry[]>): Promise<void>;
@@ -2,7 +2,9 @@ import { createCheckRun } from './src/check_run';
2
2
  import { upsertMultiPartStickyComments } from './src/sticky_comment';
3
3
  import { getOctokitForOrg, getGithubAppToken, getOctokitFromPat } from './src/auth';
4
4
  import { encryptRepoSecret, getRepoPublicKey } from './src/encrypt';
5
+ import { getOrgPublicKey, encryptOrgSecret, getOrgSecret } from './src/orgSecrets';
5
6
  import type { RepoSecretsSection } from './src/encrypt';
7
+ import type { OrgSecretsSection } from './src/orgSecrets';
6
8
  import type { WorkflowCompletionResult, WorkflowDispatchInputs, WorkflowRunConclusion, WorkflowRunStatus, WorkflowRunStatusFilter, WorkflowRunSummary } from './src/workflow';
7
9
  import { withProfile } from './src/with_profile';
8
10
  import { createProfile } from './src/profile';
@@ -103,10 +105,14 @@ declare const _default: {
103
105
  encryption: {
104
106
  encryptRepoSecret: typeof encryptRepoSecret;
105
107
  getRepoPublicKey: typeof getRepoPublicKey;
108
+ getOrgPublicKey: typeof getOrgPublicKey;
109
+ encryptOrgSecret: typeof encryptOrgSecret;
110
+ getOrgSecret: typeof getOrgSecret;
106
111
  };
107
112
  withProfile: typeof withProfile;
108
113
  createProfile: typeof createProfile;
109
114
  };
110
115
  export default _default;
111
- export { RepoSecretsSection, createProfile };
116
+ export { createProfile };
117
+ export type { RepoSecretsSection, OrgSecretsSection };
112
118
  export type { WorkflowCompletionResult, WorkflowDispatchInputs, WorkflowRunConclusion, WorkflowRunStatus, WorkflowRunStatusFilter, WorkflowRunSummary, };
@@ -0,0 +1,10 @@
1
+ export type OrgSecretsSection = 'actions' | 'dependabot' | 'codespaces';
2
+ export declare function getOrgPublicKey(org: string, section: OrgSecretsSection, octokit?: any): Promise<any>;
3
+ export declare function encryptOrgSecret(org: string, section: OrgSecretsSection, plaintextValue: string, preFetchedKey?: {
4
+ key_id: string;
5
+ key: string;
6
+ }, octokit?: any): Promise<{
7
+ key_id: any;
8
+ encrypted_value: string;
9
+ }>;
10
+ export declare function getOrgSecret(org: string, section: OrgSecretsSection, name: string, octokit?: any): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.10.0-snapshot-org-secrets-const-1",
3
+ "version": "2.10.0-snapshot-org-secrets-4",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",