Skip to content

Commit 046f7d2

Browse files
MihirR-BSclaude
andcommitted
LTS-5452: address review on the credentials step
Hidden prompt for the access key so it stays out of bash/zsh and PSReadLine history (CodeRabbit); note the variables last for the current session and how to spot an unset one; per-repo fixes from the code review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent b928677 commit 046f7d2

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,29 @@ This repo contains samples for running [WebdriverIO](https://webdriver.io/) test
88
* Clone the repo `git clone https://github.com/browserstack/browserstack-webdriverio-load-testing-sample.git`.
99
* Set your credentials as environment variables, as described in [Set your credentials](#set-your-credentials).
1010
* Run `npm i` to install the dependencies.
11-
* Open the browserstack-load.yaml file and update it with the relevant load test configurations.
11+
* Open `browserstack-load.yml` and update it with the relevant load test configurations. Leave `userName` and `accessKey` as they are.
1212

1313
## Set your credentials
1414

1515
The BrowserStack CLI reads your credentials from environment variables. Copy your username and access key from [Account Settings](https://www.browserstack.com/accounts/settings) and export them in the shell you run the test from:
1616

1717
```sh
18-
# macOS / Linux
18+
# macOS / Linux (bash or zsh)
1919
export BROWSERSTACK_USERNAME="<your-username>"
20-
export BROWSERSTACK_ACCESS_KEY="<your-access-key>"
20+
# Type the key at the prompt: it is not echoed, and it stays out of your shell history
21+
printf 'BrowserStack access key: '; read -rs BROWSERSTACK_ACCESS_KEY; echo
22+
export BROWSERSTACK_ACCESS_KEY
2123
```
2224

2325
```powershell
2426
# Windows (PowerShell)
2527
$env:BROWSERSTACK_USERNAME = "<your-username>"
26-
$env:BROWSERSTACK_ACCESS_KEY = "<your-access-key>"
28+
# Type the key at the prompt: it is not echoed, and it stays out of your PowerShell history
29+
$env:BROWSERSTACK_ACCESS_KEY = [System.Net.NetworkCredential]::new('', (Read-Host -AsSecureString 'BrowserStack access key')).Password
2730
```
2831

32+
These variables last only for the current terminal session. If the CLI reports an authentication error, check that both are set in the terminal you run it from.
33+
2934
**Never commit your credentials.** Leave the `userName` and `accessKey` placeholders in `browserstack-load.yml` as they are (the environment variables override them), and keep your access key out of every file you push. If a key is ever exposed, regenerate it from Account Settings.
3035

3136
## Running your tests

0 commit comments

Comments
 (0)