Skip to content

Commit 2853db5

Browse files
committed
docs: condense README by removing redundant command subsections
1 parent 49991fd commit 2853db5

File tree

1 file changed

+37
-245
lines changed

1 file changed

+37
-245
lines changed

README.md

Lines changed: 37 additions & 245 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,8 @@ A CLI tool for elevating cloud permissions (Azure, AWS) via CyberArk Secure Clou
88

99
`grant` enables terminal-based cloud permission elevation (Azure, AWS) through CyberArk SCA. It wraps the `idsec-sdk-golang` SDK for authentication and builds a custom SCA Access API client for JIT role elevation.
1010

11-
**Key Features:**
12-
- Multi-CSP support (Azure, AWS) with concurrent eligibility queries
13-
- Interactive permission elevation with fuzzy search
14-
- Direct elevation with target and role flags
15-
- AWS credential export via `grant env` for shell integration
16-
- Favorites management for frequently used roles
17-
- Entra ID group membership elevation via `grant --group` or `grant --groups`
18-
- Session revocation via `grant revoke`
19-
- Session status monitoring
20-
- Eligible target discovery via `grant list`
21-
- Local eligibility cache with configurable TTL
22-
- Machine-readable JSON output (`--output json`)
23-
- TTY detection with fail-fast for non-interactive environments
24-
- Secure token storage in system keyring
11+
- **Azure:** SCA creates a JIT RBAC role assignment — your existing `az` CLI session picks up the elevated permissions automatically.
12+
- **AWS:** SCA returns temporary credentials. Use `grant env` to export them: `eval $(grant env --provider aws)`
2513

2614
## Usage
2715

@@ -52,7 +40,6 @@ grant --group "Cloud Admins"
5240
# List eligible targets (no elevation)
5341
grant list
5442
grant list --provider azure
55-
grant list --groups
5643
grant list --output json
5744

5845
# Check active sessions
@@ -62,36 +49,30 @@ grant status
6249
grant revoke # interactive multi-select
6350
grant revoke <session-id> # direct by ID
6451
grant revoke --all # revoke all
65-
grant revoke --all --provider azure # revoke all for a specific provider
6652
```
6753

54+
![grant env demo](demo/demo-env-status.gif)
55+
6856
## Installation
6957

7058
### Binary Releases (Recommended)
7159

7260
Download pre-built binaries from the [Releases](https://github.com/aaearon/grant-cli/releases) page.
7361

74-
**macOS / Linux:**
7562
```bash
63+
# macOS / Linux (adjust OS and ARCH as needed)
7664
VERSION=$(gh release view --repo aaearon/grant-cli --json tagName -q '.tagName' | tr -d v)
77-
# macOS Intel: OS=darwin ARCH=amd64
78-
# macOS Apple Silicon: OS=darwin ARCH=arm64
79-
# Linux x86_64: OS=linux ARCH=amd64
80-
# Linux ARM64: OS=linux ARCH=arm64
81-
OS=linux ARCH=amd64
65+
OS=linux ARCH=amd64 # darwin/amd64, darwin/arm64, linux/amd64, linux/arm64
8266
curl -LO "https://github.com/aaearon/grant-cli/releases/download/v${VERSION}/grant-cli_${VERSION}_${OS}_${ARCH}.tar.gz"
8367
tar xzf "grant-cli_${VERSION}_${OS}_${ARCH}.tar.gz"
8468
sudo mv grant /usr/local/bin/
85-
```
8669

87-
**Windows:**
88-
Download the appropriate `grant-cli_<version>_windows_<arch>.zip` from [releases](https://github.com/aaearon/grant-cli/releases) and extract to a directory in your PATH.
89-
90-
**Updating:**
91-
```bash
70+
# Self-update
9271
grant update
9372
```
9473

74+
**Windows:** Download `grant-cli_<version>_windows_<arch>.zip` from [releases](https://github.com/aaearon/grant-cli/releases) and extract to a directory in your PATH.
75+
9576
### Go Install
9677

9778
```bash
@@ -108,160 +89,36 @@ make build
10889

10990
## Commands
11091

