Skip to content

feat: token validation on install#224

Merged
stordahl merged 3 commits intomainfrom
stordahl/cli-token-validation
Sep 20, 2025
Merged

feat: token validation on install#224
stordahl merged 3 commits intomainfrom
stordahl/cli-token-validation

Conversation

@stordahl
Copy link
Copy Markdown
Collaborator

@stordahl stordahl commented Sep 20, 2025

Closes #195

Overview

Adds api bearer token verification during install using cloudflares verify endpoint.

Note

In order to verify a tokens permissions, the token entered needs to be created as a user level token with API Tokens: Read. IMO this complicates the setup process and limits what tokens can be used to deploy Counterscale, so we only do basic validation during install.

Changes

@counterscale/cli

  • Adds an async static method, verifyToken, to CloudflareClient
  • When then use this method inside the install command

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 20, 2025

Codecov Report

❌ Patch coverage is 91.17647% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.34%. Comparing base (d07a2a2) to head (c4ebf42).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/cli/src/commands/install.ts 76.92% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #224      +/-   ##
==========================================
+ Coverage   78.36%   80.34%   +1.97%     
==========================================
  Files          51       56       +5     
  Lines        3943     4406     +463     
  Branches      524      580      +56     
==========================================
+ Hits         3090     3540     +450     
- Misses        844      857      +13     
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stordahl stordahl marked this pull request as ready for review September 20, 2025 15:26
@stordahl stordahl merged commit 66c8505 into main Sep 20, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI should validate API token has valid permissions before deploy

1 participant