-
Notifications
You must be signed in to change notification settings - Fork 2
feat: make populate_dotenv_missing_secrets_stubs require absolute paths and non-destructive #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make populate_dotenv_missing_secrets_stubs require absolute paths and non-destructive #30
Conversation
…hs and non-destructive - Add absolute path validation using Path.is_absolute() - Add collision detection to prevent overwriting existing secrets - Return error with existing secrets list when collisions occur - Update all tests to use absolute paths - Add new tests for absolute path validation and collision detection Fixes issue where function could overwrite existing secrets and accepted relative paths without knowing caller's working directory context. Co-Authored-By: AJ Steers <[email protected]>
Original prompt from AJ Steers
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. Testing This Branch via MCPTo test the changes in this specific branch with an MCP client like Claude Desktop, use the following configuration: {
"mcpServers": {
"connector-builder-mcp-dev": {
"command": "uvx",
"args": ["--from", "git+https://github.com/airbytehq/connector-builder-mcp.git@devin/1754931923-fix-populate-dotenv-absolute-paths-non-destructive", "connector-builder-mcp"]
}
}
} Testing This Branch via CLIYou can test this version of the MCP Server using the following CLI snippet: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/connector-builder-mcp.git@devin/1754931923-fix-populate-dotenv-absolute-paths-non-destructive#egg=airbyte-connector-builder-mcp' --help PR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the populate_dotenv_missing_secrets_stubs
function with two critical security and reliability improvements: requiring absolute paths to eliminate working directory ambiguity, and implementing non-destructive behavior to prevent accidental overwriting of existing secrets.
- Added absolute path validation using
Path.is_absolute()
with clear error messages for relative paths - Implemented collision detection that checks for existing secrets and provides detailed error information when conflicts are found
- Enhanced error responses to include comprehensive existing secrets status using the
SecretInfo
model pattern
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
connector_builder_mcp/_secrets.py | Added absolute path validation and collision detection logic to prevent destructive operations |
tests/test_secrets.py | Updated all test cases to use absolute paths and added comprehensive test coverage for new validation features |
Co-Authored-By: AJ Steers <[email protected]>
Co-authored-by: Copilot <[email protected]>
feat: make populate_dotenv_missing_secrets_stubs require absolute paths and non-destructive
Summary
This PR updates the
populate_dotenv_missing_secrets_stubs
function to address two critical issues:Absolute path requirement: The function now validates that the provided
dotenv_path
is absolute usingPath.is_absolute()
and rejects relative paths with a clear error message. This prevents ambiguity about the caller's working directory context.Non-destructive behavior: The function now checks for existing secrets before writing and throws an error if any collisions are detected, rather than silently overwriting existing values. When collisions occur, it returns a detailed error message listing all existing secrets and their set/unset status.
Key Changes
dotenv_values()
to read existing secretsSecretInfo
model patternReview & Testing Checklist for Human
Recommended test plan: Create a test dotenv file with mixed content (real secrets, empty values, comment stubs) and verify the function correctly identifies collisions and preserves existing content.
Diagram
Notes
dotenv_values()
pattern fromlist_dotenv_secrets()
for consistencyLink to Devin run: https://app.devin.ai/sessions/a1ddcae2e2cc41dd9da9121d4b034e32
Requested by: @aaronsteers
Important
Auto-merge enabled.
This PR is set to merge automatically when all requirements are met.