You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A malformed --profile name silently corrupts ~/.testsprite/credentials (key not persisted) #20
The profile name (--profile / TESTSPRITE_PROFILE) is written verbatim as an INI section header ([name]) in ~/.testsprite/credentials, but is never validated. A name containing characters that break the INI grammar corrupts the file or silently fails to persist the credential.
Reproduction (round-trip of the pure serialize/parse helpers)
import{serializeCredentials,parseCredentials}from'@testsprite/testsprite-cli/dist/lib/credentials.js';constfile={'prod]': {apiKey: 'sk-123',apiUrl: 'https://api.testsprite.com'}};console.log(serializeCredentials(file));// [prod]]// api_key = sk-123// api_url = https://api.testsprite.comconsole.log(Object.keys(parseCredentials(serializeCredentials(file))));// [] <-- the section AND its api_key/api_url lines are silently dropped
So testsprite setup --profile "prod]" would report success while the key never persists (the next command can't read it back). Other corrupting inputs:
a newline in the name splits the header across two lines;
leading/trailing whitespace doesn't round-trip (the parser trims section names, so [ prod ] reads back as prod).
Suggested fix
Validate the profile name against a conservative allowlist (letters, digits, dot, underscore, hyphen — covering default, prod, ci-staging, team.qa) at the profile-keyed credential entry points (readProfile / writeProfile / deleteProfile), throwing a typed VALIDATION_ERROR (exit 5) before any file write.
Activity