TT-17102: Add features to support gateway wiring#153
Conversation
* feat: add implementation to Resolve func * feat: add resolveAll implementation * test: add test cases for json pointer extraction * refactor: update error messages and make error handlin more consistent * refactor: update resolve tests * refactor: update resolveAll tests with grouping error cases * fix: added malformed err with tests, added docs string * test: add test suite with path routing * fix: remove redundant assertions and update comment * test: add test case that resolve all resolved mixed values * fix: use decoding with numbers to avoid losing large integers and update doc strings explaining inner behavior * fix: add checks with tests to avoid processing values when store or key is empty string * fix: remove spaces around em-dashes and add missing tests for missing stores and keys * chore: remove redundant comments * fix: address sonarqube comment with avoiding duplication * fix: add json validation on document even if it doesn't contain kv refs * refactor: split resolver for public and private parts to hide inner logic with lenient mode in future * chore: replace background context with test one * feat: add cache bypass context logic to skip serving the value from cache when its desired * feat: add lenient mode to the resolver * feat: add base implementation of new from config * refactor: update implementation with clear func separation and code simplification; add docs * fix: lint errors * chore: remove redundant comments * feat: add file provider as a type with registry processing it as a local type provider * refactor: add more comments and explanation about phase1 and phase2 and why we need them to increase readability * refactor: remove isLocalType func and attach the logic to provider type to avoid OCP and increase discoverability * fix: missing pieces from last commit * docs: update docstring and comment explaining better why process should resolved value for non-local stores only * feat: add ability to override default factories when WithFactories opt is used * test: add tests covering logic with factories overriding --------- Co-authored-by: Vlad Zabolotnyi <vlad.z@tyk.io>
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA 0 out of 2 committers have signed the CLA. |
|
This pull request introduces a comprehensive, pluggable Key-Value (KV) secrets management system. This new system supports multiple backends (Vault, Consul, environment variables, files, and inline configuration) and features a sophisticated two-phase initialization process. This allows remote secret stores to be configured using credentials sourced from local providers, resolving a common bootstrap challenge. Files Changed AnalysisThis is a large, primarily additive PR, introducing a new, well-tested subsystem. The changes are concentrated in the
Architecture & Impact Assessment
graph TD |
Security Issues (2)
Security Issues (2)
Performance Issues (1)
Quality Issues (1)
Powered by Visor from Probelabs Last updated: 2026-07-10T11:37:11.203Z | Triggered by: pr_updated | Commit: e889a78 💡 TIP: You can chat with Visor using |
* feat: add implementation to Resolve func * feat: add resolveAll implementation * test: add test cases for json pointer extraction * refactor: update error messages and make error handlin more consistent * refactor: update resolve tests * refactor: update resolveAll tests with grouping error cases * fix: added malformed err with tests, added docs string * test: add test suite with path routing * fix: remove redundant assertions and update comment * test: add test case that resolve all resolved mixed values * fix: use decoding with numbers to avoid losing large integers and update doc strings explaining inner behavior * fix: add checks with tests to avoid processing values when store or key is empty string * fix: remove spaces around em-dashes and add missing tests for missing stores and keys * chore: remove redundant comments * fix: address sonarqube comment with avoiding duplication * fix: add json validation on document even if it doesn't contain kv refs * refactor: split resolver for public and private parts to hide inner logic with lenient mode in future * chore: replace background context with test one * feat: add cache bypass context logic to skip serving the value from cache when its desired * feat: add lenient mode to the resolver * feat: add base implementation of new from config * refactor: update implementation with clear func separation and code simplification; add docs * fix: lint errors * chore: remove redundant comments * feat: add file provider as a type with registry processing it as a local type provider * refactor: add more comments and explanation about phase1 and phase2 and why we need them to increase readability * refactor: remove isLocalType func and attach the logic to provider type to avoid OCP and increase discoverability * fix: missing pieces from last commit * docs: update docstring and comment explaining better why process should resolved value for non-local stores only * feat: add file provider with tests * feat: add sentinel errors and rework current errors * feat: update returning error when file is not exist on the provided key * feat: adapt the KeyNotFoundError to the standalone providers * refactor: put the provider_test to kv_test to test public methods and interfaces * feat: add ability to override default factories when WithFactories opt is used * feat: add file provider registration at the default registry * test: add tests covering logic with factories overriding * fix: update the logic with rejecting retrieving when basePath is not provided * fix: add case to cover empty keys * fix: add guard against non-abs for base_path --------- Co-authored-by: Vlad Zabolotnyi <vlad.z@tyk.io>
* feat: add implementation to Resolve func * feat: add resolveAll implementation * test: add test cases for json pointer extraction * refactor: update error messages and make error handlin more consistent * refactor: update resolve tests * refactor: update resolveAll tests with grouping error cases * fix: added malformed err with tests, added docs string * test: add test suite with path routing * fix: remove redundant assertions and update comment * test: add test case that resolve all resolved mixed values * fix: use decoding with numbers to avoid losing large integers and update doc strings explaining inner behavior * fix: add checks with tests to avoid processing values when store or key is empty string * fix: remove spaces around em-dashes and add missing tests for missing stores and keys * chore: remove redundant comments * fix: address sonarqube comment with avoiding duplication * fix: add json validation on document even if it doesn't contain kv refs * refactor: split resolver for public and private parts to hide inner logic with lenient mode in future * chore: replace background context with test one * feat: add cache bypass context logic to skip serving the value from cache when its desired * feat: add lenient mode to the resolver * feat: add base implementation of new from config * refactor: update implementation with clear func separation and code simplification; add docs * fix: lint errors * chore: remove redundant comments * feat: add file provider as a type with registry processing it as a local type provider * refactor: add more comments and explanation about phase1 and phase2 and why we need them to increase readability * refactor: remove isLocalType func and attach the logic to provider type to avoid OCP and increase discoverability * fix: missing pieces from last commit * docs: update docstring and comment explaining better why process should resolved value for non-local stores only * feat: add file provider with tests * feat: add sentinel errors and rework current errors * feat: update returning error when file is not exist on the provided key * feat: adapt the KeyNotFoundError to the standalone providers * refactor: put the provider_test to kv_test to test public methods and interfaces * feat: add ability to override default factories when WithFactories opt is used * feat: add file provider registration at the default registry * test: add tests covering logic with factories overriding * fix: update the logic with rejecting retrieving when basePath is not provided * fix: add case to cover empty keys * fix: add guard against non-abs for base_path * feat: add base implementation for env provider * feat: force mandatory prefix to prevent accessing undesired env variables * chore: remove comment --------- Co-authored-by: Vlad Zabolotnyi <vlad.z@tyk.io>
* feat: add implementation to Resolve func * feat: add resolveAll implementation * test: add test cases for json pointer extraction * refactor: update error messages and make error handlin more consistent * refactor: update resolve tests * refactor: update resolveAll tests with grouping error cases * fix: added malformed err with tests, added docs string * test: add test suite with path routing * fix: remove redundant assertions and update comment * test: add test case that resolve all resolved mixed values * fix: use decoding with numbers to avoid losing large integers and update doc strings explaining inner behavior * fix: add checks with tests to avoid processing values when store or key is empty string * fix: remove spaces around em-dashes and add missing tests for missing stores and keys * chore: remove redundant comments * fix: address sonarqube comment with avoiding duplication * fix: add json validation on document even if it doesn't contain kv refs * refactor: split resolver for public and private parts to hide inner logic with lenient mode in future * chore: replace background context with test one * feat: add cache bypass context logic to skip serving the value from cache when its desired * feat: add lenient mode to the resolver * feat: add base implementation of new from config * refactor: update implementation with clear func separation and code simplification; add docs * fix: lint errors * chore: remove redundant comments * feat: add file provider as a type with registry processing it as a local type provider * refactor: add more comments and explanation about phase1 and phase2 and why we need them to increase readability * refactor: remove isLocalType func and attach the logic to provider type to avoid OCP and increase discoverability * fix: missing pieces from last commit * docs: update docstring and comment explaining better why process should resolved value for non-local stores only * feat: add file provider with tests * feat: add sentinel errors and rework current errors * feat: update returning error when file is not exist on the provided key * feat: adapt the KeyNotFoundError to the standalone providers * refactor: put the provider_test to kv_test to test public methods and interfaces * feat: add ability to override default factories when WithFactories opt is used * feat: add file provider registration at the default registry * test: add tests covering logic with factories overriding * fix: update the logic with rejecting retrieving when basePath is not provided * fix: add case to cover empty keys * fix: add guard against non-abs for base_path * feat: add base implementation for env provider * feat: force mandatory prefix to prevent accessing undesired env variables * chore: remove comment * feat: add inline provider * test: add integration tests to prove that NewFromConfig is working with local providers like gateway expects it * docs: add doc comment explaining when provider factories MUST return an error to let other devs learn the principle * fix: address sonarqube issues --------- Co-authored-by: Vlad Zabolotnyi <vlad.z@tyk.io>
* feat: add implementation to Resolve func * feat: add resolveAll implementation * test: add test cases for json pointer extraction * refactor: update error messages and make error handlin more consistent * refactor: update resolve tests * refactor: update resolveAll tests with grouping error cases * fix: added malformed err with tests, added docs string * test: add test suite with path routing * fix: remove redundant assertions and update comment * test: add test case that resolve all resolved mixed values * fix: use decoding with numbers to avoid losing large integers and update doc strings explaining inner behavior * fix: add checks with tests to avoid processing values when store or key is empty string * fix: remove spaces around em-dashes and add missing tests for missing stores and keys * chore: remove redundant comments * fix: address sonarqube comment with avoiding duplication * fix: add json validation on document even if it doesn't contain kv refs * refactor: split resolver for public and private parts to hide inner logic with lenient mode in future * chore: replace background context with test one * feat: add cache bypass context logic to skip serving the value from cache when its desired * feat: add lenient mode to the resolver * feat: add base implementation of new from config * refactor: update implementation with clear func separation and code simplification; add docs * fix: lint errors * chore: remove redundant comments * feat: add file provider as a type with registry processing it as a local type provider * refactor: add more comments and explanation about phase1 and phase2 and why we need them to increase readability * refactor: remove isLocalType func and attach the logic to provider type to avoid OCP and increase discoverability * fix: missing pieces from last commit * docs: update docstring and comment explaining better why process should resolved value for non-local stores only * feat: add file provider with tests * feat: add sentinel errors and rework current errors * feat: update returning error when file is not exist on the provided key * feat: adapt the KeyNotFoundError to the standalone providers * refactor: put the provider_test to kv_test to test public methods and interfaces * feat: add ability to override default factories when WithFactories opt is used * feat: add file provider registration at the default registry * test: add tests covering logic with factories overriding * fix: update the logic with rejecting retrieving when basePath is not provided * fix: add case to cover empty keys * fix: add guard against non-abs for base_path * feat: add base implementation for env provider * feat: force mandatory prefix to prevent accessing undesired env variables * chore: remove comment * feat: add inline provider * test: add integration tests to prove that NewFromConfig is working with local providers like gateway expects it * docs: add doc comment explaining when provider factories MUST return an error to let other devs learn the principle * fix: address sonarqube issues * feat: add init implementaiton of vault provider * docs: update docs for the NewFactory * fix: json.Encoder is adding a new line symbol in the end of the encoded value, reworked with test * fix: add comments explaining why some decisions are made * docs: add more comments * fix: address linter comment with huge param and passing config as pointer instead * chore: add nolint:errcheck to silence an error * refactor: fold tests to table tests * feat: update adding vault to default registry and add integration test * fix: remove structviewer as it doesn't used on the lib * fix: tidy deps * feat: add mount_path config to adapt provider to not hardcoded mount pathes * fix: add path.Clean() to reject traversal paths --------- Co-authored-by: Vlad Zabolotnyi <vlad.z@tyk.io>
* feat: add implementation to Resolve func * feat: add resolveAll implementation * test: add test cases for json pointer extraction * refactor: update error messages and make error handlin more consistent * refactor: update resolve tests * refactor: update resolveAll tests with grouping error cases * fix: added malformed err with tests, added docs string * test: add test suite with path routing * fix: remove redundant assertions and update comment * test: add test case that resolve all resolved mixed values * fix: use decoding with numbers to avoid losing large integers and update doc strings explaining inner behavior * fix: add checks with tests to avoid processing values when store or key is empty string * fix: remove spaces around em-dashes and add missing tests for missing stores and keys * chore: remove redundant comments * fix: address sonarqube comment with avoiding duplication * fix: add json validation on document even if it doesn't contain kv refs * refactor: split resolver for public and private parts to hide inner logic with lenient mode in future * chore: replace background context with test one * feat: add cache bypass context logic to skip serving the value from cache when its desired * feat: add lenient mode to the resolver * feat: add base implementation of new from config * refactor: update implementation with clear func separation and code simplification; add docs * fix: lint errors * chore: remove redundant comments * feat: add file provider as a type with registry processing it as a local type provider * refactor: add more comments and explanation about phase1 and phase2 and why we need them to increase readability * refactor: remove isLocalType func and attach the logic to provider type to avoid OCP and increase discoverability * fix: missing pieces from last commit * docs: update docstring and comment explaining better why process should resolved value for non-local stores only * feat: add file provider with tests * feat: add sentinel errors and rework current errors * feat: update returning error when file is not exist on the provided key * feat: adapt the KeyNotFoundError to the standalone providers * refactor: put the provider_test to kv_test to test public methods and interfaces * feat: add ability to override default factories when WithFactories opt is used * feat: add file provider registration at the default registry * test: add tests covering logic with factories overriding * fix: update the logic with rejecting retrieving when basePath is not provided * fix: add case to cover empty keys * fix: add guard against non-abs for base_path * feat: add base implementation for env provider * feat: force mandatory prefix to prevent accessing undesired env variables * chore: remove comment * feat: add inline provider * test: add integration tests to prove that NewFromConfig is working with local providers like gateway expects it * docs: add doc comment explaining when provider factories MUST return an error to let other devs learn the principle * fix: address sonarqube issues * feat: add init implementaiton of vault provider * docs: update docs for the NewFactory * fix: json.Encoder is adding a new line symbol in the end of the encoded value, reworked with test * fix: add comments explaining why some decisions are made * docs: add more comments * fix: address linter comment with huge param and passing config as pointer instead * chore: add nolint:errcheck to silence an error * refactor: fold tests to table tests * feat: update adding vault to default registry and add integration test * fix: remove structviewer as it doesn't used on the lib * fix: tidy deps * feat: add mount_path config to adapt provider to not hardcoded mount pathes * fix: add path.Clean() to reject traversal paths * deps: add consul library * feat: add NewFactory with tests * feat: add implementation with tests for the Get method * feat: add registration of consul default factory on registry * test: add consul integration test on the registry side * refactor: add docs comments and isolate the processing of TLS config * chore: remove redundant comments --------- Co-authored-by: Vlad Zabolotnyi <vlad.z@tyk.io>
…ut misleading message
…we have two similar funcs on the same package
…t 'failed' annotation
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |
|



