@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,336 @@
|
|
|
1
|
+
// VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (zig/plugins/sigv4.zig)
|
|
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
|
+
//! AWS Signature Version 4, hand-rolled.
|
|
5
|
+
//!
|
|
6
|
+
//! The AWS providers need exactly one thing from the AWS SDK - request
|
|
7
|
+
//! signing - and taking an SDK for it would break the no-dependency rule
|
|
8
|
+
//! that keeps ten ports honest. SigV4 is a stable, published algorithm
|
|
9
|
+
//! built from HMAC-SHA256, which std already has
|
|
10
|
+
//! (`std.crypto.auth.hmac.Hmac(Sha256)`).
|
|
11
|
+
//!
|
|
12
|
+
//! `sign` is pure: the caller passes the timestamp, so the same input
|
|
13
|
+
//! yields the same signature everywhere. That is what lets the shared spec
|
|
14
|
+
//! carry known-answer cases all ten ports must reproduce bit-for-bit, and
|
|
15
|
+
//! lets the integration mock recompute the signature server-side.
|
|
16
|
+
|
|
17
|
+
const std = @import("std");
|
|
18
|
+
|
|
19
|
+
const Allocator = std.mem.Allocator;
|
|
20
|
+
const Sha256 = std.crypto.hash.sha2.Sha256;
|
|
21
|
+
const Hmac = std.crypto.auth.hmac.Hmac(Sha256);
|
|
22
|
+
|
|
23
|
+
/// One header, or one output field. A list rather than a map: the order of
|
|
24
|
+
/// the signed headers is part of the signature, and the order of the output
|
|
25
|
+
/// is what a port's test compares.
|
|
26
|
+
pub const Pair = struct {
|
|
27
|
+
name: []const u8,
|
|
28
|
+
value: []const u8,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
pub const Input = struct {
|
|
32
|
+
method: []const u8,
|
|
33
|
+
/// Full request URL; the host, path and query are signed.
|
|
34
|
+
url: []const u8,
|
|
35
|
+
/// Extra headers to sign, e.g. content-type and x-amz-target.
|
|
36
|
+
headers: []const Pair = &.{},
|
|
37
|
+
body: []const u8 = "",
|
|
38
|
+
service: []const u8,
|
|
39
|
+
region: []const u8,
|
|
40
|
+
keyid: []const u8,
|
|
41
|
+
secret: []const u8,
|
|
42
|
+
/// STS session token; signed as x-amz-security-token when present.
|
|
43
|
+
session: []const u8 = "",
|
|
44
|
+
/// The signing moment, `YYYYMMDDTHHMMSSZ`. Passed in, never sampled, so
|
|
45
|
+
/// the function stays pure.
|
|
46
|
+
datetime: []const u8,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/// The URL as the signature sees it. Deliberately hand-split rather than
|
|
50
|
+
/// handed to `std.Uri`: what is signed must be exactly what the canonical
|
|
51
|
+
/// TypeScript's `new URL()` yields - a `host` that carries the port only
|
|
52
|
+
/// when it is not the scheme's default, and a `pathname` that is `/` when
|
|
53
|
+
/// the URL has no path at all.
|
|
54
|
+
const Url = struct {
|
|
55
|
+
host: []const u8,
|
|
56
|
+
path: []const u8,
|
|
57
|
+
query: []const u8,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
fn parseurl(alloc: Allocator, url: []const u8) Allocator.Error!Url {
|
|
61
|
+
const scheme_end = std.mem.indexOf(u8, url, "://") orelse 0;
|
|
62
|
+
const scheme = url[0..scheme_end];
|
|
63
|
+
const rest = if (0 == scheme_end) url else url[scheme_end + 3 ..];
|
|
64
|
+
|
|
65
|
+
const authority_end = std.mem.indexOfAny(u8, rest, "/?#") orelse rest.len;
|
|
66
|
+
var authority = rest[0..authority_end];
|
|
67
|
+
|
|
68
|
+
// Userinfo is not part of the host, and never signed.
|
|
69
|
+
if (std.mem.lastIndexOfScalar(u8, authority, '@')) |at| {
|
|
70
|
+
authority = authority[at + 1 ..];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var host = try std.ascii.allocLowerString(alloc, authority);
|
|
74
|
+
|
|
75
|
+
// A default port is not part of `host`, exactly as URL.host omits it.
|
|
76
|
+
const defaultport: []const u8 = if (std.mem.eql(u8, "https", scheme)) ":443" else ":80";
|
|
77
|
+
if (std.mem.endsWith(u8, host, defaultport)) {
|
|
78
|
+
host = host[0 .. host.len - defaultport.len];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var tail = rest[authority_end..];
|
|
82
|
+
if (std.mem.indexOfScalar(u8, tail, '#')) |hash| {
|
|
83
|
+
tail = tail[0..hash];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const query_at = std.mem.indexOfScalar(u8, tail, '?');
|
|
87
|
+
const path = if (query_at) |at| tail[0..at] else tail;
|
|
88
|
+
const query = if (query_at) |at| tail[at + 1 ..] else "";
|
|
89
|
+
|
|
90
|
+
return .{
|
|
91
|
+
.host = host,
|
|
92
|
+
.path = if (0 == path.len) "/" else path,
|
|
93
|
+
.query = query,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
fn hex(alloc: Allocator, bytes: []const u8) Allocator.Error![]const u8 {
|
|
98
|
+
const digits = "0123456789abcdef";
|
|
99
|
+
const out = try alloc.alloc(u8, 2 * bytes.len);
|
|
100
|
+
|
|
101
|
+
for (bytes, 0..) |byte, at| {
|
|
102
|
+
out[2 * at] = digits[byte >> 4];
|
|
103
|
+
out[2 * at + 1] = digits[byte & 0x0f];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
fn sha256hex(alloc: Allocator, text: []const u8) Allocator.Error![]const u8 {
|
|
110
|
+
var digest: [Sha256.digest_length]u8 = undefined;
|
|
111
|
+
Sha256.hash(text, &digest, .{});
|
|
112
|
+
return hex(alloc, &digest);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
fn hmac(key: []const u8, text: []const u8) [Hmac.mac_length]u8 {
|
|
116
|
+
var out: [Hmac.mac_length]u8 = undefined;
|
|
117
|
+
Hmac.create(&out, text, key);
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/// RFC 3986 escaping, which is stricter than a URL encoder: AWS wants `!`,
|
|
122
|
+
/// `'`, `(`, `)` and `*` escaped too, and every escape upper-case.
|
|
123
|
+
fn uriescape(alloc: Allocator, text: []const u8) Allocator.Error![]const u8 {
|
|
124
|
+
var out: std.ArrayList(u8) = .empty;
|
|
125
|
+
|
|
126
|
+
for (text) |ch| {
|
|
127
|
+
const unreserved = ('A' <= ch and 'Z' >= ch) or ('a' <= ch and 'z' >= ch) or
|
|
128
|
+
('0' <= ch and '9' >= ch) or '-' == ch or '_' == ch or '.' == ch or '~' == ch;
|
|
129
|
+
|
|
130
|
+
if (unreserved) {
|
|
131
|
+
try out.append(alloc, ch);
|
|
132
|
+
} else {
|
|
133
|
+
try out.appendSlice(alloc, try std.fmt.allocPrint(alloc, "%{X:0>2}", .{ch}));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return out.items;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
fn hexdigit(ch: u8) ?u8 {
|
|
141
|
+
if ('0' <= ch and '9' >= ch) return ch - '0';
|
|
142
|
+
if ('a' <= ch and 'f' >= ch) return ch - 'a' + 10;
|
|
143
|
+
if ('A' <= ch and 'F' >= ch) return ch - 'A' + 10;
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
fn percentdecode(alloc: Allocator, text: []const u8) Allocator.Error![]const u8 {
|
|
148
|
+
var out: std.ArrayList(u8) = .empty;
|
|
149
|
+
|
|
150
|
+
var at: usize = 0;
|
|
151
|
+
while (at < text.len) : (at += 1) {
|
|
152
|
+
if ('%' == text[at] and at + 2 < text.len) {
|
|
153
|
+
const high = hexdigit(text[at + 1]);
|
|
154
|
+
const low = hexdigit(text[at + 2]);
|
|
155
|
+
if (null != high and null != low) {
|
|
156
|
+
try out.append(alloc, 16 * high.? + low.?);
|
|
157
|
+
at += 2;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
try out.append(alloc, text[at]);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return out.items;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
fn lesspair(_: void, left: Pair, right: Pair) bool {
|
|
168
|
+
const order = std.mem.order(u8, left.name, right.name);
|
|
169
|
+
if (.eq != order) {
|
|
170
|
+
return .lt == order;
|
|
171
|
+
}
|
|
172
|
+
return .lt == std.mem.order(u8, left.value, right.value);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
fn lessname(_: void, left: Pair, right: Pair) bool {
|
|
176
|
+
return .lt == std.mem.order(u8, left.name, right.name);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/// The canonical query string: each pair RFC 3986-escaped, sorted by
|
|
180
|
+
/// escaped key then escaped value.
|
|
181
|
+
fn canonicalquery(alloc: Allocator, query: []const u8) Allocator.Error![]const u8 {
|
|
182
|
+
if (0 == query.len) {
|
|
183
|
+
return "";
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
var pairs: std.ArrayList(Pair) = .empty;
|
|
187
|
+
|
|
188
|
+
var parts = std.mem.splitScalar(u8, query, '&');
|
|
189
|
+
while (parts.next()) |pair| {
|
|
190
|
+
const eq = std.mem.indexOfScalar(u8, pair, '=');
|
|
191
|
+
const key = if (eq) |at| pair[0..at] else pair;
|
|
192
|
+
const value = if (eq) |at| pair[at + 1 ..] else "";
|
|
193
|
+
|
|
194
|
+
try pairs.append(alloc, .{
|
|
195
|
+
.name = try uriescape(alloc, try percentdecode(alloc, key)),
|
|
196
|
+
.value = try uriescape(alloc, try percentdecode(alloc, value)),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
std.mem.sort(Pair, pairs.items, {}, lesspair);
|
|
201
|
+
|
|
202
|
+
var out: std.ArrayList(u8) = .empty;
|
|
203
|
+
for (pairs.items, 0..) |pair, at| {
|
|
204
|
+
if (0 < at) {
|
|
205
|
+
try out.append(alloc, '&');
|
|
206
|
+
}
|
|
207
|
+
try out.appendSlice(alloc, pair.name);
|
|
208
|
+
try out.append(alloc, '=');
|
|
209
|
+
try out.appendSlice(alloc, pair.value);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return out.items;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
fn isspace(ch: u8) bool {
|
|
216
|
+
return ' ' == ch or '\t' == ch or '\n' == ch or '\r' == ch or 0x0b == ch or 0x0c == ch;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/// A canonical header value: trimmed, and internal whitespace runs folded to
|
|
220
|
+
/// one space. AWS folds before signing, so `a b` must sign as `a b` or the
|
|
221
|
+
/// service refuses the request.
|
|
222
|
+
fn collapse(alloc: Allocator, text: []const u8) Allocator.Error![]const u8 {
|
|
223
|
+
var out: std.ArrayList(u8) = .empty;
|
|
224
|
+
|
|
225
|
+
var at: usize = 0;
|
|
226
|
+
while (at < text.len and isspace(text[at])) : (at += 1) {}
|
|
227
|
+
|
|
228
|
+
var end = text.len;
|
|
229
|
+
while (end > at and isspace(text[end - 1])) : (end -= 1) {}
|
|
230
|
+
|
|
231
|
+
var run = false;
|
|
232
|
+
while (at < end) : (at += 1) {
|
|
233
|
+
if (isspace(text[at])) {
|
|
234
|
+
if (!run) {
|
|
235
|
+
try out.append(alloc, ' ');
|
|
236
|
+
run = true;
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
try out.append(alloc, text[at]);
|
|
240
|
+
run = false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return out.items;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/// Sign one request. Returns the headers to attach, in a fixed order:
|
|
248
|
+
/// authorization, x-amz-date, and x-amz-security-token when a session token
|
|
249
|
+
/// was given.
|
|
250
|
+
pub fn sign(alloc: Allocator, input: Input) Allocator.Error![]const Pair {
|
|
251
|
+
const url = try parseurl(alloc, input.url);
|
|
252
|
+
|
|
253
|
+
const date = if (8 <= input.datetime.len) input.datetime[0..8] else input.datetime;
|
|
254
|
+
|
|
255
|
+
// Every header that will be signed: the caller's extras, plus host and
|
|
256
|
+
// x-amz-date (and the session token when present), lower-cased and
|
|
257
|
+
// folded the way the canonical form requires.
|
|
258
|
+
var headers: std.ArrayList(Pair) = .empty;
|
|
259
|
+
|
|
260
|
+
for (input.headers) |header| {
|
|
261
|
+
try headers.append(alloc, .{
|
|
262
|
+
.name = try std.ascii.allocLowerString(alloc, header.name),
|
|
263
|
+
.value = try collapse(alloc, header.value),
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
try headers.append(alloc, .{ .name = "host", .value = url.host });
|
|
267
|
+
try headers.append(alloc, .{ .name = "x-amz-date", .value = input.datetime });
|
|
268
|
+
if (0 != input.session.len) {
|
|
269
|
+
try headers.append(alloc, .{ .name = "x-amz-security-token", .value = input.session });
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
std.mem.sort(Pair, headers.items, {}, lessname);
|
|
273
|
+
|
|
274
|
+
var canonicalheaders: std.ArrayList(u8) = .empty;
|
|
275
|
+
var signedheaders: std.ArrayList(u8) = .empty;
|
|
276
|
+
|
|
277
|
+
for (headers.items, 0..) |header, at| {
|
|
278
|
+
try canonicalheaders.appendSlice(alloc, header.name);
|
|
279
|
+
try canonicalheaders.append(alloc, ':');
|
|
280
|
+
try canonicalheaders.appendSlice(alloc, header.value);
|
|
281
|
+
try canonicalheaders.append(alloc, '\n');
|
|
282
|
+
|
|
283
|
+
if (0 < at) {
|
|
284
|
+
try signedheaders.append(alloc, ';');
|
|
285
|
+
}
|
|
286
|
+
try signedheaders.appendSlice(alloc, header.name);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const method = try std.ascii.allocUpperString(alloc, input.method);
|
|
290
|
+
|
|
291
|
+
const canonicalrequest = try std.fmt.allocPrint(alloc, "{s}\n{s}\n{s}\n{s}\n{s}\n{s}", .{
|
|
292
|
+
method,
|
|
293
|
+
url.path,
|
|
294
|
+
try canonicalquery(alloc, url.query),
|
|
295
|
+
canonicalheaders.items,
|
|
296
|
+
signedheaders.items,
|
|
297
|
+
try sha256hex(alloc, input.body),
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
const scope = try std.fmt.allocPrint(
|
|
301
|
+
alloc,
|
|
302
|
+
"{s}/{s}/{s}/aws4_request",
|
|
303
|
+
.{ date, input.region, input.service },
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
const stringtosign = try std.fmt.allocPrint(alloc, "AWS4-HMAC-SHA256\n{s}\n{s}\n{s}", .{
|
|
307
|
+
input.datetime,
|
|
308
|
+
scope,
|
|
309
|
+
try sha256hex(alloc, canonicalrequest),
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
const seed = try std.fmt.allocPrint(alloc, "AWS4{s}", .{input.secret});
|
|
313
|
+
const kdate = hmac(seed, date);
|
|
314
|
+
const kregion = hmac(&kdate, input.region);
|
|
315
|
+
const kservice = hmac(&kregion, input.service);
|
|
316
|
+
const ksigning = hmac(&kservice, "aws4_request");
|
|
317
|
+
const signature = hmac(&ksigning, stringtosign);
|
|
318
|
+
|
|
319
|
+
var out: std.ArrayList(Pair) = .empty;
|
|
320
|
+
|
|
321
|
+
try out.append(alloc, .{
|
|
322
|
+
.name = "authorization",
|
|
323
|
+
.value = try std.fmt.allocPrint(
|
|
324
|
+
alloc,
|
|
325
|
+
"AWS4-HMAC-SHA256 Credential={s}/{s}, SignedHeaders={s}, Signature={s}",
|
|
326
|
+
.{ input.keyid, scope, signedheaders.items, try hex(alloc, &signature) },
|
|
327
|
+
),
|
|
328
|
+
});
|
|
329
|
+
try out.append(alloc, .{ .name = "x-amz-date", .value = input.datetime });
|
|
330
|
+
|
|
331
|
+
if (0 != input.session.len) {
|
|
332
|
+
try out.append(alloc, .{ .name = "x-amz-security-token", .value = input.session });
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return out.items;
|
|
336
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (zig/src/addr.zig)
|
|
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 address check every network provider makes before it sends a
|
|
5
|
+
//! credential anywhere.
|
|
6
|
+
//!
|
|
7
|
+
//! In the CORE, not the plugins: it is a pure function over a string,
|
|
8
|
+
//! it opens no socket, and every plugin that speaks HTTP calls it. A
|
|
9
|
+
//! port of typescript/src/provider/addr.ts, which is canonical.
|
|
10
|
+
|
|
11
|
+
const std = @import("std");
|
|
12
|
+
|
|
13
|
+
const sekreto = @import("sekreto.zig");
|
|
14
|
+
|
|
15
|
+
const Allocator = std.mem.Allocator;
|
|
16
|
+
const Answer = sekreto.Answer;
|
|
17
|
+
|
|
18
|
+
/// An address with any userinfo replaced by `[redacted]`, for messages.
|
|
19
|
+
///
|
|
20
|
+
/// Every refusal in `checkaddr` names the address it refused, and one of them
|
|
21
|
+
/// fires precisely because the address carries a credential - so printing it
|
|
22
|
+
/// verbatim wrote the password to stderr and into the logs. It cannot be
|
|
23
|
+
/// cleaned up afterwards either: that password was never resolved as a
|
|
24
|
+
/// secret, so `redact` has never seen it and never will. The host is what a
|
|
25
|
+
/// reader needs to identify which chain entry is at fault; the userinfo is
|
|
26
|
+
/// not.
|
|
27
|
+
///
|
|
28
|
+
/// The caller owns the returned slice.
|
|
29
|
+
pub fn safeaddr(alloc: Allocator, addr: []const u8) Allocator.Error![]const u8 {
|
|
30
|
+
const mark = std.mem.indexOf(u8, addr, "://") orelse return alloc.dupe(u8, addr);
|
|
31
|
+
|
|
32
|
+
const rest = addr[mark + 3 ..];
|
|
33
|
+
const end = std.mem.indexOfAny(u8, rest, "/?#") orelse rest.len;
|
|
34
|
+
const authority = rest[0..end];
|
|
35
|
+
|
|
36
|
+
const at = std.mem.lastIndexOfScalar(u8, authority, '@') orelse
|
|
37
|
+
return alloc.dupe(u8, addr);
|
|
38
|
+
|
|
39
|
+
return std.fmt.allocPrint(alloc, "{s}[redacted]{s}", .{
|
|
40
|
+
addr[0 .. mark + 3],
|
|
41
|
+
addr[mark + 3 + at ..],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Refuse to send a secret-bearing credential in the clear.
|
|
46
|
+
///
|
|
47
|
+
/// A vault API is HTTPS in any real deployment; plaintext is a dev-mode
|
|
48
|
+
/// convenience. Sending a token over http to anything but the local machine
|
|
49
|
+
/// puts both the token and the secret it fetches on the wire for anyone on
|
|
50
|
+
/// the path, so sekreto will not do it. Loopback stays allowed: that is
|
|
51
|
+
/// `vault server -dev`, `boru vault serve`, and this repo's own harness.
|
|
52
|
+
///
|
|
53
|
+
/// The address is read by hand, in the same handful of steps in every port,
|
|
54
|
+
/// rather than by each platform's URL parser. That is deliberate. Twelve
|
|
55
|
+
/// parsers disagree about malformed input - where userinfo ends, whether
|
|
56
|
+
/// `0177.0.0.1` is loopback, what an unclosed bracket means - and a check
|
|
57
|
+
/// that answers differently in different ports is not a check.
|
|
58
|
+
///
|
|
59
|
+
/// The rule this parse obeys, and the reason it can be trusted: it is never
|
|
60
|
+
/// more permissive than the HTTP client that will dial the address. It ends
|
|
61
|
+
/// the authority at `/`, `?` or `#` only, so a client that also breaks on
|
|
62
|
+
/// `\` (WHATWG does) can only ever see a SHORTER host than this does. It
|
|
63
|
+
/// refuses userinfo outright rather than locating its end. It compares the
|
|
64
|
+
/// host literally, so a numeric form no parser here agrees on is refused
|
|
65
|
+
/// rather than guessed at.
|
|
66
|
+
pub fn checkaddr(alloc: Allocator, addr: []const u8) Allocator.Error!Answer(void) {
|
|
67
|
+
const scheme = if (std.mem.startsWith(u8, addr, "https://"))
|
|
68
|
+
"https://"
|
|
69
|
+
else if (std.mem.startsWith(u8, addr, "http://"))
|
|
70
|
+
"http://"
|
|
71
|
+
else {
|
|
72
|
+
const bad = try safeaddr(alloc, addr);
|
|
73
|
+
defer alloc.free(bad);
|
|
74
|
+
return .{ .err = try sekreto.fail(
|
|
75
|
+
alloc,
|
|
76
|
+
"sekreto: not an http(s) address: {s}",
|
|
77
|
+
.{bad},
|
|
78
|
+
) };
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Redacted once, and used by every message below: no refusal prints the
|
|
82
|
+
// credential it is refusing.
|
|
83
|
+
const shown = try safeaddr(alloc, addr);
|
|
84
|
+
defer alloc.free(shown);
|
|
85
|
+
|
|
86
|
+
const rest = addr[scheme.len..];
|
|
87
|
+
const authority_end = std.mem.indexOfAny(u8, rest, "/?#") orelse rest.len;
|
|
88
|
+
const authority = rest[0..authority_end];
|
|
89
|
+
|
|
90
|
+
// Userinfo is refused outright rather than parsed around, and on https as
|
|
91
|
+
// well as http. No store this library speaks authenticates by userinfo -
|
|
92
|
+
// they take a token or a signature - so an address carrying one is a
|
|
93
|
+
// mistake at best. At worst it is the attack this whole function exists
|
|
94
|
+
// to stop: `http://localhost:8200@evil.example.com/` is a request to
|
|
95
|
+
// evil.example.com that reads, to anything that splits the authority on
|
|
96
|
+
// ':', as loopback.
|
|
97
|
+
if (null != std.mem.indexOfScalar(u8, authority, '@')) {
|
|
98
|
+
return .{ .err = try sekreto.fail(
|
|
99
|
+
alloc,
|
|
100
|
+
"sekreto: refusing an address with embedded credentials: {s}",
|
|
101
|
+
.{shown},
|
|
102
|
+
) };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// An opening bracket with no closing one is not an address at all.
|
|
106
|
+
if (0 != authority.len and '[' == authority[0] and
|
|
107
|
+
null == std.mem.indexOfScalar(u8, authority, ']'))
|
|
108
|
+
{
|
|
109
|
+
return .{ .err = try sekreto.fail(
|
|
110
|
+
alloc,
|
|
111
|
+
"sekreto: not a valid http(s) address: {s}",
|
|
112
|
+
.{shown},
|
|
113
|
+
) };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (std.mem.eql(u8, "https://", scheme)) {
|
|
117
|
+
return .{ .ok = {} };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// A bracketed IPv6 literal keeps its brackets. Splitting the authority on
|
|
121
|
+
// the first colon yields `[`, so `http://[::1]:8200` could never match -
|
|
122
|
+
// which made the `[::1]` entry below unreachable, and refused a
|
|
123
|
+
// legitimate local vault.
|
|
124
|
+
const raw = if (0 != authority.len and '[' == authority[0]) blk: {
|
|
125
|
+
// The closing bracket is known to be there: the check above returned
|
|
126
|
+
// for an authority that opens one without closing it.
|
|
127
|
+
const close = std.mem.indexOfScalar(u8, authority, ']') orelse authority.len - 1;
|
|
128
|
+
break :blk authority[0 .. close + 1];
|
|
129
|
+
} else blk: {
|
|
130
|
+
const colon = std.mem.indexOfScalar(u8, authority, ':') orelse authority.len;
|
|
131
|
+
break :blk authority[0..colon];
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const host = try std.ascii.allocLowerString(alloc, raw);
|
|
135
|
+
defer alloc.free(host);
|
|
136
|
+
|
|
137
|
+
for ([_][]const u8{ "localhost", "127.0.0.1", "::1", "[::1]" }) |allowed| {
|
|
138
|
+
if (std.mem.eql(u8, allowed, host)) {
|
|
139
|
+
return .{ .ok = {} };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return .{ .err = try sekreto.fail(
|
|
144
|
+
alloc,
|
|
145
|
+
"sekreto: refusing to send a token in plaintext to {s} (use https)",
|
|
146
|
+
.{shown},
|
|
147
|
+
) };
|
|
148
|
+
}
|