@geekmidas/cli 10.0.0-alpha.160 → 10.0.0-alpha.161
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/{GoDaddyProvider-DkUMcMYy.cjs → GoDaddyProvider-CBqsvbER.cjs} +2 -2
- package/dist/{GoDaddyProvider-DkUMcMYy.cjs.map → GoDaddyProvider-CBqsvbER.cjs.map} +1 -1
- package/dist/{GoDaddyProvider-C9dDlH9I.mjs → GoDaddyProvider-CwqdLM1E.mjs} +2 -2
- package/dist/{GoDaddyProvider-C9dDlH9I.mjs.map → GoDaddyProvider-CwqdLM1E.mjs.map} +1 -1
- package/dist/{HostingerProvider-9faYOQnQ.cjs → HostingerProvider-DtOtsFkM.cjs} +2 -2
- package/dist/{HostingerProvider-9faYOQnQ.cjs.map → HostingerProvider-DtOtsFkM.cjs.map} +1 -1
- package/dist/{HostingerProvider-BEuKG2gz.mjs → HostingerProvider-gD4uqzMN.mjs} +2 -2
- package/dist/{HostingerProvider-BEuKG2gz.mjs.map → HostingerProvider-gD4uqzMN.mjs.map} +1 -1
- package/dist/{LegacyStateStore-DPKhjUR6.mjs → LegacyStateStore-6xsGADme.mjs} +3 -3
- package/dist/{LegacyStateStore-DPKhjUR6.mjs.map → LegacyStateStore-6xsGADme.mjs.map} +1 -1
- package/dist/{LegacyStateStore-C44jUnMH.cjs → LegacyStateStore-C0rm5slD.cjs} +3 -3
- package/dist/{LegacyStateStore-C44jUnMH.cjs.map → LegacyStateStore-C0rm5slD.cjs.map} +1 -1
- package/dist/{LocalStateStore-BU3fWkcT.mjs → LocalStateStore-G0JHXOVW.mjs} +2 -2
- package/dist/{LocalStateStore-BU3fWkcT.mjs.map → LocalStateStore-G0JHXOVW.mjs.map} +1 -1
- package/dist/{LocalStateStore-B95WE99i.cjs → LocalStateStore-NBMF3zCb.cjs} +2 -2
- package/dist/{LocalStateStore-B95WE99i.cjs.map → LocalStateStore-NBMF3zCb.cjs.map} +1 -1
- package/dist/{S3StateStore-zU5kClhd.cjs → S3StateStore-7n6gIYEJ.cjs} +4 -4
- package/dist/{S3StateStore-zU5kClhd.cjs.map → S3StateStore-7n6gIYEJ.cjs.map} +1 -1
- package/dist/{S3StateStore-Cpbeijr5.mjs → S3StateStore-B7IPTvu0.mjs} +4 -4
- package/dist/{S3StateStore-Cpbeijr5.mjs.map → S3StateStore-B7IPTvu0.mjs.map} +1 -1
- package/dist/{SSMStateStore-BxkKMBi_.mjs → SSMStateStore-CWEShHLS.mjs} +2 -2
- package/dist/{SSMStateStore-BxkKMBi_.mjs.map → SSMStateStore-CWEShHLS.mjs.map} +1 -1
- package/dist/{SSMStateStore-D9uviQ3T.cjs → SSMStateStore-O12NeGEg.cjs} +2 -2
- package/dist/{SSMStateStore-D9uviQ3T.cjs.map → SSMStateStore-O12NeGEg.cjs.map} +1 -1
- package/dist/{add-Dj-gtqTO.mjs → add-C-nlqQgN.mjs} +4 -4
- package/dist/{add-Dj-gtqTO.mjs.map → add-C-nlqQgN.mjs.map} +1 -1
- package/dist/{add-Bb2IL3Yq.cjs → add-ktNZmJb-.cjs} +4 -4
- package/dist/{add-Bb2IL3Yq.cjs.map → add-ktNZmJb-.cjs.map} +1 -1
- package/dist/{apps-FRNlECwi.mjs → apps-C7SujLV-.mjs} +3 -3
- package/dist/{apps-FRNlECwi.mjs.map → apps-C7SujLV-.mjs.map} +1 -1
- package/dist/{apps-0vc4Oz9_.cjs → apps-CtjYJS9e.cjs} +3 -3
- package/dist/{apps-0vc4Oz9_.cjs.map → apps-CtjYJS9e.cjs.map} +1 -1
- package/dist/{aws-8QQ8n-t6.mjs → aws-C5LAU_Ii.mjs} +10 -2
- package/dist/aws-C5LAU_Ii.mjs.map +1 -0
- package/dist/{aws-DY9NqQIT.cjs → aws-DKC2m3sT.cjs} +9 -1
- package/dist/aws-DKC2m3sT.cjs.map +1 -0
- package/dist/{bundler-Bg2eEFEh.cjs → bundler-DGwgZmim.cjs} +6 -6
- package/dist/{bundler-Bg2eEFEh.cjs.map → bundler-DGwgZmim.cjs.map} +1 -1
- package/dist/{bundler-9EM4ZHcu.mjs → bundler-DnHKVaZz.mjs} +6 -6
- package/dist/{bundler-9EM4ZHcu.mjs.map → bundler-DnHKVaZz.mjs.map} +1 -1
- package/dist/{cli-CmoSOzNq.mjs → cli-CI9v138l.mjs} +4 -4
- package/dist/{cli-CmoSOzNq.mjs.map → cli-CI9v138l.mjs.map} +1 -1
- package/dist/{cli-YtLjcAZT.cjs → cli-k2G7rG15.cjs} +4 -4
- package/dist/{cli-YtLjcAZT.cjs.map → cli-k2G7rG15.cjs.map} +1 -1
- package/dist/{compose-CW1DGfYc.cjs → compose-BD2rwRfn.cjs} +4 -4
- package/dist/{compose-CW1DGfYc.cjs.map → compose-BD2rwRfn.cjs.map} +1 -1
- package/dist/{compose-3AtZF7ul.mjs → compose-Co-Dt-a4.mjs} +4 -4
- package/dist/{compose-3AtZF7ul.mjs.map → compose-Co-Dt-a4.mjs.map} +1 -1
- package/dist/{compose-D7gOSspy.cjs → compose-nGgRylPu.cjs} +16 -10
- package/dist/compose-nGgRylPu.cjs.map +1 -0
- package/dist/{compose-CnXZAYNM.mjs → compose-reJW9x-G.mjs} +16 -10
- package/dist/compose-reJW9x-G.mjs.map +1 -0
- package/dist/{config-CkuiD9Jv.d.cts → config-C60T2h98.d.cts} +3 -3
- package/dist/{config-BNmLn0dw.d.mts.map → config-C60T2h98.d.cts.map} +1 -1
- package/dist/{config-BNmLn0dw.d.mts → config-CfI2g_Ho.d.mts} +3 -3
- package/dist/{config-CkuiD9Jv.d.cts.map → config-CfI2g_Ho.d.mts.map} +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/{credentials-CjFtNBVH.mjs → credentials-BG1KOq9I.mjs} +11 -7
- package/dist/credentials-BG1KOq9I.mjs.map +1 -0
- package/dist/{credentials-DwIRfeBL.cjs → credentials-UlL1n_Rd.cjs} +11 -7
- package/dist/credentials-UlL1n_Rd.cjs.map +1 -0
- package/dist/deploy/public.cjs +11 -11
- package/dist/deploy/public.d.cts +4 -4
- package/dist/deploy/public.d.mts +4 -4
- package/dist/deploy/public.mjs +11 -11
- package/dist/{deploy-3bsiWJxj.cjs → deploy-CqIULk0k.cjs} +57 -557
- package/dist/deploy-CqIULk0k.cjs.map +1 -0
- package/dist/{deploy-BI3fHnyb.mjs → deploy-DRkCNV7f.mjs} +16 -516
- package/dist/deploy-DRkCNV7f.mjs.map +1 -0
- package/dist/destroy-CMldkiX-.cjs +789 -0
- package/dist/destroy-CMldkiX-.cjs.map +1 -0
- package/dist/destroy-DXIAL8nF.mjs +788 -0
- package/dist/destroy-DXIAL8nF.mjs.map +1 -0
- package/dist/{docker-DPdn7tYJ.mjs → docker-DFFzQe2f.mjs} +4 -4
- package/dist/{docker-DPdn7tYJ.mjs.map → docker-DFFzQe2f.mjs.map} +1 -1
- package/dist/{docker-CwayjAF2.cjs → docker-LwJW3dx_.cjs} +4 -4
- package/dist/{docker-CwayjAF2.cjs.map → docker-LwJW3dx_.cjs.map} +1 -1
- package/dist/{dokploy-tmnH0Du_.mjs → dokploy-DYm0D6Tp.mjs} +2 -2
- package/dist/{dokploy-tmnH0Du_.mjs.map → dokploy-DYm0D6Tp.mjs.map} +1 -1
- package/dist/{dokploy-BMBL-_Xu.cjs → dokploy-wTsJqG-N.cjs} +2 -2
- package/dist/{dokploy-BMBL-_Xu.cjs.map → dokploy-wTsJqG-N.cjs.map} +1 -1
- package/dist/{eas-BVGQAUDc.mjs → eas-BJ_Zlvm8.mjs} +2 -2
- package/dist/{eas-BVGQAUDc.mjs.map → eas-BJ_Zlvm8.mjs.map} +1 -1
- package/dist/{eas-meN1xady.cjs → eas-C4EkjTGJ.cjs} +2 -2
- package/dist/{eas-meN1xady.cjs.map → eas-C4EkjTGJ.cjs.map} +1 -1
- package/dist/{encryption-DvFVZdGz.cjs → encryption-BQEqqrGq.cjs} +2 -2
- package/dist/{encryption-DvFVZdGz.cjs.map → encryption-BQEqqrGq.cjs.map} +1 -1
- package/dist/{encryption-C8AMbomA.mjs → encryption-Cu5YTs9V.mjs} +2 -2
- package/dist/{encryption-C8AMbomA.mjs.map → encryption-Cu5YTs9V.mjs.map} +1 -1
- package/dist/{engine-BmiIUVWa.cjs → engine-DdRauUQC.cjs} +9 -9
- package/dist/{engine-BmiIUVWa.cjs.map → engine-DdRauUQC.cjs.map} +1 -1
- package/dist/{engine-BbWj0w3F.mjs → engine-q8aCVbLH.mjs} +9 -9
- package/dist/{engine-BbWj0w3F.mjs.map → engine-q8aCVbLH.mjs.map} +1 -1
- package/dist/{github-Dc1daUbH.mjs → github-CoXirRes.mjs} +9 -8
- package/dist/{github-Dc1daUbH.mjs.map → github-CoXirRes.mjs.map} +1 -1
- package/dist/{github-BWqQr8q6.cjs → github-OVZF2k0L.cjs} +13 -12
- package/dist/{github-BWqQr8q6.cjs.map → github-OVZF2k0L.cjs.map} +1 -1
- package/dist/{googlePlay-CdVCdfU8.cjs → googlePlay-CUeTUT7s.cjs} +4 -4
- package/dist/{googlePlay-CdVCdfU8.cjs.map → googlePlay-CUeTUT7s.cjs.map} +1 -1
- package/dist/{googlePlay-ByaFUly7.mjs → googlePlay-HXRRVq0l.mjs} +4 -4
- package/dist/{googlePlay-ByaFUly7.mjs.map → googlePlay-HXRRVq0l.mjs.map} +1 -1
- package/dist/iam-6LH6wptf.cjs +618 -0
- package/dist/iam-6LH6wptf.cjs.map +1 -0
- package/dist/iam-c0e8m04X.mjs +509 -0
- package/dist/iam-c0e8m04X.mjs.map +1 -0
- package/dist/{index-Dv1Zj86i.d.mts → index-DDY0cZCo.d.cts} +2 -2
- package/dist/{index-B35vTdAW.d.cts.map → index-DDY0cZCo.d.cts.map} +1 -1
- package/dist/{index-B35vTdAW.d.cts → index-DWNwkcy7.d.mts} +2 -2
- package/dist/{index-Dv1Zj86i.d.mts.map → index-DWNwkcy7.d.mts.map} +1 -1
- package/dist/index.cjs +98 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +98 -77
- package/dist/index.mjs.map +1 -1
- package/dist/{local-CnVFHJjS.mjs → local-CCJ-T37d.mjs} +2 -2
- package/dist/{local-CnVFHJjS.mjs.map → local-CCJ-T37d.mjs.map} +1 -1
- package/dist/{local-qevrV6dZ.cjs → local-Dx0o6vfp.cjs} +2 -2
- package/dist/{local-qevrV6dZ.cjs.map → local-Dx0o6vfp.cjs.map} +1 -1
- package/dist/{migrate-DgfKZB41.mjs → migrate-BkwSXhxv.mjs} +4 -4
- package/dist/{migrate-DgfKZB41.mjs.map → migrate-BkwSXhxv.mjs.map} +1 -1
- package/dist/{migrate-CU8_ZWP1.cjs → migrate-CJoKOCGY.cjs} +4 -4
- package/dist/{migrate-CU8_ZWP1.cjs.map → migrate-CJoKOCGY.cjs.map} +1 -1
- package/dist/{migrate-CRRps1i6.cjs → migrate-DEsYfgzn.cjs} +4 -4
- package/dist/{migrate-CRRps1i6.cjs.map → migrate-DEsYfgzn.cjs.map} +1 -1
- package/dist/{migrate-BEuCcCwN.mjs → migrate-Dr0BeWsY.mjs} +4 -4
- package/dist/{migrate-BEuCcCwN.mjs.map → migrate-Dr0BeWsY.mjs.map} +1 -1
- package/dist/{notes-CIzrdBKE.mjs → notes-BOyzuPqr.mjs} +2 -2
- package/dist/{notes-CIzrdBKE.mjs.map → notes-BOyzuPqr.mjs.map} +1 -1
- package/dist/{notes-BrBnyZz5.cjs → notes-VFPa51Pd.cjs} +2 -2
- package/dist/{notes-BrBnyZz5.cjs.map → notes-VFPa51Pd.cjs.map} +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/{projectBucket-CDJd3prK.mjs → projectBucket-B26ucBRI.mjs} +2 -2
- package/dist/{projectBucket-CDJd3prK.mjs.map → projectBucket-B26ucBRI.mjs.map} +1 -1
- package/dist/{projectBucket-CKr_zObJ.cjs → projectBucket-CWpY3Vxv.cjs} +2 -2
- package/dist/{projectBucket-CKr_zObJ.cjs.map → projectBucket-CWpY3Vxv.cjs.map} +1 -1
- package/dist/{publish-Bq96_QnK.mjs → publish-Bg4iffje.mjs} +2 -2
- package/dist/{publish-Bq96_QnK.mjs.map → publish-Bg4iffje.mjs.map} +1 -1
- package/dist/{publish-DMKXh1Tb.cjs → publish-IjcRoorJ.cjs} +2 -2
- package/dist/{publish-DMKXh1Tb.cjs.map → publish-IjcRoorJ.cjs.map} +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-DF9GrosZ.cjs → resolve-CgVDhWW8.cjs} +4 -4
- package/dist/{resolve-DF9GrosZ.cjs.map → resolve-CgVDhWW8.cjs.map} +1 -1
- package/dist/{resolve-CSsE7frp.mjs → resolve-rw7mLp5E.mjs} +4 -4
- package/dist/{resolve-CSsE7frp.mjs.map → resolve-rw7mLp5E.mjs.map} +1 -1
- package/dist/{rollback-CZthwqus.mjs → rollback-Cv02Cnky.mjs} +6 -6
- package/dist/{rollback-CZthwqus.mjs.map → rollback-Cv02Cnky.mjs.map} +1 -1
- package/dist/{rollback-BBFGGmMa.cjs → rollback-vdkPi_Rm.cjs} +6 -6
- package/dist/{rollback-BBFGGmMa.cjs.map → rollback-vdkPi_Rm.cjs.map} +1 -1
- package/dist/{runtime-CFvcLEJW.d.cts → runtime-D-rOcRoq.d.cts} +2 -2
- package/dist/{runtime-CFvcLEJW.d.cts.map → runtime-D-rOcRoq.d.cts.map} +1 -1
- package/dist/{runtime-dwsH6ddo.d.mts → runtime-DG1mNh_5.d.mts} +2 -2
- package/dist/{runtime-dwsH6ddo.d.mts.map → runtime-DG1mNh_5.d.mts.map} +1 -1
- package/dist/{s3-CI2QYgXH.cjs → s3-DIvAtJwk.cjs} +27 -2
- package/dist/s3-DIvAtJwk.cjs.map +1 -0
- package/dist/{s3-BBRkezf7.mjs → s3-DmsM_V2R.mjs} +28 -3
- package/dist/s3-DmsM_V2R.mjs.map +1 -0
- package/dist/{secretsManager-CQORubp9.mjs → secretsManager-CJyxFcBH.mjs} +18 -2
- package/dist/secretsManager-CJyxFcBH.mjs.map +1 -0
- package/dist/{secretsManager-RAGcEDX1.cjs → secretsManager-D8on44WI.cjs} +17 -1
- package/dist/secretsManager-D8on44WI.cjs.map +1 -0
- package/dist/{seeds-B3xvUAQf.cjs → seeds-D7q1zKCJ.cjs} +7 -1
- package/dist/{seeds-B3xvUAQf.cjs.map → seeds-D7q1zKCJ.cjs.map} +1 -1
- package/dist/{seeds-BCC8vAXR.mjs → seeds-y1rzXlAc.mjs} +2 -2
- package/dist/{seeds-BCC8vAXR.mjs.map → seeds-y1rzXlAc.mjs.map} +1 -1
- package/dist/{serverSetup-C4iAABtI.mjs → serverSetup-CvcN4zJQ.mjs} +6 -6
- package/dist/{serverSetup-C4iAABtI.mjs.map → serverSetup-CvcN4zJQ.mjs.map} +1 -1
- package/dist/{serverSetup-Dt2DTlwa.cjs → serverSetup-qXIRRhgw.cjs} +6 -6
- package/dist/{serverSetup-Dt2DTlwa.cjs.map → serverSetup-qXIRRhgw.cjs.map} +1 -1
- package/dist/{sniffer-bTrGuu9z.cjs → sniffer-CGfL25Bc.cjs} +7 -7
- package/dist/{sniffer-bTrGuu9z.cjs.map → sniffer-CGfL25Bc.cjs.map} +1 -1
- package/dist/{sniffer-C2Ot1IbK.mjs → sniffer-DuKVVAs_.mjs} +7 -7
- package/dist/{sniffer-C2Ot1IbK.mjs.map → sniffer-DuKVVAs_.mjs.map} +1 -1
- package/dist/{snsSubscriptions-CFKb7fv0.cjs → snsSubscriptions-DPfGjpuB.cjs} +8 -2
- package/dist/{snsSubscriptions-CFKb7fv0.cjs.map → snsSubscriptions-DPfGjpuB.cjs.map} +1 -1
- package/dist/{snsSubscriptions-QDDDn9Qi.mjs → snsSubscriptions-nnSUW2Eh.mjs} +3 -3
- package/dist/{snsSubscriptions-QDDDn9Qi.mjs.map → snsSubscriptions-nnSUW2Eh.mjs.map} +1 -1
- package/dist/{sst-DDRWlXdv.mjs → sst-Bw7686br.mjs} +4 -4
- package/dist/{sst-DDRWlXdv.mjs.map → sst-Bw7686br.mjs.map} +1 -1
- package/dist/{sst-iRdMlGKd.cjs → sst-Md7c1UC_.cjs} +4 -4
- package/dist/{sst-iRdMlGKd.cjs.map → sst-Md7c1UC_.cjs.map} +1 -1
- package/dist/{stack-CIOY44aC.mjs → stack-D2cLLaO-.mjs} +6 -6
- package/dist/{stack-CIOY44aC.mjs.map → stack-D2cLLaO-.mjs.map} +1 -1
- package/dist/{stack-B9iDYMrq.cjs → stack-DTcnynGb.cjs} +6 -6
- package/dist/{stack-B9iDYMrq.cjs.map → stack-DTcnynGb.cjs.map} +1 -1
- package/dist/{stage-DA74aD_V.mjs → stage-Bw3bJ7Au.mjs} +5 -5
- package/dist/{stage-DA74aD_V.mjs.map → stage-Bw3bJ7Au.mjs.map} +1 -1
- package/dist/{stage-ycFS9mVn.cjs → stage-RLOenlHV.cjs} +5 -5
- package/dist/{stage-ycFS9mVn.cjs.map → stage-RLOenlHV.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-RxfbNUwl.cjs → terminal-C-_cMKTY.cjs} +2 -2
- package/dist/{terminal-RxfbNUwl.cjs.map → terminal-C-_cMKTY.cjs.map} +1 -1
- package/dist/{terminal-DX22WLvT.mjs → terminal-Dq29bK3u.mjs} +2 -2
- package/dist/{terminal-DX22WLvT.mjs.map → terminal-Dq29bK3u.mjs.map} +1 -1
- package/dist/{types-Dk--xVOT.d.cts → types-CvucX3yD.d.mts} +7 -2
- package/dist/types-CvucX3yD.d.mts.map +1 -0
- package/dist/{types-DwQYpd_0.d.mts → types-D1C8pUyh.d.cts} +8 -1
- package/dist/types-D1C8pUyh.d.cts.map +1 -0
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/package.json +15 -15
- package/dist/aws-8QQ8n-t6.mjs.map +0 -1
- package/dist/aws-DY9NqQIT.cjs.map +0 -1
- package/dist/compose-CnXZAYNM.mjs.map +0 -1
- package/dist/compose-D7gOSspy.cjs.map +0 -1
- package/dist/credentials-CjFtNBVH.mjs.map +0 -1
- package/dist/credentials-DwIRfeBL.cjs.map +0 -1
- package/dist/deploy-3bsiWJxj.cjs.map +0 -1
- package/dist/deploy-BI3fHnyb.mjs.map +0 -1
- package/dist/s3-BBRkezf7.mjs.map +0 -1
- package/dist/s3-CI2QYgXH.cjs.map +0 -1
- package/dist/secretsManager-CQORubp9.mjs.map +0 -1
- package/dist/secretsManager-RAGcEDX1.cjs.map +0 -1
- package/dist/types-Dk--xVOT.d.cts.map +0 -1
- package/dist/types-DwQYpd_0.d.mts.map +0 -1
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
+
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
3
|
+
const require_workspace = require("./workspace-1szcahj9.cjs");
|
|
4
|
+
let node_crypto = require("node:crypto");
|
|
5
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
6
|
+
let _geekmidas_storage_s3_url = require("@geekmidas/storage/s3-url");
|
|
7
|
+
_geekmidas_storage_s3_url = require_rolldown_runtime.__toESM(_geekmidas_storage_s3_url, 1);
|
|
8
|
+
const SUFFIX_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
9
|
+
/** A name that S3 would refuse — what the name builder never returns. */
|
|
10
|
+
var InvalidBucketName = class extends require_errors.GkmError {
|
|
11
|
+
bucket;
|
|
12
|
+
reason;
|
|
13
|
+
constructor(bucket, reason) {
|
|
14
|
+
super(`'${bucket}' is not a valid S3 bucket name: ${reason}. Rename the construct or set deploy.namespace in gkm.config.ts to something that leaves room for it.`);
|
|
15
|
+
this.bucket = bucket;
|
|
16
|
+
this.reason = reason;
|
|
17
|
+
this.name = "InvalidBucketName";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/** Lowercase `[a-z0-9-]`, runs of anything else one `-`, no edge dashes. */
|
|
21
|
+
function part(value) {
|
|
22
|
+
return (0, _geekmidas_manifest.kebabCase)(value).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* `parts` joined by `-`, shortened to `max` characters by trimming the longest
|
|
26
|
+
* part one character at a time — so a long construct id gives way before a
|
|
27
|
+
* short stage name does, and every part keeps its start.
|
|
28
|
+
*/
|
|
29
|
+
function fitParts(parts, max) {
|
|
30
|
+
const kept = parts.map(part).filter(Boolean);
|
|
31
|
+
const length = () => kept.reduce((sum, p) => sum + p.length, 0) + kept.length - 1;
|
|
32
|
+
while (length() > max) {
|
|
33
|
+
let longest = 0;
|
|
34
|
+
for (let i = 1; i < kept.length; i++) if (kept[i].length > kept[longest].length) longest = i;
|
|
35
|
+
if (kept[longest].length <= 1) break;
|
|
36
|
+
kept[longest] = kept[longest].slice(0, -1).replace(/-+$/, "");
|
|
37
|
+
}
|
|
38
|
+
return kept.join("-");
|
|
39
|
+
}
|
|
40
|
+
/** Why `name` is not a valid bucket name, or undefined when it is. */
|
|
41
|
+
function bucketNameProblem(name) {
|
|
42
|
+
if (name.length < 3 || name.length > 63) return `it is ${name.length} characters, and S3 takes 3 to 63`;
|
|
43
|
+
if (!/^[a-z0-9-]+$/.test(name)) return "it may hold only lowercase letters, digits and -";
|
|
44
|
+
if (!/^[a-z0-9].*[a-z0-9]$/.test(name)) return "it must start and end with a letter or a digit";
|
|
45
|
+
if (name.startsWith("xn--") || name.startsWith("sthree-")) return "it starts with a prefix S3 reserves ('xn--', 'sthree-')";
|
|
46
|
+
if (name.endsWith("-s3alias") || name.endsWith("--ol-s3")) return "it ends with a suffix S3 reserves ('-s3alias', '--ol-s3')";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The good name: `<namespace>-<project>-<stage>-<bucket id>`, lowercased, no
|
|
50
|
+
* dots, shortened to leave room for a clash's suffix.
|
|
51
|
+
*
|
|
52
|
+
* @throws {InvalidBucketName} when nothing usable is left
|
|
53
|
+
*/
|
|
54
|
+
function bucketName(input) {
|
|
55
|
+
const name = fitParts([
|
|
56
|
+
input.scope,
|
|
57
|
+
input.stage,
|
|
58
|
+
input.id
|
|
59
|
+
], 56);
|
|
60
|
+
const problem = bucketNameProblem(name);
|
|
61
|
+
if (problem) throw new InvalidBucketName(name, problem);
|
|
62
|
+
return name;
|
|
63
|
+
}
|
|
64
|
+
/** Six random `[a-z0-9]` characters. */
|
|
65
|
+
function randomSuffix(random = node_crypto.randomInt) {
|
|
66
|
+
let suffix = "";
|
|
67
|
+
for (let i = 0; i < 6; i++) suffix += SUFFIX_ALPHABET[random(36)];
|
|
68
|
+
return suffix;
|
|
69
|
+
}
|
|
70
|
+
/** The good name with a clash's suffix. */
|
|
71
|
+
function suffixedBucketName(good, suffix) {
|
|
72
|
+
return `${good}-${suffix}`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The IAM user a bucket is reached with on a stage:
|
|
76
|
+
* `gkm-<project>-<stage>-<bucket id>`, at most 64 characters.
|
|
77
|
+
*/
|
|
78
|
+
function iamUserName(input) {
|
|
79
|
+
return fitParts([
|
|
80
|
+
"gkm",
|
|
81
|
+
input.scope,
|
|
82
|
+
input.stage,
|
|
83
|
+
input.id
|
|
84
|
+
], 64);
|
|
85
|
+
}
|
|
86
|
+
/** The path every user gkm creates is under, so it finds its own. */
|
|
87
|
+
const IAM_USER_PATH = "/gkm/";
|
|
88
|
+
/** The inline policy each user is given. */
|
|
89
|
+
const IAM_POLICY_NAME = "gkm-bucket";
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/providers/s3/policy.ts
|
|
92
|
+
const bucketArn = (bucket) => `arn:aws:s3:::${bucket}`;
|
|
93
|
+
/**
|
|
94
|
+
* What the app's key may do: objects in this bucket, and listing it — and
|
|
95
|
+
* nothing else in the account.
|
|
96
|
+
*
|
|
97
|
+
* Multipart uploads are in it because a presigned upload of a large file is
|
|
98
|
+
* one, and an abandoned one is cleaned up by the app. Reading old versions is
|
|
99
|
+
* added only when the bucket keeps them.
|
|
100
|
+
*/
|
|
101
|
+
function userPolicy(bucket, options = {}) {
|
|
102
|
+
return {
|
|
103
|
+
Version: "2012-10-17",
|
|
104
|
+
Statement: [
|
|
105
|
+
{
|
|
106
|
+
Sid: "GkmObjects",
|
|
107
|
+
Effect: "Allow",
|
|
108
|
+
Action: [
|
|
109
|
+
"s3:GetObject",
|
|
110
|
+
"s3:PutObject",
|
|
111
|
+
"s3:DeleteObject",
|
|
112
|
+
"s3:AbortMultipartUpload",
|
|
113
|
+
"s3:ListMultipartUploadParts",
|
|
114
|
+
...options.versioning ? ["s3:GetObjectVersion"] : []
|
|
115
|
+
],
|
|
116
|
+
Resource: `${bucketArn(bucket)}/*`
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
Sid: "GkmBucket",
|
|
120
|
+
Effect: "Allow",
|
|
121
|
+
Action: [
|
|
122
|
+
"s3:ListBucket",
|
|
123
|
+
"s3:GetBucketLocation",
|
|
124
|
+
"s3:ListBucketMultipartUploads"
|
|
125
|
+
],
|
|
126
|
+
Resource: bucketArn(bucket)
|
|
127
|
+
},
|
|
128
|
+
...options.eventsTopicArn ? [{
|
|
129
|
+
Sid: "GkmEvents",
|
|
130
|
+
Effect: "Allow",
|
|
131
|
+
Action: "sns:ConfirmSubscription",
|
|
132
|
+
Resource: options.eventsTopicArn
|
|
133
|
+
}] : []
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* One open pattern as the resource it is public on. A `**` is S3's `*`; a
|
|
139
|
+
* single `*` is too, which crosses `/` where the construct's own check does
|
|
140
|
+
* not — the construct is the stricter of the two (see `bucketPolicy` in
|
|
141
|
+
* reconcile, which the local MinIO is given the same way).
|
|
142
|
+
*/
|
|
143
|
+
function openResource(bucket, pattern) {
|
|
144
|
+
const path = pattern.replace(/^\/+/, "").replace(/\*\*/g, "*");
|
|
145
|
+
return `${bucketArn(bucket)}/${path}`;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The bucket's own policy: every request refused unless it came over TLS,
|
|
149
|
+
* and — only when a file server opens paths on it — `s3:GetObject` on
|
|
150
|
+
* exactly those prefixes: to anyone, or, when a CDN serves them, to
|
|
151
|
+
* CloudFront alone, for exactly the stage's distributions. Behind a CDN the
|
|
152
|
+
* bucket is never public: a key outside the open prefixes is refused to
|
|
153
|
+
* CloudFront too, so the edge answers it 403.
|
|
154
|
+
*/
|
|
155
|
+
function bucketPolicy(bucket, open = [], options = {}) {
|
|
156
|
+
const statements = [{
|
|
157
|
+
Sid: "GkmDenyInsecureTransport",
|
|
158
|
+
Effect: "Deny",
|
|
159
|
+
Principal: "*",
|
|
160
|
+
Action: "s3:*",
|
|
161
|
+
Resource: [bucketArn(bucket), `${bucketArn(bucket)}/*`],
|
|
162
|
+
Condition: { Bool: { "aws:SecureTransport": "false" } }
|
|
163
|
+
}];
|
|
164
|
+
const resources = [...new Set(open.map((p) => openResource(bucket, p)))].sort();
|
|
165
|
+
if (open.length > 0 && options.cdn) statements.push({
|
|
166
|
+
Sid: "GkmCdnRead",
|
|
167
|
+
Effect: "Allow",
|
|
168
|
+
Principal: { Service: "cloudfront.amazonaws.com" },
|
|
169
|
+
Action: "s3:GetObject",
|
|
170
|
+
Resource: resources,
|
|
171
|
+
Condition: { StringEquals: { "AWS:SourceArn": [...new Set(options.cdn.distributionArns)].sort() } }
|
|
172
|
+
});
|
|
173
|
+
else if (open.length > 0) statements.push({
|
|
174
|
+
Sid: "GkmOpenPaths",
|
|
175
|
+
Effect: "Allow",
|
|
176
|
+
Principal: "*",
|
|
177
|
+
Action: "s3:GetObject",
|
|
178
|
+
Resource: resources
|
|
179
|
+
});
|
|
180
|
+
if (options.sesWrite) statements.push({
|
|
181
|
+
Sid: "GkmSesWritesMail",
|
|
182
|
+
Effect: "Allow",
|
|
183
|
+
Principal: { Service: "ses.amazonaws.com" },
|
|
184
|
+
Action: "s3:PutObject",
|
|
185
|
+
Resource: `${bucketArn(bucket)}/${options.sesWrite.prefix}*`,
|
|
186
|
+
Condition: { StringEquals: { "aws:SourceAccount": options.sesWrite.account } }
|
|
187
|
+
});
|
|
188
|
+
return {
|
|
189
|
+
Version: "2012-10-17",
|
|
190
|
+
Statement: statements
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Block Public Access. All four flags on, unless the bucket has open paths:
|
|
195
|
+
* then a *policy* may make it public (`BlockPublicPolicy`,
|
|
196
|
+
* `RestrictPublicBuckets` off), and ACLs still may not.
|
|
197
|
+
*/
|
|
198
|
+
function publicAccessBlock(open) {
|
|
199
|
+
return {
|
|
200
|
+
BlockPublicAcls: true,
|
|
201
|
+
IgnorePublicAcls: true,
|
|
202
|
+
BlockPublicPolicy: !open,
|
|
203
|
+
RestrictPublicBuckets: !open
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function corsRule(origins) {
|
|
207
|
+
return {
|
|
208
|
+
AllowedMethods: [
|
|
209
|
+
"GET",
|
|
210
|
+
"HEAD",
|
|
211
|
+
"POST",
|
|
212
|
+
"PUT"
|
|
213
|
+
],
|
|
214
|
+
AllowedOrigins: [...new Set(origins)].sort(),
|
|
215
|
+
AllowedHeaders: ["*"],
|
|
216
|
+
ExposeHeaders: ["ETag"],
|
|
217
|
+
MaxAgeSeconds: 3e3
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A policy document in one canonical form — keys sorted, a lone string a
|
|
222
|
+
* one-element list, lists sorted — so one AWS reformatted reads as the same
|
|
223
|
+
* document rather than as drift.
|
|
224
|
+
*/
|
|
225
|
+
function canonicalPolicy(value) {
|
|
226
|
+
return JSON.stringify(canonical(value));
|
|
227
|
+
}
|
|
228
|
+
function canonical(value, key) {
|
|
229
|
+
if (Array.isArray(value)) {
|
|
230
|
+
const items = value.map((v) => canonical(v));
|
|
231
|
+
return key === "Statement" ? items : items.map((v) => JSON.stringify(v)).sort();
|
|
232
|
+
}
|
|
233
|
+
if (value && typeof value === "object") return Object.fromEntries(Object.keys(value).sort().map((k) => {
|
|
234
|
+
const v = value[k];
|
|
235
|
+
return [k, canonical(k === "Action" || k === "Resource" || k === "AWS" || k === "AWS:SourceArn" ? Array.isArray(v) ? v : [v] : v, k)];
|
|
236
|
+
}));
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/providers/iam.ts
|
|
241
|
+
/**
|
|
242
|
+
* An IAM user gkm creates for one thing on a stage, its inline policy, and
|
|
243
|
+
* the access key written into the stage's secrets as an `s3://` URL — what
|
|
244
|
+
* the `s3` provider gives each bucket, and the deploy gives a stage's
|
|
245
|
+
* backups.
|
|
246
|
+
*
|
|
247
|
+
* - **The user** is under `/gkm/`, tagged with the deploy identity, the stage
|
|
248
|
+
* and what it is for. One that exists without those tags is someone
|
|
249
|
+
* else's, and is refused rather than taken over.
|
|
250
|
+
* - **Its policy** is read on every run and put back when it drifted.
|
|
251
|
+
* - **Its key**: one, written into the stage's secrets the moment IAM shows
|
|
252
|
+
* its secret. `--rotate-keys` issues a successor and keeps the old one
|
|
253
|
+
* active until the stage has deployed with the new one; the next run after
|
|
254
|
+
* that — or `--retire-old-keys` — deletes it.
|
|
255
|
+
* - **A new key** takes IAM seconds to become usable: the state records when
|
|
256
|
+
* it was issued, and a check made with it waits that out
|
|
257
|
+
* ({@link whileKeyIsNew}).
|
|
258
|
+
*/
|
|
259
|
+
/** The tags gkm finds its own buckets and users by. */
|
|
260
|
+
const TAG_PROJECT = "gkm:project";
|
|
261
|
+
const TAG_STAGE = "gkm:stage";
|
|
262
|
+
const TAG_CONSTRUCT = "gkm:construct";
|
|
263
|
+
/** The keys gkm tags a bucket and a user with. */
|
|
264
|
+
function identityTags(ctx, id) {
|
|
265
|
+
return [
|
|
266
|
+
{
|
|
267
|
+
Key: TAG_PROJECT,
|
|
268
|
+
Value: ctx.identity.key
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
Key: TAG_STAGE,
|
|
272
|
+
Value: ctx.stage
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
Key: TAG_CONSTRUCT,
|
|
276
|
+
Value: id
|
|
277
|
+
}
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
/** A read whose "there is none" answer is one of `missing`. */
|
|
281
|
+
async function readOr(read, missing) {
|
|
282
|
+
try {
|
|
283
|
+
return await read();
|
|
284
|
+
} catch (error) {
|
|
285
|
+
const e = error;
|
|
286
|
+
if (missing.includes(e?.Code ?? e?.name ?? "")) return void 0;
|
|
287
|
+
throw error;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/** IAM returns a policy document URL-encoded; an emulator may not. */
|
|
291
|
+
function decodePolicy(document) {
|
|
292
|
+
try {
|
|
293
|
+
return decodeURIComponent(document);
|
|
294
|
+
} catch {
|
|
295
|
+
return document;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The user and its inline policy: found — and refused when it is not this
|
|
300
|
+
* stage's — or created, and the policy put back when it drifted.
|
|
301
|
+
*
|
|
302
|
+
* @throws {IamUserNotOwned}
|
|
303
|
+
*/
|
|
304
|
+
async function ensureIamUser(ctx, clients, input) {
|
|
305
|
+
const { IAM, iam } = clients;
|
|
306
|
+
const { id, user, policy } = input;
|
|
307
|
+
const entry = {
|
|
308
|
+
key: `iam-user:${id}`,
|
|
309
|
+
type: "iam-user"
|
|
310
|
+
};
|
|
311
|
+
const found = await readOr(() => iam.send(new IAM.GetUserCommand({ UserName: user })), ["NoSuchEntity", "NoSuchEntityException"]);
|
|
312
|
+
if (found?.User) {
|
|
313
|
+
const tags = await iam.send(new IAM.ListUserTagsCommand({ UserName: user }));
|
|
314
|
+
const tag = (key) => tags.Tags?.find((t) => t.Key === key)?.Value;
|
|
315
|
+
if (found.User.Path !== "/gkm/" || tag("gkm:project") !== ctx.identity.key || tag("gkm:stage") !== ctx.stage) throw new require_workspace.IamUserNotOwned(user, ctx.identity.key, ctx.stage);
|
|
316
|
+
await ctx.state.ready(entry, user);
|
|
317
|
+
} else await ctx.change({
|
|
318
|
+
construct: id,
|
|
319
|
+
resource: `IAM user ${user}`,
|
|
320
|
+
change: `create under ${IAM_USER_PATH}`
|
|
321
|
+
}, async () => {
|
|
322
|
+
await ctx.state.pending(entry);
|
|
323
|
+
await iam.send(new IAM.CreateUserCommand({
|
|
324
|
+
UserName: user,
|
|
325
|
+
Path: IAM_USER_PATH,
|
|
326
|
+
Tags: identityTags(ctx, id)
|
|
327
|
+
}));
|
|
328
|
+
await ctx.state.ready(entry, user);
|
|
329
|
+
});
|
|
330
|
+
const exists = Boolean(found?.User) || !ctx.dryRun;
|
|
331
|
+
const current = exists ? await readOr(() => iam.send(new IAM.GetUserPolicyCommand({
|
|
332
|
+
UserName: user,
|
|
333
|
+
PolicyName: input.policyName
|
|
334
|
+
})), ["NoSuchEntity", "NoSuchEntityException"]) : void 0;
|
|
335
|
+
const document = current?.PolicyDocument ? JSON.parse(decodePolicy(current.PolicyDocument)) : void 0;
|
|
336
|
+
if (!document || canonicalPolicy(document) !== canonicalPolicy(policy)) await ctx.change({
|
|
337
|
+
construct: id,
|
|
338
|
+
resource: `IAM user ${user}`,
|
|
339
|
+
change: `policy ${input.policyName}: ${input.describe}`
|
|
340
|
+
}, async () => {
|
|
341
|
+
await iam.send(new IAM.PutUserPolicyCommand({
|
|
342
|
+
UserName: user,
|
|
343
|
+
PolicyName: input.policyName,
|
|
344
|
+
PolicyDocument: JSON.stringify(policy)
|
|
345
|
+
}));
|
|
346
|
+
});
|
|
347
|
+
return {
|
|
348
|
+
user,
|
|
349
|
+
exists
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* The user's access key, in the stage's secrets as the bucket's URL.
|
|
354
|
+
*
|
|
355
|
+
* - First run: one key, written into the stage's secrets.
|
|
356
|
+
* - `--rotate-keys`: a second key, written in place of the first; the first
|
|
357
|
+
* stays active until the stage has deployed with the second, and the next
|
|
358
|
+
* run after that deploy — or `--retire-old-keys` — deletes it.
|
|
359
|
+
* - A key the secrets no longer hold (a store emptied by hand): replaced the
|
|
360
|
+
* same way, since its secret cannot be read back.
|
|
361
|
+
*
|
|
362
|
+
* @throws {BucketKeySetElsewhere} when the secret names another bucket
|
|
363
|
+
* @throws {RotationInProgress} on `--rotate-keys` with the last rotation's old key still active
|
|
364
|
+
* @throws {AccessKeyLimit} when the user has two keys gkm did not record
|
|
365
|
+
*/
|
|
366
|
+
async function ensureAccessKey(ctx, clients, input) {
|
|
367
|
+
const { IAM, iam } = clients;
|
|
368
|
+
const { id, bucket, user, urlKey } = input;
|
|
369
|
+
const entryKey = `iam-access-key:${id}`;
|
|
370
|
+
const record = ctx.state.record(entryKey);
|
|
371
|
+
const given = ctx.secrets[urlKey];
|
|
372
|
+
let inUrl;
|
|
373
|
+
let parsed;
|
|
374
|
+
if (given !== void 0) {
|
|
375
|
+
try {
|
|
376
|
+
parsed = _geekmidas_storage_s3_url.parse(given);
|
|
377
|
+
} catch {
|
|
378
|
+
parsed = void 0;
|
|
379
|
+
}
|
|
380
|
+
if (parsed?.bucket !== bucket) throw new require_workspace.BucketKeySetElsewhere(urlKey, bucket, parsed?.bucket ?? given.replace(/\/\/[^@]*@/, "//"), ctx.stage);
|
|
381
|
+
inUrl = parsed.accessKeyId;
|
|
382
|
+
}
|
|
383
|
+
const listed = input.exists ? (await iam.send(new IAM.ListAccessKeysCommand({ UserName: user }))).AccessKeyMetadata?.map((k) => k.AccessKeyId) ?? [] : [];
|
|
384
|
+
let current = record?.status === "ready" ? record.id : void 0;
|
|
385
|
+
let previous = typeof record?.data?.previous === "string" ? record.data.previous : void 0;
|
|
386
|
+
const rotatedAt = typeof record?.data?.rotatedAt === "string" ? record.data.rotatedAt : void 0;
|
|
387
|
+
const entry = (data = {}) => ({
|
|
388
|
+
key: entryKey,
|
|
389
|
+
type: "iam-access-key",
|
|
390
|
+
data: {
|
|
391
|
+
user,
|
|
392
|
+
...data
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
if (previous && current) {
|
|
396
|
+
const deployed = rotatedAt !== void 0 && ctx.state.lastDeployedAt !== void 0 && ctx.state.lastDeployedAt > rotatedAt;
|
|
397
|
+
if (ctx.retireOldKeys || deployed) {
|
|
398
|
+
const old = previous;
|
|
399
|
+
const keep = current;
|
|
400
|
+
await ctx.change({
|
|
401
|
+
construct: id,
|
|
402
|
+
resource: `IAM user ${user}`,
|
|
403
|
+
change: `delete the rotated-out access key ${old}`
|
|
404
|
+
}, async () => {
|
|
405
|
+
if (listed.includes(old)) await iam.send(new IAM.DeleteAccessKeyCommand({
|
|
406
|
+
UserName: user,
|
|
407
|
+
AccessKeyId: old
|
|
408
|
+
}));
|
|
409
|
+
await ctx.state.ready(entry(), keep);
|
|
410
|
+
});
|
|
411
|
+
previous = void 0;
|
|
412
|
+
} else ctx.log(` ${id}: the old access key ${previous} stays active until '${ctx.stage}' is deployed with the new one; the next deploy after that deletes it (or pass --retire-old-keys)`);
|
|
413
|
+
}
|
|
414
|
+
if (!current && inUrl && listed.includes(inUrl)) {
|
|
415
|
+
await ctx.state.ready(entry(), inUrl);
|
|
416
|
+
current = inUrl;
|
|
417
|
+
}
|
|
418
|
+
if (current !== void 0 && listed.includes(current) && inUrl === current && !ctx.rotateKeys) {
|
|
419
|
+
if (parsed && parsed.region !== clients.region) {
|
|
420
|
+
const address = parsed;
|
|
421
|
+
await ctx.change({
|
|
422
|
+
construct: id,
|
|
423
|
+
resource: urlKey,
|
|
424
|
+
change: `name ${clients.region}, the bucket's region (it said ${address.region ?? "none"})`
|
|
425
|
+
}, () => ctx.writeSecrets({ [urlKey]: _geekmidas_storage_s3_url.build({
|
|
426
|
+
...address,
|
|
427
|
+
region: clients.region
|
|
428
|
+
}) }));
|
|
429
|
+
}
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if (ctx.rotateKeys && previous) throw new require_workspace.RotationInProgress(id, previous, ctx.stage);
|
|
433
|
+
const outgoing = current && listed.includes(current) ? current : void 0;
|
|
434
|
+
if (listed.length >= 2) throw new require_workspace.AccessKeyLimit(user, listed);
|
|
435
|
+
const why = !current ? "create an access key" : ctx.rotateKeys ? "rotate: issue a new access key" : "issue a new access key (the secrets no longer hold the recorded one)";
|
|
436
|
+
await ctx.change({
|
|
437
|
+
construct: id,
|
|
438
|
+
resource: `IAM user ${user}`,
|
|
439
|
+
change: why
|
|
440
|
+
}, async () => {
|
|
441
|
+
await ctx.state.pending(entry(outgoing ? { previous: outgoing } : {}));
|
|
442
|
+
const key = (await iam.send(new IAM.CreateAccessKeyCommand({ UserName: user }))).AccessKey;
|
|
443
|
+
await ctx.writeSecrets({ [urlKey]: _geekmidas_storage_s3_url.build({
|
|
444
|
+
bucket,
|
|
445
|
+
region: clients.region,
|
|
446
|
+
...clients.endpoint ? {
|
|
447
|
+
endpoint: clients.endpoint,
|
|
448
|
+
forcePathStyle: true
|
|
449
|
+
} : {},
|
|
450
|
+
accessKeyId: key.AccessKeyId,
|
|
451
|
+
secretAccessKey: key.SecretAccessKey
|
|
452
|
+
}) });
|
|
453
|
+
const issuedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
454
|
+
await ctx.state.ready(entry(outgoing ? {
|
|
455
|
+
previous: outgoing,
|
|
456
|
+
rotatedAt: issuedAt,
|
|
457
|
+
issuedAt
|
|
458
|
+
} : { issuedAt }), key.AccessKeyId);
|
|
459
|
+
});
|
|
460
|
+
if (outgoing) ctx.log(` ${urlKey} holds the new key. This deploy moves '${ctx.stage}' onto it; the next deploy after it deletes the old key ${outgoing}`);
|
|
461
|
+
}
|
|
462
|
+
/** How long a key issued this recently counts as new to IAM. */
|
|
463
|
+
const NEW_KEY_WINDOW_MS = 6e5;
|
|
464
|
+
/** The waits between asks while a new key becomes usable: about a minute. */
|
|
465
|
+
let newKeyWaits = [
|
|
466
|
+
2e3,
|
|
467
|
+
4e3,
|
|
468
|
+
8e3,
|
|
469
|
+
15e3,
|
|
470
|
+
15e3,
|
|
471
|
+
15e3
|
|
472
|
+
];
|
|
473
|
+
/**
|
|
474
|
+
* When the key in a URL was issued, if the stage's state says it was just
|
|
475
|
+
* now — the record of `id`'s key naming that very key.
|
|
476
|
+
*/
|
|
477
|
+
function issuedJustNow(resources, id, accessKeyId) {
|
|
478
|
+
const record = resources?.[`iam-access-key:${id}`];
|
|
479
|
+
const issuedAt = record?.data?.issuedAt;
|
|
480
|
+
if (record?.id !== accessKeyId || typeof issuedAt !== "string") return;
|
|
481
|
+
const age = Date.now() - Date.parse(issuedAt);
|
|
482
|
+
return age >= 0 && age < NEW_KEY_WINDOW_MS ? issuedAt : void 0;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* `ask` again, for about a minute, while it is `refused` and the key was
|
|
486
|
+
* issued just now — IAM refuses a key for seconds after making it. Returns
|
|
487
|
+
* the last answer and how long was waited.
|
|
488
|
+
*/
|
|
489
|
+
async function whileKeyIsNew(first, options) {
|
|
490
|
+
let answer = first;
|
|
491
|
+
let waited = 0;
|
|
492
|
+
if (!options.issuedAt || !options.refused(answer)) return {
|
|
493
|
+
answer,
|
|
494
|
+
waited
|
|
495
|
+
};
|
|
496
|
+
options.onWait?.();
|
|
497
|
+
for (const wait of newKeyWaits) {
|
|
498
|
+
await new Promise((resolve) => setTimeout(resolve, wait));
|
|
499
|
+
waited += wait;
|
|
500
|
+
answer = await options.ask();
|
|
501
|
+
if (!options.refused(answer)) break;
|
|
502
|
+
}
|
|
503
|
+
return {
|
|
504
|
+
answer,
|
|
505
|
+
waited
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
//#endregion
|
|
509
|
+
Object.defineProperty(exports, "IAM_POLICY_NAME", {
|
|
510
|
+
enumerable: true,
|
|
511
|
+
get: function() {
|
|
512
|
+
return IAM_POLICY_NAME;
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
Object.defineProperty(exports, "IAM_USER_PATH", {
|
|
516
|
+
enumerable: true,
|
|
517
|
+
get: function() {
|
|
518
|
+
return IAM_USER_PATH;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
Object.defineProperty(exports, "TAG_PROJECT", {
|
|
522
|
+
enumerable: true,
|
|
523
|
+
get: function() {
|
|
524
|
+
return TAG_PROJECT;
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
Object.defineProperty(exports, "TAG_STAGE", {
|
|
528
|
+
enumerable: true,
|
|
529
|
+
get: function() {
|
|
530
|
+
return TAG_STAGE;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
Object.defineProperty(exports, "bucketName", {
|
|
534
|
+
enumerable: true,
|
|
535
|
+
get: function() {
|
|
536
|
+
return bucketName;
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
Object.defineProperty(exports, "bucketPolicy", {
|
|
540
|
+
enumerable: true,
|
|
541
|
+
get: function() {
|
|
542
|
+
return bucketPolicy;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
Object.defineProperty(exports, "canonicalPolicy", {
|
|
546
|
+
enumerable: true,
|
|
547
|
+
get: function() {
|
|
548
|
+
return canonicalPolicy;
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
Object.defineProperty(exports, "corsRule", {
|
|
552
|
+
enumerable: true,
|
|
553
|
+
get: function() {
|
|
554
|
+
return corsRule;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
Object.defineProperty(exports, "ensureAccessKey", {
|
|
558
|
+
enumerable: true,
|
|
559
|
+
get: function() {
|
|
560
|
+
return ensureAccessKey;
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
Object.defineProperty(exports, "ensureIamUser", {
|
|
564
|
+
enumerable: true,
|
|
565
|
+
get: function() {
|
|
566
|
+
return ensureIamUser;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
Object.defineProperty(exports, "iamUserName", {
|
|
570
|
+
enumerable: true,
|
|
571
|
+
get: function() {
|
|
572
|
+
return iamUserName;
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
Object.defineProperty(exports, "identityTags", {
|
|
576
|
+
enumerable: true,
|
|
577
|
+
get: function() {
|
|
578
|
+
return identityTags;
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
Object.defineProperty(exports, "issuedJustNow", {
|
|
582
|
+
enumerable: true,
|
|
583
|
+
get: function() {
|
|
584
|
+
return issuedJustNow;
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
Object.defineProperty(exports, "publicAccessBlock", {
|
|
588
|
+
enumerable: true,
|
|
589
|
+
get: function() {
|
|
590
|
+
return publicAccessBlock;
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
Object.defineProperty(exports, "randomSuffix", {
|
|
594
|
+
enumerable: true,
|
|
595
|
+
get: function() {
|
|
596
|
+
return randomSuffix;
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
Object.defineProperty(exports, "suffixedBucketName", {
|
|
600
|
+
enumerable: true,
|
|
601
|
+
get: function() {
|
|
602
|
+
return suffixedBucketName;
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
Object.defineProperty(exports, "userPolicy", {
|
|
606
|
+
enumerable: true,
|
|
607
|
+
get: function() {
|
|
608
|
+
return userPolicy;
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
Object.defineProperty(exports, "whileKeyIsNew", {
|
|
612
|
+
enumerable: true,
|
|
613
|
+
get: function() {
|
|
614
|
+
return whileKeyIsNew;
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
//# sourceMappingURL=iam-6LH6wptf.cjs.map
|