fix(auth): upgrade rest-client and warn on empty credentials#311
fix(auth): upgrade rest-client and warn on empty credentials#311HardlyDifficult merged 1 commit intomainfrom
Conversation
Upgrade @hardlydifficult/rest-client from 1.0.0 to 1.0.65 to pick up 65 patches of auth bug fixes. The 1.0.0 version had a strict null check in isTokenValid() that treated empty strings as valid tokens, causing unauthenticated requests. Also add a warning in convertAuthConfig() when clientId is empty but authUrl is configured, making silent auth fallbacks observable in logs.
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| `Requests will be sent without authentication. ` + | ||
| `Set CANTON_<NETWORK>_<PROVIDER>_LEDGER_JSON_API_CLIENT_ID to fix.`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Spurious warning fires for intentionally unauthenticated ScanApiClient
Medium Severity
The new warning fires whenever authUrl is non-empty and clientId is empty, but ScanApiClient intentionally sets clientId: '' because scan endpoints are public/unauthenticated. Since Canton (the main entry point) shares the same authUrl across all three clients, every Canton instance with auth configured will emit this spurious warning for the scan client. Additionally, the env var hint hardcodes LEDGER_JSON_API_CLIENT_ID but convertAuthConfig is API-type-agnostic — the hint is misleading for VALIDATOR_API and SCAN_API callers.


Summary
@hardlydifficult/rest-clientfrom1.0.0to1.0.65(65 patches of auth bug fixes)clientIdis empty butauthUrlis configured, making silent auth fallbacks observableProblem
The Canton reverse proxy returns HTTP 404 for unauthenticated requests. When
@hardlydifficult/rest-client@1.0.0failed to acquire a token (due to a strict null check bug inisTokenValid()), requests were sent without authentication, causing persistent 404 errors across all devnet operations.Test plan
npm run lintpassesnpm run buildpassesnpm testpasses (347 unit tests)Note
Medium Risk
Touches authentication behavior by upgrading
@hardlydifficult/rest-clientand adding a new warning path when credentials are missing, which could affect token acquisition and request auth in edge cases. Risk is limited to the auth/config surface and is otherwise a small, targeted change.Overview
Updates
@hardlydifficult/rest-clientfrom1.0.0to1.0.65.Adjusts
AuthenticationManagerconfig conversion to accept a logger and emit a warning when anauthUrlis set butclientIdis empty, making the fallback to unauthenticated requests explicit.Written by Cursor Bugbot for commit d6e7b44. This will update automatically on new commits. Configure here.
Summary by CodeRabbit