@voxgig/sdkgen 4.32.0 → 4.33.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/dist/helpers/naming.js +1 -1
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +7 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/debug.aontu +3 -1
- package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +8 -28
- package/project/.sdk/src/cmp/c/TestClean_c.ts +774 -0
- package/project/.sdk/src/cmp/c/Test_c.ts +3 -0
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +16 -5
- package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -1
- package/project/.sdk/src/cmp/clojure/PrepareAuth_clojure.ts +3 -0
- package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +473 -0
- package/project/.sdk/src/cmp/clojure/Test_clojure.ts +6 -0
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -8
- package/project/.sdk/src/cmp/cpp/PrepareAuth_cpp.ts +3 -0
- package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +782 -0
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +1 -1
- package/project/.sdk/src/cmp/cpp/Test_cpp.ts +2 -0
- package/project/.sdk/src/cmp/csharp/PrepareAuth_csharp.ts +3 -0
- package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +887 -0
- package/project/.sdk/src/cmp/csharp/Test_csharp.ts +2 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +68 -4
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +8 -2
- package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +49 -0
- package/project/.sdk/src/cmp/elixir/PrepareAuth_elixir.ts +3 -0
- package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +20 -10
- package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +666 -0
- package/project/.sdk/src/cmp/elixir/Test_elixir.ts +4 -0
- package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +1 -1
- package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +14 -2
- package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +3 -0
- package/project/.sdk/src/cmp/go/TestClean_go.ts +804 -0
- package/project/.sdk/src/cmp/go/Test_go.ts +3 -0
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +54 -4
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +27 -2
- package/project/.sdk/src/cmp/java/PrepareAuth_java.ts +3 -0
- package/project/.sdk/src/cmp/java/TestClean_java.ts +884 -0
- package/project/.sdk/src/cmp/java/Test_java.ts +2 -0
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +56 -11
- package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +36 -3
- package/project/.sdk/src/cmp/js/PrepareAuth_js.ts +3 -0
- package/project/.sdk/src/cmp/js/TestClean_js.ts +458 -0
- package/project/.sdk/src/cmp/js/Test_js.ts +2 -0
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +5 -4
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +11 -2
- package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +17 -1
- package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +5 -0
- package/project/.sdk/src/cmp/kotlin/PrepareAuth_kotlin.ts +3 -0
- package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +654 -0
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +3 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +44 -11
- package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +31 -0
- package/project/.sdk/src/cmp/lua/PrepareAuth_lua.ts +3 -0
- package/project/.sdk/src/cmp/lua/TestClean_lua.ts +769 -0
- package/project/.sdk/src/cmp/lua/Test_lua.ts +3 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +77 -1
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +49 -2
- package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +3 -2
- package/project/.sdk/src/cmp/ocaml/PrepareAuth_ocaml.ts +4 -25
- package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +538 -0
- package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +5 -0
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +16 -4
- package/project/.sdk/src/cmp/perl/PrepareAuth_perl.ts +3 -0
- package/project/.sdk/src/cmp/perl/TestClean_perl.ts +619 -0
- package/project/.sdk/src/cmp/perl/Test_perl.ts +3 -0
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +67 -5
- package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +13 -1
- package/project/.sdk/src/cmp/php/PrepareAuth_php.ts +3 -0
- package/project/.sdk/src/cmp/php/TestClean_php.ts +809 -0
- package/project/.sdk/src/cmp/php/Test_php.ts +2 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +96 -55
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +15 -2
- package/project/.sdk/src/cmp/py/PrepareAuth_py.ts +3 -0
- package/project/.sdk/src/cmp/py/TestClean_py.ts +549 -0
- package/project/.sdk/src/cmp/py/Test_py.ts +3 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +83 -55
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +19 -3
- package/project/.sdk/src/cmp/rb/PrepareAuth_rb.ts +3 -0
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +535 -0
- package/project/.sdk/src/cmp/rb/Test_rb.ts +3 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +108 -46
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +12 -1
- package/project/.sdk/src/cmp/rust/PrepareAuth_rust.ts +9 -45
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +881 -0
- package/project/.sdk/src/cmp/rust/Test_rust.ts +3 -0
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +14 -6
- package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +17 -1
- package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -2
- package/project/.sdk/src/cmp/scala/PrepareAuth_scala.ts +3 -0
- package/project/.sdk/src/cmp/scala/TestClean_scala.ts +608 -0
- package/project/.sdk/src/cmp/scala/Test_scala.ts +3 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +58 -6
- package/project/.sdk/src/cmp/swift/PrepareAuth_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/TestClean_swift.ts +671 -0
- package/project/.sdk/src/cmp/swift/Test_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +10 -0
- package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +16 -2
- package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +47 -3
- package/project/.sdk/src/cmp/ts/PrepareAuth_ts.ts +3 -0
- package/project/.sdk/src/cmp/ts/TestClean_ts.ts +465 -0
- package/project/.sdk/src/cmp/ts/Test_ts.ts +2 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +5 -4
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +8 -2
- package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +20 -2
- package/project/.sdk/src/cmp/zig/PrepareAuth_zig.ts +3 -0
- package/project/.sdk/src/cmp/zig/TestClean_zig.ts +791 -0
- package/project/.sdk/src/cmp/zig/Test_zig.ts +5 -0
- package/project/.sdk/src/cmp/zig/fragment/Build.fragment.zig +19 -0
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +14 -5
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +1 -1
- package/project/.sdk/tm/c/core/context.c +25 -0
- package/project/.sdk/tm/c/core/error.c +16 -0
- package/project/.sdk/tm/c/core/sdk.h +22 -0
- package/project/.sdk/tm/c/feature/audit.c +2 -0
- package/project/.sdk/tm/c/feature/cost.c +1 -0
- package/project/.sdk/tm/c/feature/debug.c +19 -29
- package/project/.sdk/tm/c/feature/log.c +21 -2
- package/project/.sdk/tm/c/feature/proxy.c +55 -3
- package/project/.sdk/tm/c/feature/secrets.c +7 -0
- package/project/.sdk/tm/c/feature/telemetry.c +2 -0
- package/project/.sdk/tm/c/tests/feature_test.c +2 -2
- package/project/.sdk/tm/c/utility/clean.c +530 -8
- package/project/.sdk/tm/c/utility/done.c +28 -12
- package/project/.sdk/tm/c/utility/make_error.c +4 -3
- package/project/.sdk/tm/c/utility/make_options.c +71 -45
- package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +15 -0
- package/project/.sdk/tm/clojure/src/sdk/client.clj +20 -4
- package/project/.sdk/tm/clojure/src/sdk/core.clj +319 -35
- package/project/.sdk/tm/clojure/src/sdk/features.clj +68 -30
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +4 -2
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +47 -20
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +4 -0
- package/project/.sdk/tm/cpp/core/types.hpp +93 -3
- package/project/.sdk/tm/cpp/feature/audit.hpp +1 -0
- package/project/.sdk/tm/cpp/feature/cost.hpp +1 -0
- package/project/.sdk/tm/cpp/feature/debug.hpp +20 -12
- package/project/.sdk/tm/cpp/feature/log.hpp +31 -9
- package/project/.sdk/tm/cpp/feature/proxy.hpp +52 -6
- package/project/.sdk/tm/cpp/feature/secrets.hpp +13 -0
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +4 -2
- package/project/.sdk/tm/cpp/test/feature_test.cpp +2 -2
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +426 -51
- package/project/.sdk/tm/csharp/core/Context.cs +32 -0
- package/project/.sdk/tm/csharp/core/Utility.cs +2 -0
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +1 -0
- package/project/.sdk/tm/csharp/feature/CostFeature.cs +7 -5
- package/project/.sdk/tm/csharp/feature/DebugFeature.cs +19 -16
- package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +16 -0
- package/project/.sdk/tm/csharp/feature/LogFeature.cs +4 -1
- package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +26 -5
- package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +16 -0
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +4 -2
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +2 -2
- package/project/.sdk/tm/csharp/utility/Clean.cs +440 -2
- package/project/.sdk/tm/csharp/utility/Done.cs +27 -11
- package/project/.sdk/tm/csharp/utility/MakeError.cs +19 -8
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +119 -29
- package/project/.sdk/tm/csharp/utility/MakeResponse.cs +21 -11
- package/project/.sdk/tm/csharp/utility/Register.cs +1 -0
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +19 -0
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +22 -1
- package/project/.sdk/tm/elixir/lib/projectname/error.ex +24 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +2 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature/cost.ex +2 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +13 -13
- package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +18 -5
- package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +19 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +15 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +4 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature.ex +22 -0
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +464 -41
- package/project/.sdk/tm/elixir/test/feature_test.exs +3 -2
- package/project/.sdk/tm/go/core/context.go +42 -0
- package/project/.sdk/tm/go/core/error.go +30 -10
- package/project/.sdk/tm/go/core/utility_type.go +2 -0
- package/project/.sdk/tm/go/feature/audit_feature.go +1 -0
- package/project/.sdk/tm/go/feature/base_feature.go +12 -0
- package/project/.sdk/tm/go/feature/cost_feature.go +2 -2
- package/project/.sdk/tm/go/feature/debug_feature.go +14 -12
- package/project/.sdk/tm/go/feature/log_feature.go +13 -8
- package/project/.sdk/tm/go/feature/proxy_feature.go +26 -6
- package/project/.sdk/tm/go/feature/secrets_feature.go +19 -0
- package/project/.sdk/tm/go/feature/telemetry_feature.go +4 -2
- package/project/.sdk/tm/go/test/feature_test.go +2 -2
- package/project/.sdk/tm/go/utility/clean.go +585 -2
- package/project/.sdk/tm/go/utility/done.go +29 -9
- package/project/.sdk/tm/go/utility/make_error.go +51 -16
- package/project/.sdk/tm/go/utility/make_options.go +77 -36
- package/project/.sdk/tm/go/utility/register.go +12 -0
- package/project/.sdk/tm/java/core/Context.java +29 -0
- package/project/.sdk/tm/java/core/SdkClient.java +4 -2
- package/project/.sdk/tm/java/core/Utility.java +7 -0
- package/project/.sdk/tm/java/feature/AuditFeature.java +6 -0
- package/project/.sdk/tm/java/feature/CostFeature.java +5 -0
- package/project/.sdk/tm/java/feature/DebugFeature.java +25 -14
- package/project/.sdk/tm/java/feature/LogFeature.java +11 -4
- package/project/.sdk/tm/java/feature/ProxyFeature.java +41 -6
- package/project/.sdk/tm/java/feature/SecretsFeature.java +18 -0
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +8 -2
- package/project/.sdk/tm/java/test/FeatureTest.java +2 -2
- package/project/.sdk/tm/java/utility/Clean.java +519 -1
- package/project/.sdk/tm/java/utility/Done.java +1 -1
- package/project/.sdk/tm/java/utility/MakeError.java +5 -1
- package/project/.sdk/tm/java/utility/MakeOptions.java +55 -31
- package/project/.sdk/tm/java/utility/Register.java +4 -0
- package/project/.sdk/tm/js/src/Context.js +5 -1
- package/project/.sdk/tm/js/src/Response.js +14 -1
- package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +2 -2
- package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +2 -2
- package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +13 -7
- package/project/.sdk/tm/js/src/feature/log/LogFeature.js +9 -5
- package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +19 -1
- package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +14 -0
- package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +4 -2
- package/project/.sdk/tm/js/src/utility/CleanUtility.js +294 -21
- package/project/.sdk/tm/js/src/utility/DoneUtility.js +17 -5
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +18 -2
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -15
- package/project/.sdk/tm/js/src/utility/Utility.js +4 -2
- package/project/.sdk/tm/js/test/feature/harness.js +11 -1
- package/project/.sdk/tm/js/test/feature.test.js +9 -2
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +25 -0
- package/project/.sdk/tm/kotlin/core/Context.kt +19 -0
- package/project/.sdk/tm/kotlin/core/SdkClient.kt +9 -2
- package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
- package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +11 -9
- package/project/.sdk/tm/kotlin/feature/CostFeature.kt +8 -5
- package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +15 -22
- package/project/.sdk/tm/kotlin/feature/LogFeature.kt +8 -4
- package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +26 -2
- package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +11 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +4 -2
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +2 -2
- package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +447 -11
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +38 -31
- package/project/.sdk/tm/kotlin/utility/Register.kt +1 -0
- package/project/.sdk/tm/lua/core/context.lua +43 -0
- package/project/.sdk/tm/lua/core/error.lua +36 -1
- package/project/.sdk/tm/lua/core/utility_type.lua +4 -0
- package/project/.sdk/tm/lua/feature/audit_feature.lua +2 -2
- package/project/.sdk/tm/lua/feature/cost_feature.lua +2 -2
- package/project/.sdk/tm/lua/feature/debug_feature.lua +21 -17
- package/project/.sdk/tm/lua/feature/log_feature.lua +2 -1
- package/project/.sdk/tm/lua/feature/proxy_feature.lua +23 -1
- package/project/.sdk/tm/lua/feature/secrets_feature.lua +18 -0
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +4 -2
- package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +3 -2
- package/project/.sdk/tm/lua/test/feature_test.lua +10 -3
- package/project/.sdk/tm/lua/utility/clean.lua +426 -2
- package/project/.sdk/tm/lua/utility/clean_explain.lua +34 -0
- package/project/.sdk/tm/lua/utility/done.lua +1 -7
- package/project/.sdk/tm/lua/utility/make_error.lua +3 -1
- package/project/.sdk/tm/lua/utility/make_options.lua +76 -30
- package/project/.sdk/tm/lua/utility/register.lua +4 -1
- package/project/.sdk/tm/ocaml/Makefile +5 -1
- package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +12 -1
- package/project/.sdk/tm/ocaml/sdk_features.ml +78 -18
- package/project/.sdk/tm/ocaml/sdk_helpers.ml +27 -0
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +304 -26
- package/project/.sdk/tm/ocaml/sdk_types.ml +1 -0
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
- package/project/.sdk/tm/ocaml/test/t_feature.ml +2 -2
- package/project/.sdk/tm/perl/core/context.pm +27 -0
- package/project/.sdk/tm/perl/core/error.pm +52 -5
- package/project/.sdk/tm/perl/feature/audit_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/cost_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/debug_feature.pm +17 -13
- package/project/.sdk/tm/perl/feature/log_feature.pm +3 -1
- package/project/.sdk/tm/perl/feature/proxy_feature.pm +21 -1
- package/project/.sdk/tm/perl/feature/secrets_feature.pm +20 -1
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +4 -2
- package/project/.sdk/tm/perl/t/feature.t +4 -2
- package/project/.sdk/tm/perl/utility/clean.pm +345 -1
- package/project/.sdk/tm/perl/utility/done.pm +24 -6
- package/project/.sdk/tm/perl/utility/make_error.pm +17 -4
- package/project/.sdk/tm/perl/utility/make_options.pm +33 -14
- package/project/.sdk/tm/php/core/Context.php +24 -1
- package/project/.sdk/tm/php/core/Error.php +34 -3
- package/project/.sdk/tm/php/core/UtilityType.php +4 -0
- package/project/.sdk/tm/php/feature/AuditFeature.php +2 -2
- package/project/.sdk/tm/php/feature/CostFeature.php +2 -2
- package/project/.sdk/tm/php/feature/DebugFeature.php +18 -9
- package/project/.sdk/tm/php/feature/LogFeature.php +5 -2
- package/project/.sdk/tm/php/feature/ProxyFeature.php +20 -1
- package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -0
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +4 -2
- package/project/.sdk/tm/php/test/FeatureTest.php +2 -2
- package/project/.sdk/tm/php/utility/Clean.php +438 -2
- package/project/.sdk/tm/php/utility/Done.php +14 -7
- package/project/.sdk/tm/php/utility/MakeError.php +9 -7
- package/project/.sdk/tm/php/utility/MakeOptions.php +62 -38
- package/project/.sdk/tm/php/utility/Register.php +2 -0
- package/project/.sdk/tm/py/pkg/core/context.py +17 -0
- package/project/.sdk/tm/py/pkg/core/error.py +42 -1
- package/project/.sdk/tm/py/pkg/core/utility_type.py +4 -0
- package/project/.sdk/tm/py/pkg/feature/audit_feature.py +2 -2
- package/project/.sdk/tm/py/pkg/feature/cost_feature.py +2 -2
- package/project/.sdk/tm/py/pkg/feature/debug_feature.py +17 -12
- package/project/.sdk/tm/py/pkg/feature/log_feature.py +2 -1
- package/project/.sdk/tm/py/pkg/feature/proxy_feature.py +18 -1
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +12 -0
- package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +4 -2
- package/project/.sdk/tm/py/pkg/utility/clean.py +311 -1
- package/project/.sdk/tm/py/pkg/utility/done.py +18 -5
- package/project/.sdk/tm/py/pkg/utility/make_error.py +9 -6
- package/project/.sdk/tm/py/pkg/utility/make_options.py +64 -25
- package/project/.sdk/tm/py/pkg/utility/make_response.py +19 -13
- package/project/.sdk/tm/py/pkg/utility/register.py +4 -2
- package/project/.sdk/tm/py/test/feature_harness.py +4 -0
- package/project/.sdk/tm/py/test/test_feature.py +2 -2
- package/project/.sdk/tm/py/test/test_primary_utility.py +1 -0
- package/project/.sdk/tm/rb/core/context.rb +28 -0
- package/project/.sdk/tm/rb/core/error.rb +30 -0
- package/project/.sdk/tm/rb/core/utility_type.rb +1 -1
- package/project/.sdk/tm/rb/feature/audit_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/cost_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/debug_feature.rb +15 -12
- package/project/.sdk/tm/rb/feature/log_feature.rb +3 -1
- package/project/.sdk/tm/rb/feature/proxy_feature.rb +25 -1
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +17 -0
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +4 -2
- package/project/.sdk/tm/rb/test/feature_test.rb +4 -2
- package/project/.sdk/tm/rb/utility/clean.rb +312 -1
- package/project/.sdk/tm/rb/utility/done.rb +15 -5
- package/project/.sdk/tm/rb/utility/make_error.rb +13 -4
- package/project/.sdk/tm/rb/utility/make_options.rb +31 -12
- package/project/.sdk/tm/rb/utility/register.rb +2 -0
- package/project/.sdk/tm/rust/core/context.rs +55 -0
- package/project/.sdk/tm/rust/core/utility_type.rs +17 -0
- package/project/.sdk/tm/rust/feature/audit.rs +2 -0
- package/project/.sdk/tm/rust/feature/cost.rs +3 -2
- package/project/.sdk/tm/rust/feature/debug.rs +16 -16
- package/project/.sdk/tm/rust/feature/log.rs +42 -7
- package/project/.sdk/tm/rust/feature/proxy.rs +48 -2
- package/project/.sdk/tm/rust/feature/secrets.rs +12 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +2 -0
- package/project/.sdk/tm/rust/tests/feature_test.rs +2 -2
- package/project/.sdk/tm/rust/utility/clean.rs +446 -5
- package/project/.sdk/tm/rust/utility/done.rs +22 -12
- package/project/.sdk/tm/rust/utility/make_error.rs +4 -1
- package/project/.sdk/tm/rust/utility/make_options.rs +73 -19
- package/project/.sdk/tm/scala/Makefile +3 -1
- package/project/.sdk/tm/scala/core/Context.scala +16 -0
- package/project/.sdk/tm/scala/core/SdkClient.scala +14 -4
- package/project/.sdk/tm/scala/core/SdkError.scala +28 -0
- package/project/.sdk/tm/scala/core/Types.scala +3 -0
- package/project/.sdk/tm/scala/core/Utility.scala +2 -0
- package/project/.sdk/tm/scala/feature/AuditFeature.scala +16 -10
- package/project/.sdk/tm/scala/feature/CostFeature.scala +10 -5
- package/project/.sdk/tm/scala/feature/DebugFeature.scala +24 -21
- package/project/.sdk/tm/scala/feature/LogFeature.scala +9 -4
- package/project/.sdk/tm/scala/feature/ProxyFeature.scala +23 -2
- package/project/.sdk/tm/scala/feature/SecretsFeature.scala +14 -0
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +9 -2
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +2 -2
- package/project/.sdk/tm/scala/utility/Make.scala +63 -20
- package/project/.sdk/tm/scala/utility/Misc.scala +358 -5
- package/project/.sdk/tm/scala/utility/Register.scala +1 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +29 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +2 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +10 -9
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +7 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +19 -15
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +16 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +20 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +13 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +4 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +58 -19
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +1 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +391 -4
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +2 -2
- package/project/.sdk/tm/ts/src/Context.ts +5 -1
- package/project/.sdk/tm/ts/src/Response.ts +14 -1
- package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +2 -2
- package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +2 -2
- package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +13 -7
- package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +9 -5
- package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +19 -1
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +12 -0
- package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +4 -2
- package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +287 -9
- package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +18 -5
- package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +18 -8
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +38 -16
- package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -2
- package/project/.sdk/tm/ts/test/feature/harness.ts +11 -1
- package/project/.sdk/tm/ts/test/feature.test.ts +9 -2
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +25 -0
- package/project/.sdk/tm/zig/core/context.zig +34 -0
- package/project/.sdk/tm/zig/core/error.zig +22 -1
- package/project/.sdk/tm/zig/core/utility.zig +403 -39
- package/project/.sdk/tm/zig/feature/audit.zig +4 -2
- package/project/.sdk/tm/zig/feature/cost.zig +3 -2
- package/project/.sdk/tm/zig/feature/debug.zig +20 -25
- package/project/.sdk/tm/zig/feature/log.zig +3 -1
- package/project/.sdk/tm/zig/feature/proxy.zig +47 -6
- package/project/.sdk/tm/zig/feature/secrets.zig +7 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +4 -2
- package/project/.sdk/tm/zig/test/feature_test.zig +2 -2
- package/project/sdkgen-package.json +1 -1
- package/src/helpers/naming.ts +1 -1
|
@@ -1,20 +1,542 @@
|
|
|
1
|
-
// clean utility (mirrors utility/clean.rs
|
|
1
|
+
// clean utility (mirrors utility/clean.rs).
|
|
2
|
+
//
|
|
3
|
+
// Everything that leaves the pipeline passes through clean: the error, the
|
|
4
|
+
// explain record, the serialised context, and whatever a feature emits.
|
|
5
|
+
// Two layers: every registered secret VALUE (and its encoded forms) is
|
|
6
|
+
// replaced wherever it appears in a string, and every value under a
|
|
7
|
+
// sensitive KEY name is masked whatever it holds. Inside the pipeline data
|
|
8
|
+
// stays raw, so a hook can still read the header it must add to.
|
|
9
|
+
//
|
|
10
|
+
// The registry is the `values` list of the derived clean block that
|
|
11
|
+
// make_options builds (`options.__derived__.clean`). Nodes are shared by
|
|
12
|
+
// pointer, so a feature registering a value later reaches the same list
|
|
13
|
+
// every context reads.
|
|
2
14
|
|
|
3
15
|
#include "sdk.h"
|
|
4
16
|
|
|
17
|
+
#include <ctype.h>
|
|
18
|
+
#include <stdio.h>
|
|
5
19
|
#include <stdlib.h>
|
|
6
20
|
#include <string.h>
|
|
7
21
|
|
|
22
|
+
#define CLEAN_MAXDEPTH 32
|
|
23
|
+
#define CLEAN_CIRCULAR "[circular]"
|
|
24
|
+
#define CLEAN_DEFAULT_MASK "[redacted]"
|
|
25
|
+
|
|
26
|
+
typedef struct {
|
|
27
|
+
bool active;
|
|
28
|
+
voxgig_value* keys; // List of normalised names
|
|
29
|
+
voxgig_value* values; // List of registered forms, longest first
|
|
30
|
+
const char* mask;
|
|
31
|
+
int64_t hint;
|
|
32
|
+
int64_t min;
|
|
33
|
+
} CleanCfg;
|
|
34
|
+
|
|
35
|
+
static char* dup_str(const char* s) {
|
|
36
|
+
if (!s) s = "";
|
|
37
|
+
size_t n = strlen(s);
|
|
38
|
+
char* d = (char*)malloc(n + 1);
|
|
39
|
+
memcpy(d, s, n + 1);
|
|
40
|
+
return d;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static char* normkey(const char* key) {
|
|
44
|
+
size_t n = strlen(key);
|
|
45
|
+
char* out = (char*)malloc(n + 1);
|
|
46
|
+
size_t o = 0;
|
|
47
|
+
for (size_t i = 0; i < n; i++) {
|
|
48
|
+
char c = key[i];
|
|
49
|
+
if ('-' == c || '_' == c) continue;
|
|
50
|
+
out[o++] = (char)tolower((unsigned char)c);
|
|
51
|
+
}
|
|
52
|
+
out[o] = '\0';
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// A comma-separated string as a list of trimmed, non-empty entries; a list
|
|
57
|
+
// is taken as-is.
|
|
58
|
+
static voxgig_value* strs(voxgig_value* val) {
|
|
59
|
+
voxgig_value* out = v_list();
|
|
60
|
+
if (voxgig_is_list(val)) {
|
|
61
|
+
voxgig_list* l = voxgig_as_list(val);
|
|
62
|
+
for (size_t i = 0; i < l->len; i++) {
|
|
63
|
+
if (voxgig_is_string(l->items[i])) {
|
|
64
|
+
voxgig_list_push(voxgig_as_list(out), voxgig_retain(l->items[i]));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
if (!voxgig_is_string(val)) return out;
|
|
70
|
+
const char* p = voxgig_as_string(val);
|
|
71
|
+
while (1) {
|
|
72
|
+
const char* comma = strchr(p, ',');
|
|
73
|
+
const char* start = p;
|
|
74
|
+
const char* end = comma ? comma : p + strlen(p);
|
|
75
|
+
while (start < end && isspace((unsigned char)*start)) start++;
|
|
76
|
+
while (end > start && isspace((unsigned char)end[-1])) end--;
|
|
77
|
+
if (end > start) {
|
|
78
|
+
voxgig_list_push(voxgig_as_list(out), voxgig_new_string_n(start, (size_t)(end - start)));
|
|
79
|
+
}
|
|
80
|
+
if (!comma) break;
|
|
81
|
+
p = comma + 1;
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
voxgig_value* clean_split_values(voxgig_value* values) { return strs(values); }
|
|
87
|
+
|
|
88
|
+
// The spec carries numbers as strings, so every target reads it alike.
|
|
89
|
+
static int64_t count(voxgig_value* val, int64_t dflt) {
|
|
90
|
+
double n;
|
|
91
|
+
if (voxgig_is_int(val)) {
|
|
92
|
+
n = (double)voxgig_as_int(val);
|
|
93
|
+
} else if (voxgig_is_double(val)) {
|
|
94
|
+
n = voxgig_as_double(val);
|
|
95
|
+
} else if (voxgig_is_string(val)) {
|
|
96
|
+
char* end = NULL;
|
|
97
|
+
const char* s = voxgig_as_string(val);
|
|
98
|
+
n = strtod(s, &end);
|
|
99
|
+
if (end == s) return dflt;
|
|
100
|
+
} else {
|
|
101
|
+
return dflt;
|
|
102
|
+
}
|
|
103
|
+
if (n != n || n < 0) return dflt;
|
|
104
|
+
return (int64_t)n;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
voxgig_value* clean_make_config(voxgig_value* cleanopts) {
|
|
108
|
+
voxgig_value* activev = getp(cleanopts, "active");
|
|
109
|
+
bool active = !(voxgig_is_bool(activev) && !voxgig_as_bool(activev));
|
|
110
|
+
const char* mask = get_str(cleanopts, "mask");
|
|
111
|
+
if (!mask) mask = CLEAN_DEFAULT_MASK;
|
|
112
|
+
|
|
113
|
+
voxgig_value* keys = v_list();
|
|
114
|
+
voxgig_value* rawkeys = strs(getp(cleanopts, "keys"));
|
|
115
|
+
voxgig_list* rl = voxgig_as_list(rawkeys);
|
|
116
|
+
for (size_t i = 0; i < rl->len; i++) {
|
|
117
|
+
char* nk = normkey(voxgig_as_string(rl->items[i]));
|
|
118
|
+
if (nk[0] != '\0') voxgig_list_push(voxgig_as_list(keys), v_str(nk));
|
|
119
|
+
free(nk);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
int64_t min = count(getp(cleanopts, "min"), 4);
|
|
123
|
+
if (min < 1) min = 1;
|
|
124
|
+
|
|
125
|
+
return cmap(6,
|
|
126
|
+
"active", v_bool(active),
|
|
127
|
+
"keys", keys,
|
|
128
|
+
"values", v_list(),
|
|
129
|
+
"mask", v_str(mask),
|
|
130
|
+
"hint", v_int(count(getp(cleanopts, "hint"), 0)),
|
|
131
|
+
"min", v_int(min));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static voxgig_value* derived_block(voxgig_value* options) {
|
|
135
|
+
return getpath2(options, "__derived__", "clean");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// A context without options (make_error is reached with a bare one) falls
|
|
139
|
+
// back to the schema defaults, so nothing leaves raw for want of a
|
|
140
|
+
// constructor.
|
|
141
|
+
static voxgig_value* config_block(Context* ctx) {
|
|
142
|
+
voxgig_value* derived = ctx ? derived_block(ctx->options) : NULL;
|
|
143
|
+
if (voxgig_is_map(derived)) return derived;
|
|
144
|
+
return clean_make_config(getp(shared_optspec(), "clean"));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static void read_cfg(voxgig_value* block, CleanCfg* cfg) {
|
|
148
|
+
voxgig_value* activev = getp(block, "active");
|
|
149
|
+
cfg->active = !(voxgig_is_bool(activev) && !voxgig_as_bool(activev));
|
|
150
|
+
cfg->keys = strs(getp(block, "keys"));
|
|
151
|
+
cfg->values = strs(getp(block, "values"));
|
|
152
|
+
cfg->mask = get_str(block, "mask");
|
|
153
|
+
if (!cfg->mask) cfg->mask = CLEAN_DEFAULT_MASK;
|
|
154
|
+
cfg->hint = count(getp(block, "hint"), 0);
|
|
155
|
+
cfg->min = count(getp(block, "min"), 4);
|
|
156
|
+
if (cfg->min < 1) cfg->min = 1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Standard base64 (RFC 4648), for the encoded form of a registered value
|
|
160
|
+
// and for the `Authorization: Basic` composite. Returns a malloc'd string.
|
|
161
|
+
char* clean_base64(const char* in) {
|
|
162
|
+
static const char ALPHABET[] =
|
|
163
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
164
|
+
size_t n = strlen(in);
|
|
165
|
+
char* out = (char*)malloc((n + 2) / 3 * 4 + 1);
|
|
166
|
+
size_t o = 0;
|
|
167
|
+
for (size_t i = 0; i < n; i += 3) {
|
|
168
|
+
unsigned int v = (unsigned char)in[i] << 16;
|
|
169
|
+
if (i + 1 < n) v |= (unsigned int)(unsigned char)in[i + 1] << 8;
|
|
170
|
+
if (i + 2 < n) v |= (unsigned int)(unsigned char)in[i + 2];
|
|
171
|
+
out[o++] = ALPHABET[(v >> 18) & 0x3f];
|
|
172
|
+
out[o++] = ALPHABET[(v >> 12) & 0x3f];
|
|
173
|
+
out[o++] = (i + 1 < n) ? ALPHABET[(v >> 6) & 0x3f] : '=';
|
|
174
|
+
out[o++] = (i + 2 < n) ? ALPHABET[v & 0x3f] : '=';
|
|
175
|
+
}
|
|
176
|
+
out[o] = '\0';
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// The encoded forms a value travels in: Basic and Bearer both carry base64,
|
|
181
|
+
// a query credential is percent-encoded, and a JSON dump escapes it.
|
|
182
|
+
static voxgig_value* forms(const char* value) {
|
|
183
|
+
voxgig_value* out = v_list();
|
|
184
|
+
voxgig_list* l = voxgig_as_list(out);
|
|
185
|
+
voxgig_list_push(l, v_str(value));
|
|
186
|
+
|
|
187
|
+
char* b64 = clean_base64(value);
|
|
188
|
+
char* url = voxgig_escurl(v_str(value));
|
|
189
|
+
char* json = voxgig_jsonify(v_str(value), NULL);
|
|
190
|
+
char* cands[3] = { b64, url, NULL };
|
|
191
|
+
size_t jn = json ? strlen(json) : 0;
|
|
192
|
+
if (2 <= jn) {
|
|
193
|
+
json[jn - 1] = '\0';
|
|
194
|
+
cands[2] = json + 1;
|
|
195
|
+
}
|
|
196
|
+
for (int c = 0; c < 3; c++) {
|
|
197
|
+
const char* s = cands[c];
|
|
198
|
+
if (!s || s[0] == '\0') continue;
|
|
199
|
+
bool present = false;
|
|
200
|
+
for (size_t i = 0; i < l->len; i++) {
|
|
201
|
+
if (0 == strcmp(voxgig_as_string(l->items[i]), s)) { present = true; break; }
|
|
202
|
+
}
|
|
203
|
+
if (!present) voxgig_list_push(l, v_str(s));
|
|
204
|
+
}
|
|
205
|
+
free(b64);
|
|
206
|
+
free(url);
|
|
207
|
+
free(json);
|
|
208
|
+
return out;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
static int longest_first(const void* a, const void* b) {
|
|
212
|
+
voxgig_value* va = *(voxgig_value* const*)a;
|
|
213
|
+
voxgig_value* vb = *(voxgig_value* const*)b;
|
|
214
|
+
size_t la = voxgig_is_string(va) ? voxgig_string_len(va) : 0;
|
|
215
|
+
size_t lb = voxgig_is_string(vb) ? voxgig_string_len(vb) : 0;
|
|
216
|
+
return la < lb ? 1 : (la > lb ? -1 : 0);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Register a secret value against an options map. Idempotent; shorter
|
|
220
|
+
// than `min` is not a secret the SDK can mask without blanking ordinary
|
|
221
|
+
// text. A map with no derived block registers nothing.
|
|
222
|
+
void clean_add_opts(voxgig_value* options, const char* value) {
|
|
223
|
+
if (!value) return;
|
|
224
|
+
voxgig_value* block = derived_block(options);
|
|
225
|
+
if (!voxgig_is_map(block)) return;
|
|
226
|
+
int64_t min = count(getp(block, "min"), 4);
|
|
227
|
+
if (min < 1) min = 1;
|
|
228
|
+
if ((int64_t)strlen(value) < min) return;
|
|
229
|
+
|
|
230
|
+
voxgig_value* list = getp(block, "values");
|
|
231
|
+
if (!voxgig_is_list(list)) {
|
|
232
|
+
list = v_list();
|
|
233
|
+
setp(block, "values", list);
|
|
234
|
+
}
|
|
235
|
+
voxgig_list* l = voxgig_as_list(list);
|
|
236
|
+
|
|
237
|
+
bool changed = false;
|
|
238
|
+
voxgig_list* fl = voxgig_as_list(forms(value));
|
|
239
|
+
for (size_t i = 0; i < fl->len; i++) {
|
|
240
|
+
const char* form = voxgig_as_string(fl->items[i]);
|
|
241
|
+
if ((int64_t)strlen(form) < min) continue;
|
|
242
|
+
bool present = false;
|
|
243
|
+
for (size_t j = 0; j < l->len; j++) {
|
|
244
|
+
if (voxgig_is_string(l->items[j]) && 0 == strcmp(voxgig_as_string(l->items[j]), form)) {
|
|
245
|
+
present = true;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (!present) {
|
|
250
|
+
voxgig_list_push(l, v_str(form));
|
|
251
|
+
changed = true;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (changed && 1 < l->len) {
|
|
255
|
+
qsort(l->items, l->len, sizeof(voxgig_value*), longest_first);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Register a secret value the context's options will mask from now on.
|
|
260
|
+
void clean_add_util(Context* ctx, const char* value) {
|
|
261
|
+
if (!ctx) return;
|
|
262
|
+
clean_add_opts(ctx->options, value);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
static char* mask_value(const CleanCfg* cfg, const char* value) {
|
|
266
|
+
size_t n = strlen(value);
|
|
267
|
+
if (0 < cfg->hint && (int64_t)n > 2 * cfg->hint) {
|
|
268
|
+
size_t ml = strlen(cfg->mask);
|
|
269
|
+
char* out = (char*)malloc(ml + (size_t)cfg->hint + 1);
|
|
270
|
+
memcpy(out, cfg->mask, ml);
|
|
271
|
+
memcpy(out + ml, value + n - (size_t)cfg->hint, (size_t)cfg->hint);
|
|
272
|
+
out[ml + (size_t)cfg->hint] = '\0';
|
|
273
|
+
return out;
|
|
274
|
+
}
|
|
275
|
+
return dup_str(cfg->mask);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
static char* replace_all(const char* text, const char* from, const char* to) {
|
|
279
|
+
size_t fl = strlen(from);
|
|
280
|
+
size_t tl = strlen(to);
|
|
281
|
+
size_t cap = strlen(text) + 1;
|
|
282
|
+
char* out = (char*)malloc(cap);
|
|
283
|
+
size_t o = 0;
|
|
284
|
+
const char* p = text;
|
|
285
|
+
while (1) {
|
|
286
|
+
const char* hit = strstr(p, from);
|
|
287
|
+
size_t seg = hit ? (size_t)(hit - p) : strlen(p);
|
|
288
|
+
if (o + seg + tl + 1 > cap) {
|
|
289
|
+
cap = (o + seg + tl + 1) * 2;
|
|
290
|
+
out = (char*)realloc(out, cap);
|
|
291
|
+
}
|
|
292
|
+
memcpy(out + o, p, seg);
|
|
293
|
+
o += seg;
|
|
294
|
+
if (!hit) break;
|
|
295
|
+
memcpy(out + o, to, tl);
|
|
296
|
+
o += tl;
|
|
297
|
+
p = hit + fl;
|
|
298
|
+
}
|
|
299
|
+
out[o] = '\0';
|
|
300
|
+
return out;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
static char* clean_string(const CleanCfg* cfg, const char* text) {
|
|
304
|
+
char* out = dup_str(text);
|
|
305
|
+
voxgig_list* vl = voxgig_as_list(cfg->values);
|
|
306
|
+
for (size_t i = 0; i < vl->len; i++) {
|
|
307
|
+
const char* value = voxgig_as_string(vl->items[i]);
|
|
308
|
+
if (value[0] != '\0' && strstr(out, value)) {
|
|
309
|
+
char* masked = mask_value(cfg, value);
|
|
310
|
+
char* next = replace_all(out, value, masked);
|
|
311
|
+
free(masked);
|
|
312
|
+
free(out);
|
|
313
|
+
out = next;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return out;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
static bool sensitive_key(const CleanCfg* cfg, const char* key) {
|
|
320
|
+
if (!key) return false;
|
|
321
|
+
char* nk = normkey(key);
|
|
322
|
+
bool hit = false;
|
|
323
|
+
voxgig_list* kl = voxgig_as_list(cfg->keys);
|
|
324
|
+
for (size_t i = 0; i < kl->len; i++) {
|
|
325
|
+
if (strstr(nk, voxgig_as_string(kl->items[i]))) { hit = true; break; }
|
|
326
|
+
}
|
|
327
|
+
free(nk);
|
|
328
|
+
return hit;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
typedef struct {
|
|
332
|
+
const void* ptrs[CLEAN_MAXDEPTH + 1];
|
|
333
|
+
size_t n;
|
|
334
|
+
} Seen;
|
|
335
|
+
|
|
336
|
+
static const void* node_ptr(voxgig_value* val) {
|
|
337
|
+
if (voxgig_is_list(val)) return (const void*)voxgig_as_list(val);
|
|
338
|
+
if (voxgig_is_map(val)) return (const void*)voxgig_as_map(val);
|
|
339
|
+
return NULL;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
static bool seen_has(const Seen* seen, const void* p) {
|
|
343
|
+
for (size_t i = 0; i < seen->n; i++) {
|
|
344
|
+
if (seen->ptrs[i] == p) return true;
|
|
345
|
+
}
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// A registered value used as a property name is masked like any other
|
|
350
|
+
// string; names that mask alike take a counter, so none is lost.
|
|
351
|
+
static char* clean_name(const CleanCfg* cfg, voxgig_value* out, const char* key) {
|
|
352
|
+
char* name = clean_string(cfg, key);
|
|
353
|
+
voxgig_map* om = voxgig_as_map(out);
|
|
354
|
+
if (0 == strcmp(name, key) || !voxgig_map_get(om, name)) return name;
|
|
355
|
+
size_t cap = strlen(name) + 24;
|
|
356
|
+
char* alt = (char*)malloc(cap);
|
|
357
|
+
for (size_t i = 1;; i++) {
|
|
358
|
+
snprintf(alt, cap, "%s#%zu", name, i);
|
|
359
|
+
if (!voxgig_map_get(om, alt)) break;
|
|
360
|
+
}
|
|
361
|
+
free(name);
|
|
362
|
+
return alt;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// A plain-data copy of what is about to leave: functions are dropped
|
|
366
|
+
// (NULL), cycles are cut, and no live node is shared with the copy -
|
|
367
|
+
// masking the copy must never mask the pipeline's own spec.
|
|
368
|
+
static voxgig_value* snapshot(const CleanCfg* cfg, voxgig_value* val, const char* key,
|
|
369
|
+
size_t depth, Seen* seen) {
|
|
370
|
+
if (!val || voxgig_is_undef(val) || voxgig_is_null(val)) return val;
|
|
371
|
+
|
|
372
|
+
if (voxgig_is_string(val)) {
|
|
373
|
+
char* s = sensitive_key(cfg, key) ? mask_value(cfg, voxgig_as_string(val))
|
|
374
|
+
: clean_string(cfg, voxgig_as_string(val));
|
|
375
|
+
voxgig_value* out = v_str(s);
|
|
376
|
+
free(s);
|
|
377
|
+
return out;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (voxgig_is_func(val)) return NULL;
|
|
381
|
+
|
|
382
|
+
if (!voxgig_is_list(val) && !voxgig_is_map(val)) {
|
|
383
|
+
return sensitive_key(cfg, key) ? v_str(cfg->mask) : val;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const void* ptr = node_ptr(val);
|
|
387
|
+
if (CLEAN_MAXDEPTH <= depth || seen_has(seen, ptr)) return v_str(CLEAN_CIRCULAR);
|
|
388
|
+
if (sensitive_key(cfg, key)) return v_str(cfg->mask);
|
|
389
|
+
|
|
390
|
+
seen->ptrs[seen->n++] = ptr;
|
|
391
|
+
voxgig_value* out;
|
|
392
|
+
if (voxgig_is_list(val)) {
|
|
393
|
+
out = v_list();
|
|
394
|
+
voxgig_list* l = voxgig_as_list(val);
|
|
395
|
+
for (size_t i = 0; i < l->len; i++) {
|
|
396
|
+
voxgig_value* cv = snapshot(cfg, l->items[i], NULL, depth + 1, seen);
|
|
397
|
+
if (cv) voxgig_list_push(voxgig_as_list(out), voxgig_retain(cv));
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
out = v_map();
|
|
401
|
+
voxgig_map* m = voxgig_as_map(val);
|
|
402
|
+
for (size_t i = 0; i < m->len; i++) {
|
|
403
|
+
voxgig_value* cv = snapshot(cfg, m->entries[i].value, m->entries[i].key, depth + 1, seen);
|
|
404
|
+
if (cv) {
|
|
405
|
+
char* name = clean_name(cfg, out, m->entries[i].key);
|
|
406
|
+
setp(out, name, cv);
|
|
407
|
+
free(name);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
seen->n--;
|
|
412
|
+
return out;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
static voxgig_value* clean_with(const CleanCfg* cfg, voxgig_value* val) {
|
|
416
|
+
if (!cfg->active) return val;
|
|
417
|
+
if (voxgig_is_string(val)) {
|
|
418
|
+
char* s = clean_string(cfg, voxgig_as_string(val));
|
|
419
|
+
voxgig_value* out = v_str(s);
|
|
420
|
+
free(s);
|
|
421
|
+
return out;
|
|
422
|
+
}
|
|
423
|
+
Seen seen;
|
|
424
|
+
seen.n = 0;
|
|
425
|
+
voxgig_value* out = snapshot(cfg, val, NULL, 0, &seen);
|
|
426
|
+
return out ? out : v_undef();
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Clean a value on its way out. A string is redacted; anything else comes
|
|
430
|
+
// back as a masked plain-data copy.
|
|
8
431
|
voxgig_value* clean_util(Context* ctx, voxgig_value* val) {
|
|
9
|
-
|
|
10
|
-
|
|
432
|
+
CleanCfg cfg;
|
|
433
|
+
read_cfg(config_block(ctx), &cfg);
|
|
434
|
+
return clean_with(&cfg, val);
|
|
11
435
|
}
|
|
12
436
|
|
|
13
437
|
char* clean_str(Context* ctx, const char* val) {
|
|
14
|
-
(void)ctx;
|
|
15
438
|
if (!val) val = "";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
439
|
+
CleanCfg cfg;
|
|
440
|
+
read_cfg(config_block(ctx), &cfg);
|
|
441
|
+
if (!cfg.active) return dup_str(val);
|
|
442
|
+
return clean_string(&cfg, val);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// Clean a value against an options map rather than a context, for a
|
|
446
|
+
// feature that holds the options but no context.
|
|
447
|
+
voxgig_value* clean_opts(voxgig_value* options, voxgig_value* val) {
|
|
448
|
+
voxgig_value* block = derived_block(options);
|
|
449
|
+
if (!voxgig_is_map(block)) return val;
|
|
450
|
+
CleanCfg cfg;
|
|
451
|
+
read_cfg(block, &cfg);
|
|
452
|
+
return clean_with(&cfg, val);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Is this key name sensitive under the context's clean configuration?
|
|
456
|
+
bool clean_key_util(Context* ctx, const char* key) {
|
|
457
|
+
CleanCfg cfg;
|
|
458
|
+
read_cfg(config_block(ctx), &cfg);
|
|
459
|
+
return sensitive_key(&cfg, key);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// An error that never passed through make_error, cleaned in place: every
|
|
463
|
+
// text field and both snapshots.
|
|
464
|
+
void clean_error_util(Context* ctx, PNError* err) {
|
|
465
|
+
if (!err) return;
|
|
466
|
+
CleanCfg cfg;
|
|
467
|
+
read_cfg(config_block(ctx), &cfg);
|
|
468
|
+
if (!cfg.active) return;
|
|
469
|
+
char* msg = clean_string(&cfg, err->msg ? err->msg : "");
|
|
470
|
+
free(err->msg);
|
|
471
|
+
err->msg = msg;
|
|
472
|
+
char* code = clean_string(&cfg, err->code ? err->code : "");
|
|
473
|
+
free(err->code);
|
|
474
|
+
err->code = code;
|
|
475
|
+
if (err->result) err->result = clean_with(&cfg, err->result);
|
|
476
|
+
if (err->spec) err->spec = clean_with(&cfg, err->spec);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
typedef struct {
|
|
480
|
+
const void** ptrs;
|
|
481
|
+
size_t n;
|
|
482
|
+
size_t cap;
|
|
483
|
+
} Visited;
|
|
484
|
+
|
|
485
|
+
static void add_sensitive(const CleanCfg* cfg, voxgig_value* options, voxgig_value* val,
|
|
486
|
+
bool under, size_t depth, Visited* seen) {
|
|
487
|
+
if (!val || CLEAN_MAXDEPTH <= depth) return;
|
|
488
|
+
if (voxgig_is_string(val)) {
|
|
489
|
+
if (under) clean_add_opts(options, voxgig_as_string(val));
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
if (voxgig_is_number(val)) {
|
|
493
|
+
if (under) {
|
|
494
|
+
char* text = voxgig_stringify(val, -1);
|
|
495
|
+
clean_add_opts(options, text);
|
|
496
|
+
free(text);
|
|
497
|
+
}
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (!voxgig_is_list(val) && !voxgig_is_map(val)) return;
|
|
501
|
+
|
|
502
|
+
const void* ptr = node_ptr(val);
|
|
503
|
+
for (size_t i = 0; i < seen->n; i++) {
|
|
504
|
+
if (seen->ptrs[i] == ptr) return;
|
|
505
|
+
}
|
|
506
|
+
if (seen->n == seen->cap) {
|
|
507
|
+
seen->cap = seen->cap ? seen->cap * 2 : 16;
|
|
508
|
+
seen->ptrs = (const void**)realloc((void*)seen->ptrs, seen->cap * sizeof(void*));
|
|
509
|
+
}
|
|
510
|
+
seen->ptrs[seen->n++] = ptr;
|
|
511
|
+
|
|
512
|
+
if (voxgig_is_list(val)) {
|
|
513
|
+
voxgig_list* l = voxgig_as_list(val);
|
|
514
|
+
for (size_t i = 0; i < l->len; i++) {
|
|
515
|
+
add_sensitive(cfg, options, l->items[i], under, depth + 1, seen);
|
|
516
|
+
}
|
|
517
|
+
} else {
|
|
518
|
+
voxgig_map* m = voxgig_as_map(val);
|
|
519
|
+
for (size_t i = 0; i < m->len; i++) {
|
|
520
|
+
bool sub = under || sensitive_key(cfg, m->entries[i].key);
|
|
521
|
+
add_sensitive(cfg, options, m->entries[i].value, sub, depth + 1, seen);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Every scalar under a sensitive name, at any depth and of any shape, is
|
|
527
|
+
// registered against `options`: a credential mistyped as a map or a number
|
|
528
|
+
// is still a credential.
|
|
529
|
+
void clean_add_sensitive_opts(voxgig_value* options, voxgig_value* val) {
|
|
530
|
+
voxgig_value* block = derived_block(options);
|
|
531
|
+
if (!voxgig_is_map(block)) return;
|
|
532
|
+
CleanCfg cfg;
|
|
533
|
+
read_cfg(block, &cfg);
|
|
534
|
+
Visited seen = { NULL, 0, 0 };
|
|
535
|
+
add_sensitive(&cfg, options, val, false, 0, &seen);
|
|
536
|
+
free((void*)seen.ptrs);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
void clean_add_sensitive_util(Context* ctx, voxgig_value* val) {
|
|
540
|
+
if (!ctx) return;
|
|
541
|
+
clean_add_sensitive_opts(ctx->options, val);
|
|
20
542
|
}
|
|
@@ -3,18 +3,7 @@
|
|
|
3
3
|
#include "sdk.h"
|
|
4
4
|
|
|
5
5
|
voxgig_value* done_util(Context* ctx, PNError** err) {
|
|
6
|
-
|
|
7
|
-
if (control_has_explain(c)) {
|
|
8
|
-
voxgig_value* explain = clean_util(ctx, c->explain);
|
|
9
|
-
voxgig_value* res = getp(explain, "result");
|
|
10
|
-
if (voxgig_is_map(res)) {
|
|
11
|
-
voxgig_value* rm = to_map(res);
|
|
12
|
-
voxgig_value* k = voxgig_new_string("err");
|
|
13
|
-
voxgig_delprop(rm, k);
|
|
14
|
-
voxgig_release(k);
|
|
15
|
-
}
|
|
16
|
-
c->explain = explain;
|
|
17
|
-
}
|
|
6
|
+
clean_explain_util(ctx);
|
|
18
7
|
|
|
19
8
|
SdkResult* result = ctx->result;
|
|
20
9
|
if (result && result->ok) {
|
|
@@ -24,3 +13,30 @@ voxgig_value* done_util(Context* ctx, PNError** err) {
|
|
|
24
13
|
|
|
25
14
|
return make_error_util(ctx, NULL, err);
|
|
26
15
|
}
|
|
16
|
+
|
|
17
|
+
// Clean the explain record in place. It is the caller's own map (Control
|
|
18
|
+
// keeps the pointer), so its entries are replaced by the cleaned copy's; with
|
|
19
|
+
// clean off the cleaned record is that map, already current.
|
|
20
|
+
void clean_explain_util(Context* ctx) {
|
|
21
|
+
Control* c = ctx->ctrl;
|
|
22
|
+
if (!control_has_explain(c)) return;
|
|
23
|
+
voxgig_value* explain = c->explain;
|
|
24
|
+
voxgig_value* cleaned = clean_util(ctx, explain);
|
|
25
|
+
if (cleaned != explain && voxgig_is_map(cleaned)) {
|
|
26
|
+
voxgig_map* em = voxgig_as_map(explain);
|
|
27
|
+
// Clearing releases each value; pipeline code never frees one.
|
|
28
|
+
for (size_t i = 0; i < em->len; i++) voxgig_retain(em->entries[i].value);
|
|
29
|
+
voxgig_map_clear(em);
|
|
30
|
+
voxgig_map* cm = voxgig_as_map(cleaned);
|
|
31
|
+
for (size_t i = 0; i < cm->len; i++) {
|
|
32
|
+
setp(explain, cm->entries[i].key, voxgig_retain(cm->entries[i].value));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// explain.result is a result_to_value snapshot, never the live result.
|
|
36
|
+
voxgig_value* res = getp(explain, "result");
|
|
37
|
+
if (voxgig_is_map(res)) {
|
|
38
|
+
voxgig_value* k = voxgig_new_string("err");
|
|
39
|
+
voxgig_delprop(res, k);
|
|
40
|
+
voxgig_release(k);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -35,16 +35,17 @@ voxgig_value* make_error_util(Context* ctx, PNError* err, PNError** out) {
|
|
|
35
35
|
|
|
36
36
|
voxgig_value* spec_val = ctx->spec ? spec_to_value(ctx->spec) : voxgig_new_undef();
|
|
37
37
|
|
|
38
|
+
clean_explain_util(ctx);
|
|
39
|
+
|
|
38
40
|
Control* c = ctx->ctrl;
|
|
39
41
|
if (control_has_explain(c)) {
|
|
40
42
|
setp(c->explain, "err", cmap(1, "message", v_str(msg)));
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
PNError* sdk_err = pn_error_new("", msg);
|
|
46
|
+
// A hook's own error supplies the code as well as the message.
|
|
44
47
|
free(sdk_err->code);
|
|
45
|
-
|
|
46
|
-
sdk_err->code = (char*)malloc(cn + 1);
|
|
47
|
-
memcpy(sdk_err->code, use->code, cn + 1);
|
|
48
|
+
sdk_err->code = clean_str(ctx, use->code);
|
|
48
49
|
sdk_err->result = clean_util(ctx, result_to_value(result));
|
|
49
50
|
sdk_err->spec = clean_util(ctx, spec_val);
|
|
50
51
|
|