[DEV-140033] retreive secrets based on dotenv files with sm:// paths#53
Merged
tonitienda-rovtech merged 15 commits intomasterfrom Mar 5, 2026
Merged
[DEV-140033] retreive secrets based on dotenv files with sm:// paths#53tonitienda-rovtech merged 15 commits intomasterfrom
tonitienda-rovtech merged 15 commits intomasterfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for
.envfile sources with automatic AWS Secrets Manager resolution. Users can now reference secrets directly in env files usingsm://paths, and snagsby will automatically fetch and inject the secret values.What Changed
New Feature: EnvFileResolver
EnvFileResolverto supportfile://scheme sources.envfile format (KEY=value pairs)sm://from AWS Secrets Manager#) and inline commentsUsage Example
Code Quality Improvements (from PR review)
Following TDD methodology, added tests first to demonstrate issues, then fixed the code:
1. Empty Key Validation
=valuewere silently skipped without errorpkg/resolvers/envfile.go:47-492. Duplicate Key Detection with Normalization
foo-barandFOO_BARweren't caught as duplicates, causing silent overwritespkg/resolvers/envfile.go:54-833. Secret Key Deduplication
sm://path caused redundant API callspkg/resolvers/envfile.go:117-1204. Relative File Path Support
file://./pre-cache.envwere incorrectly parsed.,.., simple filenames)pkg/resolvers/envfile.go:27-385. Test Coverage
expectedSecretsRequestedto verify secret resolution behaviorfile://scheme test toTestResolveSourceTesting
All changes follow TDD - tests written first to fail, then code fixed:
Files Changed
pkg/resolvers/envfile.go- New resolver implementationpkg/resolvers/envfile_test.go- Comprehensive test coveragepkg/resolvers/resolvers.go- Added file scheme routingpkg/resolvers/resolvers_test.go- Added file scheme testpkg/connectors/secretsmanager.go- Exposed GetSecrets methodpkg/connectors/testing/mocks.go- Added mock connector for testingRelated
Closes DEV-140033