Description
Next tickets were reviewed, approved and merged to this branch:
TT-17242
TT-17487
TT-17244
TT-17243
TT-17245
TT-17246
Performance
This PR adds benchmarks covering the epic's performance acceptance criteria.
Run on Apple M4 Pro (darwin/arm64), Go benchmarks with in-process backends
(mocks /
httptest), so the numbers isolate library overhead — real networklatency comes on top and is deployment-specific. Reproduce with:
go test -bench=. -run=XXX ./kv/internal/resolve ./kv/internal/store ./kv/registry
1. Whole-document resolution (
ResolveAll— the startup path)Scaling is linear at ~1.1 µs per reference (parse + walk + substitute +
re-serialize, zero-latency providers). Resolution cost is dominated by the
per-document JSON round trip, not by reference count.
2. Per-request
Getthrough theSecretStorewrapperA cache-resident lookup costs ~36 ns.
3. Full production stack against a co-located Vault (KVv2 over
httptest)NewFromConfigregistry →SecretStore→ real Vault API client → HTTP:One co-located Vault round trip through the entire stack costs ~44 µs;
the cache collapses that to nanoseconds.
Related Issue
Motivation and Context
Test Coverage For This Change
Screenshots (if appropriate)
Types of changes
Checklist
master!masterbranch (left side). Also, it would be best if you started your change off our latestmaster.go mod tidy && go mod vendorgofmt -s -w .go vet ./...