111-
Running `grant` with no subcommand elevates cloud permissions (the core behavior). Subcommands are listed below.
92+
Running `grant` with no subcommand elevates cloud permissions (the core behavior).
11293

11394
| Command | Description |
11495
|---------|-------------|
115-
| `configure` | Configure or reconfigure Identity URL and username (optional — `login` auto-configures on first run) |
116-
| `env` | Perform elevation and output AWS credential export statements (for `eval $(grant env)`) |
117-
| `list` | List eligible cloud targets and Entra ID groups without triggering elevation |
118-
| `login` | Authenticate to CyberArk Identity (auto-configures on first run, MFA handled interactively) |
96+
| `grant` | Elevate cloud permissions (interactive, direct with `--target`/`--role`, or `--favorite`) |
97+
| `configure` | Configure Identity URL and username (optional — `login` auto-configures) |
98+
| `env` | Elevate and output AWS credential export statements for `eval $(grant env)` |
99+
| `list` | List eligible targets and groups without elevation (`--provider`, `--groups`, `--output json`) |
100+
| `login` | Authenticate to CyberArk Identity (MFA handled interactively) |
119101
| `logout` | Clear cached tokens from keyring |
120-
| `status` | Show authentication state and active SCA sessions |
121-
| `favorites` | Manage saved role favorites (add/list/remove) |
122-
| `revoke` | Revoke active elevation sessions (interactive, by ID, or `--all`) |
102+
| `status` | Show auth state and active sessions |
103+
| `favorites` | Manage saved role favorites (`add`/`list`/`remove`) |
104+
| `revoke` | Revoke sessions (interactive, by ID, or `--all`) |
123105
| `update` | Self-update to the latest release from GitHub |
124106
| `version` | Print version information |
125107

