{"id":16915,"library":"svn-simple-auth-provider","title":"Subversion Simple Auth Provider","description":"The `svn-simple-auth-provider` package offers a Node.js-based solution for programmatically accessing credentials stored in Subversion's 'simple' authentication files. These files, typically located in `~/.subversion/auth/simple`, contain plaintext username and password pairs for various SVN realms. The library, currently at version 1.3.5, provides a `SvnSimpleAuthProvider` class to read and retrieve these stored credentials. Its release cadence is irregular, primarily focusing on dependency updates and minor bug fixes. A key differentiator is its direct parsing of the SVN simple auth file format, allowing integration into applications that need to interact with SVN repositories using stored credentials without invoking external SVN client commands. It requires Node.js version 16.20.2 or higher.","status":"active","version":"1.3.5","language":"javascript","source_language":"en","source_url":"https://github.com/arlac77/svn-simple-auth-provider","tags":["javascript","auth-provider"],"install":[{"cmd":"npm install svn-simple-auth-provider","lang":"bash","label":"npm"},{"cmd":"yarn add svn-simple-auth-provider","lang":"bash","label":"yarn"},{"cmd":"pnpm add svn-simple-auth-provider","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for parsing key-value pair configuration files, which SVN simple auth files are structured as.","package":"kv-reader","optional":false}],"imports":[{"note":"The package is primarily designed for ESM consumption, though CJS import is possible by accessing the named export.","wrong":"const SvnSimpleAuthProvider = require('svn-simple-auth-provider').SvnSimpleAuthProvider;","symbol":"SvnSimpleAuthProvider","correct":"import { SvnSimpleAuthProvider } from 'svn-simple-auth-provider';"},{"note":"Import the `Credential` type for type-safe handling of the resolved credentials object.","symbol":"Credential","correct":"import type { Credential } from 'svn-simple-auth-provider';"}],"quickstart":{"code":"import { SvnSimpleAuthProvider } from 'svn-simple-auth-provider';\nimport path from 'path';\nimport os from 'os';\n\nasync function getSvnCredentials() {\n  // Define a dummy realm directory for demonstration. In a real scenario,\n  // this would be the actual SVN auth directory, e.g., ~/.subversion/auth/simple.\n  // For a quick test, you might point it to a directory with a dummy auth file.\n  const realmDirectory = path.join(os.homedir(), '.subversion', 'auth', 'simple');\n\n  const provider = new SvnSimpleAuthProvider({\n    realmDirectory: realmDirectory\n  });\n\n  // Example: Attempt to retrieve credentials for a specific realm and URL.\n  // Replace with actual realm and URL from your SVN configuration.\n  const exampleRealm = 'svn.example.com:443'; // The realm as it appears in the auth file\n  const exampleUrl = 'https://svn.example.com/repo/trunk'; // The URL used to identify the realm\n\n  try {\n    console.log(`Attempting to retrieve credentials for realm '${exampleRealm}' from ${realmDirectory}...`);\n    const credentials = await provider.getCredentials(exampleRealm, exampleUrl);\n\n    if (credentials) {\n      console.log('Credentials found:');\n      console.log(`  Username: ${credentials.username}`);\n      console.log(`  Password: ${credentials.password ? '[HIDDEN]' : 'N/A'}`);\n      // Note: passwords are typically stored in plain text in simple auth files.\n    } else {\n      console.log(`No credentials found for realm '${exampleRealm}'.`);\n    }\n  } catch (error) {\n    console.error('Failed to retrieve SVN credentials:', error);\n    if (error instanceof Error && error.message.includes('ENOENT')) {\n        console.error('Make sure the realmDirectory path is correct and the auth files exist.');\n    }\n  }\n}\n\ngetSvnCredentials();","lang":"typescript","description":"Demonstrates how to instantiate `SvnSimpleAuthProvider` and retrieve credentials for a specific SVN realm and URL. It highlights configuring the `realmDirectory` and handling potential missing credentials."},"warnings":[{"fix":"Implement robust security practices around the SVN authentication files and the application using this provider. Consider alternatives like SVN's 'gnome-keyring' or 'keychain' credential storage for better security if available in your environment.","message":"Subversion 'simple' authentication files store passwords in plaintext. Using this provider exposes these credentials in memory, and the files themselves are vulnerable if the system is compromised. Ensure appropriate file system permissions and secure handling of credentials.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade your Node.js environment to version 16.20.2 or newer to ensure compatibility and stability.","message":"The package requires Node.js version 16.20.2 or higher. Older Node.js versions are not supported and may lead to runtime errors or unexpected behavior.","severity":"breaking","affected_versions":"<16.20.2"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Verify that the `realmDirectory` path is correct and points to a valid directory (e.g., `~/.subversion/auth/simple`). Ensure the Node.js process has sufficient read permissions for this directory and its contents.","cause":"The `realmDirectory` provided to `SvnSimpleAuthProvider` constructor does not exist or the application lacks read permissions to it.","error":"Error: ENOENT: no such file or directory, scandir 'path/to/nonexistent/directory'"},{"fix":"Double-check the `realm` and `url` parameters against your actual SVN client configuration and the contents of the simple auth files. The `realm` string in the code must exactly match the realm identifier within the SVN auth file (e.g., `<svn.example.com:443> Subversion Repository`). Ensure the auth files are correctly formatted by SVN itself.","cause":"The `getCredentials` method could not find a matching entry in the SVN simple auth files for the specified `realm` and `url`, or the format of the auth files is unexpected.","error":"No credentials found for realm 'your.example.com:443'"}],"ecosystem":"npm","meta_description":null}