@voxgig/sdkgen 4.10.0 → 4.11.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.
- package/bin/voxgig-sdkgen +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/secrets.aon +330 -0
- package/project/.sdk/model/target/c.aon +15 -2
- package/project/.sdk/model/target/cpp.aon +18 -0
- package/project/.sdk/model/target/lua.aon +17 -0
- package/project/.sdk/model/target/ocaml.aon +48 -5
- package/project/.sdk/model/target/zig.aon +30 -4
- package/project/.sdk/src/cmp/c/Config_c.ts +338 -1
- package/project/.sdk/src/cmp/c/Main_c.ts +57 -2
- package/project/.sdk/src/cmp/c/Package_c.ts +12 -2
- package/project/.sdk/src/cmp/cpp/Config_cpp.ts +324 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +2 -0
- package/project/.sdk/src/cmp/cpp/Main_cpp.ts +62 -4
- package/project/.sdk/src/cmp/cpp/Package_cpp.ts +10 -0
- package/project/.sdk/src/cmp/lua/Config_lua.ts +88 -0
- package/project/.sdk/src/cmp/lua/Gitignore_lua.ts +4 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +93 -3
- package/project/.sdk/src/cmp/lua/Package_lua.ts +60 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +10 -0
- package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +183 -5
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +160 -3
- package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +25 -1
- package/project/.sdk/src/cmp/zig/Config_zig.ts +130 -9
- package/project/.sdk/src/cmp/zig/Main_zig.ts +208 -4
- package/project/.sdk/{tm/zig/build.zig → src/cmp/zig/fragment/Build.fragment.zig} +7 -0
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +25 -0
- package/project/.sdk/{tm/zig/root.zig → src/cmp/zig/fragment/Root.fragment.zig} +9 -0
- package/project/.sdk/tm/c/Makefile +58 -9
- package/project/.sdk/tm/c/core/sdk.h +10 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/capability.c +133 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/capability.h +39 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/catalog.c +83 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/catalog.h +48 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/config.c +413 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/config.h +24 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/depend.c +264 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/depend.h +29 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/env.c +220 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/env.h +19 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/export.c +97 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/export.h +19 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/graph.c +237 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/graph.h +17 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/host.c +1494 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/host.h +135 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/order.c +288 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/order.h +18 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/point.c +141 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/point.h +80 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/ref.c +170 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/ref.h +52 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/resolve.c +98 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/resolve.h +18 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/types.c +150 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/types.h +104 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/value.c +649 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/value.h +135 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/version.c +151 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/version.h +34 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/aws.c +281 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/azuresecrets.c +207 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/boru.c +164 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/clock.c +75 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/doppler.c +141 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/encode.c +144 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/gcpsecrets.c +177 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/hashicorp.c +239 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/httpjson.c +599 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/infisical.c +165 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/onepassword.c +194 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/proc.c +233 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/secretspec.c +125 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sekretoplugins.h +125 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sha256.c +270 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sigv4.c +382 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/support.h +153 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/tls.c +420 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/internal.h +86 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/json.c +721 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/providers.c +813 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.c +944 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.h +490 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/util.c +442 -0
- package/project/.sdk/tm/c/feature/secrets.c +797 -0
- package/project/.sdk/tm/c/feature/secrets.h +46 -0
- package/project/.sdk/tm/c/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/c/tests/feature/secrets/secrets_test.c +802 -0
- package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +38 -11
- package/project/.sdk/tm/clojure/test/sdk/test/feature/secrets.clj +40 -6
- package/project/.sdk/tm/cpp/Makefile +48 -4
- package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.cpp +121 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.hpp +41 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.cpp +60 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.hpp +66 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/config.cpp +376 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/config.hpp +29 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.cpp +230 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.hpp +31 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/env.cpp +205 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/env.hpp +25 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/export.cpp +84 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/export.hpp +24 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.cpp +222 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.hpp +21 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/host.cpp +1200 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/host.hpp +250 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/order.cpp +250 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/order.hpp +22 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/point.cpp +110 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/point.hpp +79 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.cpp +136 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.hpp +60 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.cpp +82 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.hpp +25 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/types.cpp +90 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/types.hpp +65 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/value.cpp +491 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/value.hpp +120 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/version.cpp +143 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/version.hpp +36 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.cpp +248 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.hpp +30 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.cpp +149 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.cpp +117 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.hpp +27 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.cpp +180 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.hpp +52 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.cpp +87 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.cpp +121 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.cpp +153 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.cpp +666 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.hpp +160 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.cpp +123 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.cpp +125 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.cpp +223 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.hpp +47 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.cpp +104 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.hpp +27 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.cpp +242 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.hpp +58 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.cpp +260 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.hpp +47 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.cpp +476 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.hpp +89 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.cpp +312 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.hpp +263 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.cpp +354 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.hpp +111 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.cpp +613 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.hpp +227 -0
- package/project/.sdk/tm/cpp/feature/secrets.hpp +745 -0
- package/project/.sdk/tm/cpp/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/test/feature/secrets/secrets_test.cpp +808 -0
- package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +34 -8
- package/project/.sdk/tm/csharp/test/feature/secrets/SecretsFeatureTest.cs +85 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +17 -2
- package/project/.sdk/tm/elixir/test/feature/secrets/secrets_test.exs +41 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +32 -10
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +116 -0
- package/project/.sdk/tm/java/feature/SecretsFeature.java +33 -8
- package/project/.sdk/tm/java/test/feature/secrets/SecretsFeatureTest.java +64 -0
- package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +34 -11
- package/project/.sdk/tm/js/test/feature/secrets/Secrets.test.js +73 -0
- package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +32 -7
- package/project/.sdk/tm/kotlin/test/feature/secrets/SecretsTest.kt +69 -0
- package/project/.sdk/tm/lua/Makefile +15 -4
- package/project/.sdk/tm/lua/feature/secrets/native/sekretonet.c +806 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/capability.lua +135 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/catalog.lua +63 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/config.lua +361 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/depend.lua +232 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/env.lua +168 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/export.lua +66 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/graph.lua +194 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/host.lua +1190 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/json.lua +169 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/order.lua +207 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/point.lua +106 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/ref.lua +115 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/resolve.lua +78 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/types.lua +275 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/version.lua +131 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin.lua +76 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/addr.lua +124 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/err.lua +47 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/name.lua +315 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/aws.lua +228 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/azuresecrets.lua +137 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/boru.lua +124 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/crypto.lua +212 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/doppler.lua +89 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/gcpsecrets.lua +129 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/hashicorp.lua +154 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/httpjson.lua +248 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/infisical.lua +113 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/json.lua +449 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/net.lua +198 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/onepassword.lua +126 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/secretspec.lua +93 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/sigv4.lua +269 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/support.lua +146 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/providers.lua +346 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto.lua +479 -0
- package/project/.sdk/tm/lua/feature/secrets_feature.lua +690 -0
- package/project/.sdk/tm/lua/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/extend_test.lua +105 -0
- package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +862 -0
- package/project/.sdk/tm/ocaml/Makefile +52 -8
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/capability.ml +106 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/catalog.ml +43 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/config.ml +349 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/defs.ml +143 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/depend.ml +217 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/env.ml +197 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/export.ml +89 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/graph.ml +227 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/host.ml +1112 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/order.ml +202 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/point.ml +138 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/ref.ml +126 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/resolve.ml +62 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/types.ml +97 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/value.ml +387 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/version.ml +139 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/aws.ml +171 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/azuresecrets.ml +116 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/boru.ml +95 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/crypto.ml +149 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/doppler.ml +61 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/gcpsecrets.ml +93 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/hashicorp.ml +120 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/http.ml +421 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/httpjson.ml +66 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/infisical.ml +85 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/onepassword.ml +112 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/runcmd.ml +97 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/secretspec.ml +68 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/sigv4.ml +259 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls.ml +44 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls_stubs.c +358 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/json.ml +376 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/provider.ml +647 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/secret.ml +299 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/sekreto.ml +347 -0
- package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +453 -0
- package/project/.sdk/tm/ocaml/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +670 -0
- package/project/.sdk/tm/perl/feature/secrets_feature.pm +33 -12
- package/project/.sdk/tm/perl/t/feature/secrets/secrets.t +47 -0
- package/project/.sdk/tm/php/feature/SecretsFeature.php +30 -6
- package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +98 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +28 -6
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +114 -0
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +28 -6
- package/project/.sdk/tm/rb/test/feature/secrets/secrets_feature_test.rb +93 -0
- package/project/.sdk/tm/rust/feature/secrets.rs +33 -10
- package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +96 -0
- package/project/.sdk/tm/scala/feature/SecretsFeature.scala +29 -7
- package/project/.sdk/tm/scala/sdktest/feature/secrets/SecretsTestMain.scala +71 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +35 -12
- package/project/.sdk/tm/ts/test/feature/secrets/Secrets.test.ts +73 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/capability.zig +137 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/catalog.zig +90 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/config.zig +346 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/depend.zig +244 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/env.zig +201 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/export.zig +83 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/graph.zig +212 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/host.zig +1224 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/inst.zig +126 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/order.zig +228 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/plugin.zig +34 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/point.zig +166 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/ref.zig +147 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/resolve.zig +74 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/types.zig +140 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/value.zig +662 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/version.zig +139 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/aws.zig +294 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/azuresecrets.zig +222 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/boru.zig +188 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/doppler.zig +135 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/gcpsecrets.zig +170 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/hashicorp.zig +242 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/httpjson.zig +535 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/infisical.zig +167 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/onepassword.zig +202 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/secretspec.zig +160 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/sigv4.zig +336 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/addr.zig +148 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/builtins.zig +259 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/provider.zig +440 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/sekreto.zig +944 -0
- package/project/.sdk/tm/zig/feature/secrets.zig +854 -0
- package/project/.sdk/tm/zig/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +891 -0
- package/project/sdkgen-package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
-- VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (lua/src/sekreto/plugins/hashicorp.lua)
|
|
2
|
+
-- Source: https://github.com/voxgig/sekreto @ 1267ee2e5f49566bc92695bc9eb3a60ef4924998 [tag: sdk-20260908-1556-0]
|
|
3
|
+
-- License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
-- The hashicorp plugin: HashiCorp Vault, over HTTPS. Needs a socket, so
|
|
5
|
+
-- it is not a built-in kind - a chain that never names it never requires
|
|
6
|
+
-- this file (docs/design/plugin-providers.md).
|
|
7
|
+
--
|
|
8
|
+
-- A port of typescript/plugins/hashicorp.ts, which is canonical.
|
|
9
|
+
|
|
10
|
+
local err = require('feature.secrets.sekreto.err')
|
|
11
|
+
local name = require('feature.secrets.sekreto.name')
|
|
12
|
+
local addr = require('feature.secrets.sekreto.addr')
|
|
13
|
+
local providers = require('feature.secrets.sekreto.providers')
|
|
14
|
+
local json = require('feature.secrets.sekreto.plugins.json')
|
|
15
|
+
local httpjson = require('feature.secrets.sekreto.plugins.httpjson')
|
|
16
|
+
local support = require('feature.secrets.sekreto.plugins.support')
|
|
17
|
+
|
|
18
|
+
local fail = err.fail
|
|
19
|
+
local nonempty = providers.nonempty
|
|
20
|
+
local trimslash = providers.trimslash
|
|
21
|
+
local readfile = providers.readfile
|
|
22
|
+
local providerplugin = providers.providerplugin
|
|
23
|
+
local first = support.first
|
|
24
|
+
local nowms = support.nowms
|
|
25
|
+
local renewtime = support.renewtime
|
|
26
|
+
local NEVER = support.NEVER
|
|
27
|
+
local fetchjson = httpjson.fetchjson
|
|
28
|
+
|
|
29
|
+
local M = {}
|
|
30
|
+
|
|
31
|
+
--- HashiCorp Vault.
|
|
32
|
+
---
|
|
33
|
+
--- KV v2 (the default): `api.token` reads `{addr}/v1/{mount}/data/api`
|
|
34
|
+
--- and takes the `token` field of `data.data`. KV v1 reads
|
|
35
|
+
--- `{addr}/v1/{mount}/api` and takes the field of `data`. A 404 means
|
|
36
|
+
--- "not here" - a miss - so a vault can sit in a chain with fallbacks.
|
|
37
|
+
---
|
|
38
|
+
--- A Vault Enterprise namespace rides the X-Vault-Namespace header, on
|
|
39
|
+
--- logins as well as reads.
|
|
40
|
+
---
|
|
41
|
+
--- Instead of being handed a token, the provider can log in: Kubernetes
|
|
42
|
+
--- auth (the pod's service-account JWT, from its conventional path) or
|
|
43
|
+
--- AppRole. A failed login is an error, never a miss - it means this
|
|
44
|
+
--- store could not answer at all.
|
|
45
|
+
local function hashicorp(useaddr, token, mount, kv, vaultnamespace, auth)
|
|
46
|
+
local address = useaddr or ''
|
|
47
|
+
local usemount = nonempty(mount) and mount or 'secret'
|
|
48
|
+
local usekv = kv or 2
|
|
49
|
+
|
|
50
|
+
-- A version typo like kv: 3 must not quietly behave as v2 and turn its
|
|
51
|
+
-- 404s into misses; there is nothing safe to assume it meant.
|
|
52
|
+
if 1 ~= usekv and 2 ~= usekv then
|
|
53
|
+
fail('sekreto: hashicorp: unsupported kv version: ' .. json.numstr(usekv))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
local livetoken = nonempty(token) and token or nil
|
|
57
|
+
local renewat = NEVER
|
|
58
|
+
|
|
59
|
+
local function baseheaders()
|
|
60
|
+
local out = {}
|
|
61
|
+
if nonempty(vaultnamespace) then
|
|
62
|
+
out[#out + 1] = { 'X-Vault-Namespace', vaultnamespace }
|
|
63
|
+
end
|
|
64
|
+
return out
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
local function login()
|
|
68
|
+
if nil == auth then
|
|
69
|
+
fail('sekreto: hashicorp: no token and no auth method')
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
local authmount = first(auth.mount, auth.method)
|
|
73
|
+
local url = trimslash(address) .. '/v1/auth/' .. authmount .. '/login'
|
|
74
|
+
local body
|
|
75
|
+
|
|
76
|
+
if 'kubernetes' == auth.method then
|
|
77
|
+
local jwt = auth.jwt
|
|
78
|
+
|
|
79
|
+
if nil == jwt then
|
|
80
|
+
local file = auth.jwtfile or
|
|
81
|
+
'/var/run/secrets/kubernetes.io/serviceaccount/token'
|
|
82
|
+
local text = readfile(file)
|
|
83
|
+
if nil == text then
|
|
84
|
+
fail('sekreto: hashicorp: cannot read jwt file ' .. file)
|
|
85
|
+
end
|
|
86
|
+
jwt = name.trim(text)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
body = json.obj({ { 'role', auth.role or '' }, { 'jwt', jwt } })
|
|
90
|
+
elseif 'approle' == auth.method then
|
|
91
|
+
body = json.obj({
|
|
92
|
+
{ 'role_id', auth.roleid or '' },
|
|
93
|
+
{ 'secret_id', auth.secretid or '' },
|
|
94
|
+
})
|
|
95
|
+
else
|
|
96
|
+
fail('sekreto: hashicorp: unknown auth method: ' .. tostring(auth.method))
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
local res = fetchjson('POST', url, baseheaders(), json.stringify(body))
|
|
100
|
+
local got = json.text(json.dig(res.body, 'auth', 'client_token'))
|
|
101
|
+
|
|
102
|
+
if 200 ~= res.status or nil == got or '' == got then
|
|
103
|
+
fail('sekreto: hashicorp login failed: ' .. res.status .. ': ' .. url)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
renewat = renewtime(json.dig(res.body, 'auth', 'lease_duration'))
|
|
107
|
+
|
|
108
|
+
return got
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
lookup = function(secret)
|
|
113
|
+
addr.checkaddr(address)
|
|
114
|
+
|
|
115
|
+
if nil == livetoken or nowms() >= renewat then
|
|
116
|
+
livetoken = login()
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
local ref = name.vaultref(secret)
|
|
120
|
+
local base = trimslash(address) .. '/v1/' .. usemount
|
|
121
|
+
local url = (1 == usekv) and (base .. '/' .. ref.path)
|
|
122
|
+
or (base .. '/data/' .. ref.path)
|
|
123
|
+
|
|
124
|
+
local headers = baseheaders()
|
|
125
|
+
headers[#headers + 1] = { 'X-Vault-Token', livetoken or '' }
|
|
126
|
+
|
|
127
|
+
local res = fetchjson('GET', url, headers)
|
|
128
|
+
|
|
129
|
+
if 404 == res.status then
|
|
130
|
+
return nil
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if 200 ~= res.status then
|
|
134
|
+
fail('sekreto: hashicorp error: ' .. res.status .. ': ' .. url)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
local data = (1 == usekv) and json.dig(res.body, 'data')
|
|
138
|
+
or json.dig(res.body, 'data', 'data')
|
|
139
|
+
|
|
140
|
+
return json.text(json.dig(data, ref.field))
|
|
141
|
+
end,
|
|
142
|
+
describe = function()
|
|
143
|
+
return 'hashicorp:' .. address .. '/' .. usemount
|
|
144
|
+
end,
|
|
145
|
+
}
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
--- The kind, as a voxgig/plugin definition.
|
|
149
|
+
M.hashicorp = providerplugin('hashicorp', function(spec)
|
|
150
|
+
return hashicorp(spec.addr, spec.token, spec.mount, spec.kv,
|
|
151
|
+
spec.vaultnamespace, spec.auth)
|
|
152
|
+
end)
|
|
153
|
+
|
|
154
|
+
return M
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
-- VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (lua/src/sekreto/plugins/httpjson.lua)
|
|
2
|
+
-- Source: https://github.com/voxgig/sekreto @ 1267ee2e5f49566bc92695bc9eb3a60ef4924998 [tag: sdk-20260908-1556-0]
|
|
3
|
+
-- License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
-- HTTP/1.1, framed by hand, plus the one JSON round-trip every store
|
|
5
|
+
-- client makes - the HTTP half of the plugins, in one place and OUTSIDE
|
|
6
|
+
-- the core. A chain of built-in kinds never requires this file.
|
|
7
|
+
--
|
|
8
|
+
-- Lua has no client, and the dependency rule covers cryptographic
|
|
9
|
+
-- transport and nothing else - so the request line, the headers, the
|
|
10
|
+
-- length-counted and chunked bodies are all written here. The bytes go
|
|
11
|
+
-- through src/sekreto/plugins/net.lua to a socket the helper owns;
|
|
12
|
+
-- nothing in this file knows whether that socket is TLS.
|
|
13
|
+
--
|
|
14
|
+
-- Everything the transport contract asks of a round-trip is here:
|
|
15
|
+
--
|
|
16
|
+
-- * ten seconds on the whole exchange, and an 8 MiB body cap, read one
|
|
17
|
+
-- byte past the bound so that exceeding it is detectable;
|
|
18
|
+
-- * redirects are NEVER followed - a followed redirect carries
|
|
19
|
+
-- X-Vault-Token to a host checkaddr never saw, and can downgrade
|
|
20
|
+
-- https to http;
|
|
21
|
+
-- * proxies are ignored, because there is no library reading
|
|
22
|
+
-- http_proxy: the socket is opened to the address that was checked.
|
|
23
|
+
-- A proxy has sent a Vault token in the clear before.
|
|
24
|
+
--
|
|
25
|
+
-- A port of typescript/plugins/httpjson.ts and of rust/src/http.rs, which
|
|
26
|
+
-- is the model for a hand-framed port.
|
|
27
|
+
|
|
28
|
+
local err = require('feature.secrets.sekreto.err')
|
|
29
|
+
local addr = require('feature.secrets.sekreto.addr')
|
|
30
|
+
local net = require('feature.secrets.sekreto.plugins.net')
|
|
31
|
+
local json = require('feature.secrets.sekreto.plugins.json')
|
|
32
|
+
|
|
33
|
+
local M = {}
|
|
34
|
+
|
|
35
|
+
M.TIMEOUT = 10000
|
|
36
|
+
M.MAXBODY = 8 * 1024 * 1024
|
|
37
|
+
|
|
38
|
+
--- Split a URL into the pieces a request needs.
|
|
39
|
+
---
|
|
40
|
+
--- IPv6 is why the port is found by searching BACKWARDS for `:`: a
|
|
41
|
+
--- literal's own colons would otherwise be read as one. The BARE host
|
|
42
|
+
--- (brackets stripped) is what is dialled and what the certificate is
|
|
43
|
+
--- checked against; the BRACKETED form is what goes in `Host:`.
|
|
44
|
+
function M.split(url)
|
|
45
|
+
local scheme, rest
|
|
46
|
+
|
|
47
|
+
if 'https://' == url:sub(1, 8) then
|
|
48
|
+
scheme, rest = 'https', url:sub(9)
|
|
49
|
+
elseif 'http://' == url:sub(1, 7) then
|
|
50
|
+
scheme, rest = 'http', url:sub(8)
|
|
51
|
+
else
|
|
52
|
+
err.fail('sekreto: not an http(s) address: ' .. addr.safeaddr(url))
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
local stop = rest:find('[/?#]')
|
|
56
|
+
local authority = stop and rest:sub(1, stop - 1) or rest
|
|
57
|
+
local target = stop and rest:sub(stop) or '/'
|
|
58
|
+
|
|
59
|
+
if '?' == target:sub(1, 1) or '#' == target:sub(1, 1) then
|
|
60
|
+
target = '/' .. target
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
local host = authority
|
|
64
|
+
local port = ('https' == scheme) and 443 or 80
|
|
65
|
+
local explicit = false
|
|
66
|
+
|
|
67
|
+
if '[' == authority:sub(1, 1) then
|
|
68
|
+
local close = authority:find(']', 1, true)
|
|
69
|
+
if nil == close then
|
|
70
|
+
err.fail('sekreto: not a valid http(s) address: ' .. addr.safeaddr(url))
|
|
71
|
+
end
|
|
72
|
+
host = authority:sub(2, close - 1)
|
|
73
|
+
local after = authority:sub(close + 1)
|
|
74
|
+
if ':' == after:sub(1, 1) then
|
|
75
|
+
port = tonumber(after:sub(2)) or port
|
|
76
|
+
explicit = true
|
|
77
|
+
end
|
|
78
|
+
else
|
|
79
|
+
local colon = authority:match('.*()%:')
|
|
80
|
+
if nil ~= colon then
|
|
81
|
+
local maybe = tonumber(authority:sub(colon + 1))
|
|
82
|
+
if nil ~= maybe then
|
|
83
|
+
host = authority:sub(1, colon - 1)
|
|
84
|
+
port = maybe
|
|
85
|
+
explicit = true
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
-- A default port stays implicit in `Host:`. A SigV4 signature covers
|
|
91
|
+
-- the host header, and `Host: x:443` is not what was signed.
|
|
92
|
+
local hostheader = authority
|
|
93
|
+
if explicit and (('https' == scheme and 443 == port) or
|
|
94
|
+
('http' == scheme and 80 == port))
|
|
95
|
+
then
|
|
96
|
+
hostheader = ('[' == authority:sub(1, 1)) and ('[' .. host .. ']') or host
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
scheme = scheme,
|
|
101
|
+
host = host,
|
|
102
|
+
port = port,
|
|
103
|
+
hostheader = hostheader,
|
|
104
|
+
target = target,
|
|
105
|
+
tls = 'https' == scheme,
|
|
106
|
+
}
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
local function lowerascii(text)
|
|
110
|
+
return (text:gsub('[A-Z]', function(ch) return string.char(ch:byte() + 32) end))
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
--- One HTTP exchange. Returns {status, headers, body}, or nil plus the
|
|
114
|
+
--- reason it could not be made. A non-2xx status is RETURNED, not a
|
|
115
|
+
--- failure: a 404 from a vault means "no such secret".
|
|
116
|
+
---
|
|
117
|
+
--- `headers` is a list of {name, value} pairs, in order.
|
|
118
|
+
function M.request(method, url, headers, body)
|
|
119
|
+
local target = M.split(url)
|
|
120
|
+
|
|
121
|
+
local lines = {
|
|
122
|
+
method .. ' ' .. target.target .. ' HTTP/1.1\r\n',
|
|
123
|
+
'Host: ' .. target.hostheader .. '\r\n',
|
|
124
|
+
'Accept: application/json\r\n',
|
|
125
|
+
'Connection: close\r\n',
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for _, pair in ipairs(headers or {}) do
|
|
129
|
+
lines[#lines + 1] = pair[1] .. ': ' .. pair[2] .. '\r\n'
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if nil ~= body then
|
|
133
|
+
lines[#lines + 1] = 'Content-Length: ' .. #body .. '\r\n'
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
lines[#lines + 1] = '\r\n'
|
|
137
|
+
if nil ~= body then
|
|
138
|
+
lines[#lines + 1] = body
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
local raw, why = net.fetch(
|
|
142
|
+
target.host, target.port, target.tls,
|
|
143
|
+
table.concat(lines), M.TIMEOUT, M.MAXBODY
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
if nil == raw then
|
|
147
|
+
return nil, why
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
local mark = raw:find('\r\n\r\n', 1, true)
|
|
151
|
+
if nil == mark then
|
|
152
|
+
return nil, 'the store answered with no headers'
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
local head = raw:sub(1, mark - 1)
|
|
156
|
+
local rest = raw:sub(mark + 4)
|
|
157
|
+
|
|
158
|
+
local first = head:match('^([^\r\n]*)')
|
|
159
|
+
local status = tonumber(first:match('^%S+%s+(%d+)') or '')
|
|
160
|
+
if nil == status then
|
|
161
|
+
return nil, 'the store answered with no status'
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
local answerheaders = {}
|
|
165
|
+
for line in head:gmatch('\r\n([^\r\n]+)') do
|
|
166
|
+
local name, value = line:match('^([^:]+):%s*(.*)$')
|
|
167
|
+
if nil ~= name then
|
|
168
|
+
answerheaders[lowerascii(name)] = value
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
local encoding = lowerascii(answerheaders['transfer-encoding'] or '')
|
|
173
|
+
|
|
174
|
+
if nil ~= encoding:find('chunked', 1, true) then
|
|
175
|
+
-- Bytes are sliced, never characters: a chunk boundary may fall
|
|
176
|
+
-- inside a multibyte character, and a secret with any non-ASCII in it
|
|
177
|
+
-- would otherwise be mangled.
|
|
178
|
+
local parts = {}
|
|
179
|
+
local at = 1
|
|
180
|
+
|
|
181
|
+
while true do
|
|
182
|
+
local stop = rest:find('\r\n', at, true)
|
|
183
|
+
if nil == stop then
|
|
184
|
+
break
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
local sizeline = rest:sub(at, stop - 1)
|
|
188
|
+
local semi = sizeline:find(';', 1, true)
|
|
189
|
+
if nil ~= semi then
|
|
190
|
+
sizeline = sizeline:sub(1, semi - 1)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
local size = tonumber(sizeline, 16)
|
|
194
|
+
if nil == size then
|
|
195
|
+
return nil, 'the store answered with a malformed chunk'
|
|
196
|
+
end
|
|
197
|
+
if 0 == size then
|
|
198
|
+
break
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
parts[#parts + 1] = rest:sub(stop + 2, stop + 1 + size)
|
|
202
|
+
at = stop + 2 + size + 2
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
rest = table.concat(parts)
|
|
206
|
+
else
|
|
207
|
+
local length = tonumber(answerheaders['content-length'] or '')
|
|
208
|
+
if nil ~= length then
|
|
209
|
+
rest = rest:sub(1, length)
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
return { status = status, headers = answerheaders, body = rest, raw = #raw }
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
--- One JSON round-trip's result: the status, and the parsed body.
|
|
217
|
+
---
|
|
218
|
+
--- Network failure is always an error - an unreachable store is a store
|
|
219
|
+
--- that could not answer, and answering a miss there would fall silently
|
|
220
|
+
--- through to a weaker store.
|
|
221
|
+
function M.fetchjson(method, url, headers, body)
|
|
222
|
+
local res, why = M.request(method, url, headers, body)
|
|
223
|
+
|
|
224
|
+
if nil == res then
|
|
225
|
+
err.fail('sekreto: cannot reach ' .. addr.bare(url) .. ': ' .. why)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
-- One byte over the bound is enough to know it was exceeded. An endless
|
|
229
|
+
-- body is a store that could not answer, so this raises rather than
|
|
230
|
+
-- returning a miss - the latter would fall through to a weaker store on
|
|
231
|
+
-- an attacker's cue.
|
|
232
|
+
if M.MAXBODY < res.raw then
|
|
233
|
+
err.fail('sekreto: oversized response from ' .. addr.bare(url))
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
local parsed = json.parse(res.body)
|
|
237
|
+
|
|
238
|
+
-- A success status promised JSON; a body that does not parse means the
|
|
239
|
+
-- store could not answer coherently. Error statuses may carry any body
|
|
240
|
+
-- - they are decided on status alone.
|
|
241
|
+
if 200 == res.status and nil == parsed then
|
|
242
|
+
err.fail('sekreto: malformed response from ' .. addr.bare(url))
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
return { status = res.status, body = parsed }
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
return M
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
-- VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (lua/src/sekreto/plugins/infisical.lua)
|
|
2
|
+
-- Source: https://github.com/voxgig/sekreto @ 1267ee2e5f49566bc92695bc9eb3a60ef4924998 [tag: sdk-20260908-1556-0]
|
|
3
|
+
-- License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
-- The infisical plugin: Infisical, over HTTPS, with a token or a
|
|
5
|
+
-- universal-auth machine identity.
|
|
6
|
+
--
|
|
7
|
+
-- A port of typescript/plugins/infisical.ts, which is canonical.
|
|
8
|
+
|
|
9
|
+
local err = require('feature.secrets.sekreto.err')
|
|
10
|
+
local name = require('feature.secrets.sekreto.name')
|
|
11
|
+
local addr = require('feature.secrets.sekreto.addr')
|
|
12
|
+
local providers = require('feature.secrets.sekreto.providers')
|
|
13
|
+
local json = require('feature.secrets.sekreto.plugins.json')
|
|
14
|
+
local httpjson = require('feature.secrets.sekreto.plugins.httpjson')
|
|
15
|
+
local support = require('feature.secrets.sekreto.plugins.support')
|
|
16
|
+
|
|
17
|
+
local fail = err.fail
|
|
18
|
+
local nonempty = providers.nonempty
|
|
19
|
+
local trimslash = providers.trimslash
|
|
20
|
+
local providerplugin = providers.providerplugin
|
|
21
|
+
local first = support.first
|
|
22
|
+
local nowms = support.nowms
|
|
23
|
+
local renewtime = support.renewtime
|
|
24
|
+
local NEVER = support.NEVER
|
|
25
|
+
local fetchjson = httpjson.fetchjson
|
|
26
|
+
local uriescape = support.uriescape
|
|
27
|
+
|
|
28
|
+
local M = {}
|
|
29
|
+
|
|
30
|
+
--- Infisical.
|
|
31
|
+
---
|
|
32
|
+
--- `api.token` reads the secret keyed `API_TOKEN` at a secret path in one
|
|
33
|
+
--- environment of a project. Auth is a token, or a universal-auth
|
|
34
|
+
--- (machine identity) login with clientid/clientsecret.
|
|
35
|
+
local function infisical(useaddr, token, clientid, clientsecret, project, environment, path)
|
|
36
|
+
local livetoken = nil
|
|
37
|
+
local renewat = NEVER
|
|
38
|
+
|
|
39
|
+
local function login(address)
|
|
40
|
+
if nonempty(token) then
|
|
41
|
+
return token
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
if not nonempty(clientid) or not nonempty(clientsecret) then
|
|
45
|
+
fail('sekreto: infisical: no token and no client credentials')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
local body = json.obj({
|
|
49
|
+
{ 'clientId', clientid },
|
|
50
|
+
{ 'clientSecret', clientsecret },
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
local res = fetchjson(
|
|
54
|
+
'POST', address .. '/api/v1/auth/universal-auth/login',
|
|
55
|
+
{ { 'content-type', 'application/json' } }, json.stringify(body)
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
local got = json.text(json.dig(res.body, 'accessToken'))
|
|
59
|
+
if 200 ~= res.status or nil == got or '' == got then
|
|
60
|
+
fail('sekreto: infisical login failed: ' .. res.status)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
-- camelCase, unlike everyone else's expires_in.
|
|
64
|
+
renewat = renewtime(json.dig(res.body, 'expiresIn'))
|
|
65
|
+
|
|
66
|
+
return got
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
lookup = function(secret)
|
|
71
|
+
local address = trimslash(first(useaddr, 'https://app.infisical.com'))
|
|
72
|
+
addr.checkaddr(address)
|
|
73
|
+
|
|
74
|
+
local useproject = project or ''
|
|
75
|
+
local useenvironment = environment or ''
|
|
76
|
+
if '' == useproject or '' == useenvironment then
|
|
77
|
+
fail('sekreto: infisical: no project/environment')
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if nil == livetoken or nowms() >= renewat then
|
|
81
|
+
livetoken = login(address)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
local url = address .. '/api/v3/secrets/raw/' .. name.envkey(secret) ..
|
|
85
|
+
'?workspaceId=' .. uriescape(useproject) ..
|
|
86
|
+
'&environment=' .. uriescape(useenvironment) ..
|
|
87
|
+
'&secretPath=' .. uriescape(first(path, '/'))
|
|
88
|
+
|
|
89
|
+
local res = fetchjson('GET', url, { { 'authorization', 'Bearer ' .. livetoken } })
|
|
90
|
+
|
|
91
|
+
if 404 == res.status then
|
|
92
|
+
return nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if 200 ~= res.status then
|
|
96
|
+
fail('sekreto: infisical error: ' .. res.status)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
return json.text(json.dig(res.body, 'secret', 'secretValue'))
|
|
100
|
+
end,
|
|
101
|
+
describe = function()
|
|
102
|
+
return 'infisical:' .. (project or '') .. '/' .. (environment or '')
|
|
103
|
+
end,
|
|
104
|
+
}
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
--- The kind, as a voxgig/plugin definition.
|
|
108
|
+
M.infisical = providerplugin('infisical', function(spec)
|
|
109
|
+
return infisical(spec.addr, spec.token, spec.clientid, spec.clientsecret,
|
|
110
|
+
spec.project, spec.environment, spec.path)
|
|
111
|
+
end)
|
|
112
|
+
|
|
113
|
+
return M
|