Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug:IP Stack API Key Flow Needs Improvement for Better User Experience #210

Open
jonnybottles opened this issue Dec 22, 2024 · 0 comments
Open
Assignees
Labels
status/backlog In backlog / validated type/bug Non-urgent code defect

Comments

@jonnybottles
Copy link
Collaborator

What happened?

The IP Stack API key management in Hawk has several usability issues:

  1. If users skip entering the API key on the first prompt, it saves an empty string in %LOCALAPPDATA%\Hawk\Hawk.json.
  2. On subsequent runs, Hawk doesn't re-prompt for the missing key.
  3. The API key prompt appears mid-investigation rather than during initial setup.
  4. No command-line parameter exists to modify the API key.
  5. Users can't easily update their API key without manually editing configuration files.

Steps to Reproduce

  1. Run Start-HawkUserInvestigation for the first time.
  2. When prompted for the IP Stack API key, press Enter without entering a key.
  3. Verify that %LOCALAPPDATA%\Hawk\Hawk.json contains an empty access_key value.
  4. Run Start-HawkUserInvestigation again.
  5. Observe that:
    • No prompt for the API key appears.
    • IP geolocation fails due to the missing key.
    • Error messages appear during IP resolution attempts.

Hawk Version

3.2.3

Technical Analysis

  • Input validation missing for API key entry.
  • Empty string considered valid configuration.
  • API key prompt timing tied to Get-IPGeolocation execution rather than initialization.
  • No built-in method to update the stored API key.
  • No command-line parameter support for API key configuration.

Implementation Plan

Add New Parameter to Initialize-HawkGlobalObject:

[Parameter()]
[string]$IPStackAPIKey

**Modify Initialization Flow:**

- Move API key check to initialization after output folder prompt.
- Validate API key input (prevent empty string storage).
- Add command-line parameter support.
- Add an option to update the existing key.


**Update Get-IPGeolocation:**

- Improve error handling for missing/invalid keys.
- Add validation before API calls.
- Provide better error messages directing users to proper key configuration.

**Add New Function:**
Update-HawkIPStackKey [-Key <string>]

**Update HawkAppData Handling:**

- Don't store empty strings.
- Validate stored keys on load.
- Clear invalid configurations.


### Acceptance Criteria

_No response_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/backlog In backlog / validated type/bug Non-urgent code defect
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants