-
Notifications
You must be signed in to change notification settings - Fork 0
[wms-88o] Credential store path remains stable across plugin updates #24
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
base: main
Are you sure you want to change the base?
Conversation
Updated GitHub issue with Discovery Tree analysis. Status: 0/3 outcomes complete, analysis phase complete. External URL: #3 (comment)
- Add validateCredentialPath() to reject plugin/temp directory paths - Create CREDENTIAL_STORAGE.md documenting credential persistence - Ensure CREDENTIAL_STORE_PATH is never set during installation - Validate paths on CredentialStore construction
- Test rejection of plugin directory paths (.claude/skills, node_modules) - Test rejection of temporary directory paths (/tmp, Windows temp) - Test acceptance of persistent user paths (.config, home, AppData/Roaming) - Test default path when no override provided - Add skipValidation option for test fixtures using /tmp
Code Review - PR #24: Credential Store Path StabilityThank you for this well-documented PR! This is a solid implementation that addresses credential persistence across plugin updates. Here's my review: ✅ Strengths1. Excellent Documentation
2. Robust Path Validation
3. Comprehensive Test Coverage
4. Security-First Design
🔍 Issues & Suggestions1. Path Validation Could Be More Robust (Minor) The current validation uses simple string matching which has some edge cases: // credential-store.ts:50-52
private validateCredentialPath(path: string): void {
const normalizedPath = path.toLowerCase();
// ...
}Issues:
Suggestion: import { resolve } from 'path';
private validateCredentialPath(path: string): void {
// Resolve to absolute path to handle relative paths and symlinks
const normalizedPath = resolve(path).toLowerCase();
const dangerousPatterns = [
'.claude/skills',
'node_modules',
'/tmp/',
'/temp/',
'appdata/local/temp',
'appdata\\local\\temp',
];
for (const pattern of dangerousPatterns) {
if (normalizedPath.includes(pattern.toLowerCase())) {
throw new Error(
`Invalid credential path: "${path}" appears to be in a plugin or temporary directory. ` +
`Credentials must be stored in a persistent location like ~/.config/beads-bridge/credentials.json`
);
}
}
}2. Test Coverage Gap (Minor) The tests don't verify that relative paths are handled correctly: // Add to credential-store.test.ts
it('should reject relative paths that resolve to dangerous directories', () => {
// Assuming we're in a project with node_modules
expect(() => {
new CredentialStore('./node_modules/credentials.json');
}).toThrow(/Invalid credential path.*plugin or temporary directory/);
});3. Documentation Accuracy (Very Minor) In # ❌ BAD - affects process environment, harder to isolate in parallel tests
export CREDENTIAL_STORE_PATH=/tmp/test-creds.json
beads-bridge auth github
# ✅ GOOD - use constructor injection for test isolation
const store = new CredentialStore('/tmp/test-creds.json', { skipValidation: true });4. Type Safety Opportunity (Nice-to-have) The export interface CredentialStoreOptions {
skipValidation?: boolean;
}
constructor(filePath?: string, options?: CredentialStoreOptions) {
// ...
}🎯 Security ConsiderationsNo security concerns identified. The implementation:
🧪 Testing NotesPer the PR description, all tests pass:
Recommendation: Consider adding integration tests that verify credentials actually persist across a simulated plugin update scenario. 📋 Best Practices AssessmentCode Quality: ✅ Excellent
Documentation: ✅ Excellent
Testing: ✅ Good (with minor suggestions above)
✅ Approval RecommendationAPPROVED with minor suggestions for improvement. This PR successfully addresses the credential persistence issue. The implementation is solid, well-tested, and thoroughly documented. The minor suggestions above are optional enhancements that could be addressed in a follow-up PR if desired. Suggested merge approach:
Great work on the comprehensive documentation and test coverage! 🎉 Review conducted using project guidelines from CLAUDE.md
|
Outcome
Credential store path remains stable across plugin updates
Approach
This implementation ensures credentials persist across plugin updates by:
install-beads-bridge.shnorbuild.tssetCREDENTIAL_STORE_PATHAcceptance Criteria
Changes
New Files
src/beads-bridge/docs/CREDENTIAL_STORAGE.md- Comprehensive documentation of credential storage design and policiesModified Files
src/beads-bridge/src/auth/credential-store.ts- AddedvalidateCredentialPath()method to reject dangerous pathssrc/beads-bridge/tests/auth/credential-store.test.ts- Added 8 new path validation testsTesting
All auth and backend tests pass (16/16):
New path validation tests verify:
.claude/skillspathsnode_modulespaths/tmpand temp directory paths.configdirectory pathsBead
Implements: wms-88o
View bead:
bd show wms-88o🤖 Generated with Claude Code