Registry / auth-security / svn-simple-auth-provider

svn-simple-auth-provider

JSON →
library1.3.5jsnpmunverified

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.

npm install svn-simple-auth-provider
INSTALL
IMPORT
SIG · SVN-SIMPLE-AUTH-PR
S
svn-simple-auth-provider
auth-securityjavascriptv1.3.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SvnSimpleAuthProvider
import { SvnSimpleAuthProvider } from 'svn-simple-auth-provider';
const SvnSimpleAuthProvider = require('svn-simple-auth-provider').SvnSimpleAuthProvider;
The package is primarily designed for ESM consumption, though CJS import is possible by accessing the named export.
Credential
import type { Credential } from 'svn-simple-auth-provider';
Import the `Credential` type for type-safe handling of the resolved credentials object.

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.

import { SvnSimpleAuthProvider } from 'svn-simple-auth-provider'; import path from 'path'; import os from 'os'; async function getSvnCredentials() { // Define a dummy realm directory for demonstration. In a real scenario, // this would be the actual SVN auth directory, e.g., ~/.subversion/auth/simple. // For a quick test, you might point it to a directory with a dummy auth file. const realmDirectory = path.join(os.homedir(), '.subversion', 'auth', 'simple'); const provider = new SvnSimpleAuthProvider({ realmDirectory: realmDirectory }); // Example: Attempt to retrieve credentials for a specific realm and URL. // Replace with actual realm and URL from your SVN configuration. const exampleRealm = 'svn.example.com:443'; // The realm as it appears in the auth file const exampleUrl = 'https://svn.example.com/repo/trunk'; // The URL used to identify the realm try { console.log(`Attempting to retrieve credentials for realm '${exampleRealm}' from ${realmDirectory}...`); const credentials = await provider.getCredentials(exampleRealm, exampleUrl); if (credentials) { console.log('Credentials found:'); console.log(` Username: ${credentials.username}`); console.log(` Password: ${credentials.password ? '[HIDDEN]' : 'N/A'}`); // Note: passwords are typically stored in plain text in simple auth files. } else { console.log(`No credentials found for realm '${exampleRealm}'.`); } } catch (error) { console.error('Failed to retrieve SVN credentials:', error); if (error instanceof Error && error.message.includes('ENOENT')) { console.error('Make sure the realmDirectory path is correct and the auth files exist.'); } } } getSvnCredentials();
Debug
Known issues
gotchaSubversion '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.
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.
affects: >=1.0.0
breakingThe 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.
fix
Upgrade your Node.js environment to version 16.20.2 or newer to ensure compatibility and stability.
affects: <16.20.2
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, scandir 'path/to/nonexistent/directory'
The `realmDirectory` provided to `SvnSimpleAuthProvider` constructor does not exist or the application lacks read permissions to it.
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.
No credentials found for realm 'your.example.com:443'
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.
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.
Upgrade
Version history
1.3.5latest on npm
Audit
Dependencies
kv-readerrequiredCore dependency for parsing key-value pair configuration files, which SVN simple auth files are structured as.
Agent activity
14 hits · last 30 days
node
10
OpenAI (training)
2
Resources
svn-simple-auth-provider — npm install svn-simple-auth-provider · libregistry