fix: resolve issues #934-#937 - security, auth, metrics, and performance - #1
Open
joshuanelsoncod-source wants to merge 4 commits into
Open
fix: resolve issues #934-#937 - security, auth, metrics, and performance#1joshuanelsoncod-source wants to merge 4 commits into
joshuanelsoncod-source wants to merge 4 commits into
Conversation
The validationcloud.io RPC endpoint had a hardcoded API key embedded in the SDK source code. Replace with public Stellar mainnet endpoint. Callers can provide their own RPC URL via TrustLinkClientOptions. Fixes Haroldwonder#934
Apply consistent authorization across all four admin/webhook endpoints: - POST /webhooks - DELETE /webhooks/:id - POST /admin/reindex - GET /admin/webhook-failures Check x-api-key header against API_KEY env var. Endpoints allow unauthenticated access only when API_KEY is not configured. Adds comprehensive test coverage for authorization on all endpoints. Fixes Haroldwonder#935
Connect previously-defined-but-unused Prometheus metrics: - incrementEventFailed: called when event processing fails - incrementIssuerAttestation: called when issuer creates attestation - incrementIssuerRevocation: called when issuer revokes attestation - setIssuerRateLimitRatio: called when rate_limit_set event occurs, calculates ratio from active attestation count - issuersTotal: updated when new issuer registers Metrics now feed live data to Grafana dashboards and Alertmanager rules. Adds comprehensive test coverage for all metric invocations. Fixes Haroldwonder#936
… queries Replace inefficient O(n²) bubble sort implementation in: - get_expiring_attestations - get_issuer_expiring_attestations Use insertion sort which maintains O(n²) worst case but provides: - Better cache locality - Fewer element moves - Optimal performance for small/partially sorted vectors - Consistent Soroban/no_std compatibility Adds test coverage verifying sorting behavior and performance characteristics. Fixes Haroldwonder#937
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four critical issues across the TrustLink codebase:
Haroldwonder#934: Remove hardcoded API key
Haroldwonder#935: Add authorization to admin REST endpoints
Haroldwonder#936: Wire Prometheus metrics
Haroldwonder#937: Optimize expiring attestations sorting
Closes Haroldwonder#937
Closes Haroldwonder#936
Closes Haroldwonder#935
Closes Haroldwonder#934