126-
### Global Flags
127-
128-
- `--verbose, -v` — Enable verbose output, including request/response details and timing
129-
- `--output, -o` — Output format: `text` (default) or `json` for machine-readable output
130-
131-
### configure
132-
133-
Reconfigure your CyberArk tenant connection (Identity URL and username). Optional — `grant login` auto-configures on first run.
134-
135-
```bash
136-
grant configure
137-
```
138-
139-
### env
140-
141-
Perform elevation and output AWS credential export statements for shell evaluation.
142-
143-
![grant env demo](demo/demo-env-status.gif)
144-
145-
```bash
146-
eval $(grant env --provider aws)
147-
eval $(grant env --provider aws --target "MyAccount" --role "AdminAccess")
148-
eval $(grant env --favorite my-aws-admin)
149-
```
150-
151-
This command:
152-
- Performs the full elevation flow (interactive, direct, or favorite mode)
153-
- Outputs only shell `export` statements (no human-readable messages)
154-
- Designed for AWS elevations — returns an error for Azure (which doesn't return credentials)
155-
156-
Supports the same flags as the root command: `--provider`, `--target`, `--role`, `--favorite`, `--refresh`.
157-
158-
### list
159-
160-
List eligible cloud targets and Entra ID groups without triggering elevation. Useful for discovering what you can elevate to, and for programmatic consumption via JSON output.
161-
162-
```bash
163-
grant list # all targets and groups
164-
grant list --provider azure # cloud targets for a specific provider
165-
grant list --groups # Entra ID groups only
166-
grant list --output json # machine-readable JSON
167-
grant list --refresh # bypass eligibility cache
168-
```
169-
170-
**Flags:**
171-
- `--provider, -p` — Filter by cloud provider: `azure`, `aws`
172-
- `--groups` — Show only Entra ID groups (mutually exclusive with `--provider`)
173-
- `--refresh` — Bypass eligibility cache and fetch fresh data
174-
175-
### login
176-
177-
Authenticate to CyberArk Identity with MFA.
178-
179-
```bash
180-
grant login
181-
```
182-
183-
On first run, prompts for Identity URL and username (auto-configures). Authenticates with password and MFA (method selected interactively), then stores tokens in the system keyring. Tokens are automatically refreshed during operations.
184-
185-
### logout
186-
187-
Clear all cached tokens from the system keyring.
188-
189-
```bash
190-
grant logout
191-
```
192-
193-
This removes stored authentication tokens but preserves your configuration files.
194-
195-
### Default Behavior (Elevate)
196-
197-
Running `grant` with no subcommand requests JIT (just-in-time) permission elevation for cloud resources. Supports interactive, direct (`--target`/`--role`), and favorite (`--favorite`) modes as shown in the [Usage](#usage) section.
198-
199-
**Flags:**
200-
- `--provider, -p` — Cloud provider: `azure`, `aws` (omit to show all providers)
201-
- `--target, -t` — Target name (subscription, resource group, account, etc.)
202-
- `--role, -r` — Role name (e.g., "Contributor", "Reader", "AdministratorAccess")
203-
- `--favorite, -f` — Use a saved favorite alias (combines provider, target, and role)
204-
- `--groups` — Show only Entra ID groups in the interactive selector
205-
- `--group, -g` — Group name for direct group membership elevation
206-
- `--refresh` — Bypass eligibility cache and fetch fresh data
207-
208-
**Target matching:**
209-
- Matches by workspace name (case-insensitive, partial match)
210-
- Interactive mode provides fuzzy search
211-
- Shows workspace type (subscription, resource group, etc.) and available roles
212-
213-
**How it works:**
214-
- **Azure:** SCA creates a JIT Azure RBAC role assignment. Your existing `az` CLI session automatically picks up the elevated permissions — no credentials are returned.
215-
- **AWS:** SCA returns temporary AWS credentials (access key, secret key, session token). Use `grant env` to export them: `eval $(grant env --provider aws)`
216-
217-
### status
108+
### Flags
218109

219-
Display authentication state and active elevation sessions.
110+
**Global:** `--verbose, -v` (detailed output) | `--output, -o` (`text` or `json`)
220111

221-
```bash
222-
grant status
223-
grant status --provider azure # filter by Azure
224-
grant status --provider aws # filter by AWS
225-
```
226-
227-
### favorites
228-
229-
Manage saved role combinations for quick elevation.
230-
231-
**Add a favorite (interactive):**
232-
```bash
233-
grant favorites add <name>
234-
```
235-
Fetches your eligible targets from SCA and presents an interactive selector with fuzzy search — the same experience as `grant` elevation. Select a target/role combination and it's saved as a favorite.
236-
237-
**Add a favorite (non-interactive):**
238-
```bash
239-
grant favorites add <name> --target "Prod-EastUS" --role "Contributor"
240-
grant favorites add <name> -t "MyResourceGroup" -r "Owner" -p azure
241-
```
242-
When `--target` and `--role` are both provided, the interactive selector is skipped and no authentication is required.
243-
Provider defaults to the config value (azure) if omitted.
244-
245-
**List favorites:**
246-
```bash
247-
grant favorites list
248-
```
249-
Shows all saved favorites with their provider, target, and role.
112+
**Elevation** (`grant`, `env`, `favorites add`):
113+
`--provider, -p` | `--target, -t` | `--role, -r` | `--favorite, -f` | `--group, -g` | `--groups` | `--refresh`
250114

251-
**Remove a favorite:**
252-
```bash
253-
grant favorites remove <name>
254-
```
115+
Target matching is case-insensitive and supports partial match; interactive mode provides fuzzy search.
255116

256117
## Configuration
257118

258119
### App Config (`~/.grant/config.yaml`)
259120

260-
Application settings including default provider and favorites.
261-
262-
**Default location:** `~/.grant/config.yaml`
263-
264-
**Override:** Set `GRANT_CONFIG` environment variable to use a custom path.
121+
Override path with `GRANT_CONFIG` environment variable.
265122

266123
```yaml
267124
profile: grant # SDK profile name
@@ -279,101 +136,36 @@ favorites:
279136
role: "AdministratorAccess"
280137
```
281138
282-
**Fields:**
283-
- `profile` — Name of the SDK profile in `~/.idsec_profiles/` (default: `grant`)
284-
- `default_provider` — Default cloud provider for elevation (used when `--provider` is omitted)
285-
- `cache_ttl` — Eligibility cache TTL as a Go duration string (default: `4h`; e.g., `2h`, `30m`)
286-
- `favorites` — Map of favorite names to provider/target/role combinations
287-
288139
### Environment Variables
289140
290141
| Variable | Description | Default |
291142
|----------|-------------|---------|
292143
| `GRANT_CONFIG` | Custom path to app config YAML | `~/.grant/config.yaml` |
293144
| `IDSEC_LOG_LEVEL` | SDK log level (`DEBUG`, `INFO`, `CRITICAL`) — overrides `--verbose` | Not set |
294-
| `HOME` | User home directory (used for config paths) | System default |
295145

296146
## Troubleshooting
297147

298-
### Elevation succeeds but Azure CLI doesn't see new role
299-
300-
**Cause:** Azure CLI token cache may be stale.
301-
302-
**Solution:**
303-
```bash
304-
# Refresh Azure CLI token
305-
az account get-access-token --output none
306-
307-
# Or clear Azure CLI cache and re-login
308-
az account clear
309-
az login
310-
```
311-
312-
### "No eligible targets found"
313-
314-
**Cause:** Either you have no SCA policies granting access, or your policies don't grant access for the specified provider.
315-
316-
**Solution:**
317-
1. Contact your CyberArk administrator to verify SCA policies
318-
2. Ensure policies grant you access to the cloud provider (Azure, AWS)
319-
3. Try without `--provider` to see all available targets: `grant`
320-
4. Or specify a provider explicitly: `grant --provider azure` or `grant --provider aws`
321-
322-
### "Failed to elevate" or partial success
323-
324-
**Cause:** Policy may not allow the specific role or target, or session limit reached.
325-
326-
**Solution:**
327-
1. Check active sessions: `grant status`
328-
2. Verify the target name and role name are correct
329-
3. Contact your CyberArk administrator if role should be available or if you've reached session limits
330-
331-
### Provider-related errors
332-
333-
Supported providers: `azure`, `aws`. `grant env` only works with AWS (Azure doesn't return credentials). For Azure, use `grant` directly.
334-
335-
### Permission denied accessing keyring (Linux)
336-
337-
Install and start a keyring service (`gnome-keyring` or `kwalletmanager`).
148+
| Problem | Solution |
149+
|---------|----------|
150+
| Azure CLI doesn't see new role after elevation | Refresh token: `az account get-access-token --output none` (or `az account clear && az login`) |
151+
| "No eligible targets found" | Verify SCA policies with your CyberArk admin; try without `--provider` to see all targets |
152+
| "Failed to elevate" | Check `grant status` for active sessions; verify target/role names |
153+
| `grant env` errors for Azure | `env` is AWS-only — Azure doesn't return credentials, use `grant` directly |
154+
| Permission denied accessing keyring (Linux) | Install and start `gnome-keyring` or `kwalletmanager` |
338155

339156
## Development
340157

341-
### Running Tests
342-
343-
```bash
344-
# Unit tests
345-
make test
346-
347-
# Integration tests (requires binary build)
348-
make test-integration
349-
350-
# All tests
351-
make test-all
352-
```
353-
354-
### Building
355-
356-
```bash
357-
# Build binary
358-
make build
359-
360-
# Build with version info
361-
VERSION=1.0.0 make build
362-
```
363-
364-
### Linting
365-
366158
```bash
367-
make lint
159+
make build # Build binary
160+
make test # Unit tests
161+
make test-integration # Integration tests (builds binary)
162+
make test-all # All tests
163+
make lint # Lint (golangci-lint)
368164
```
369165

370166
## Contributing
371167

372-
Contributions welcome! Please:
373-
1. Follow existing code patterns and conventions
374-
2. Write tests for new functionality (TDD preferred)
375-
3. Update documentation for user-facing changes
376-
4. Use conventional commits for commit messages
168+
Contributions welcome! Please follow existing patterns, write tests (TDD preferred), update docs, and use conventional commits.
377169

378170
## License
379171

0 commit comments

Comments
 (0)