Repository navigation
fix(analytics): unique report IDs, auth, and real dispute metrics - #2986
Democodes-flash wants to merge 5 commits into
Conversation
|
@Democodes-flash Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
3e20c7e to
59375ca
Compare
Strips the payload this branch picked up (deleted backend/api.js, truncated quicklendx-frontend/postcss.config.mjs, unhooked backend/package.json). No functional change to the branch's own work.
|
Hi @Democodes-flash — heads-up before we can merge this. Our malware scan found that an earlier commit on this branch carries a PolinRider malware payload (obfuscated code hidden after a long run of spaces in Please:
Once the branch history is clean and the PolinRider guard passes, we'll merge it. Thanks! |
92770d5 to
9682248
Compare
9682248 to
3b3afbb
Compare
3b3afbb to
a4a07a0
Compare
a4a07a0 to
733ff6c
Compare
733ff6c to
7a7fbc3
Compare
|
Hi @Democodes-flash — thanks for removing the payload. The final diff is now clean, but this branch's commit history still contains the PolinRider malware (the earlier commit with obfuscated code hidden in config files and a How to fix (without opening the old branch in VS Code / Cursor): git fetch upstream main
git checkout -B <your-branch> upstream/main # start fresh from clean main
git checkout <your-last-commit> -- <only your own source/test files>
git commit -m "<your change>"
git push --force origin <your-branch>Please do not bring back As soon as the branch history is clean and the PolinRider guard passes, we will merge it. Thank you! |
|
@Baskarayelu — this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed 646631b). |
646631b to
61f31b6
Compare
|
Warning Possible malicious code: please review before merging. An automated security scan flagged files in this pull request that appear to contain malicious code. Code like this can run automatically when a project is opened in an editor or its dependencies are installed, so it could compromise the machine of anyone who checks out this branch. Automated scans can be wrong, so this may be a false positive. Maintainers: please review the flagged files carefully before merging, on GitHub in your browser rather than by checking out the branch. The malicious part is often hidden far off to the right of an ordinary-looking line, so scroll sideways through each file. @Democodes-flash: this pull request adds or changes these files, possibly without your knowledge. Malware like this spreads by adding itself to repositories on machines it has infected, so your machine might be compromised. Please undo these changes in this pull request, and don't open or run other projects on that machine until you've checked it. Flagged files at commit
Only merge once you're confident these files are safe. ℹ️ Posted automatically by Drips Wave. Questions? Contact support@drips.network. |
Overview
This PR makes the analytics/report entrypoints reachable and correct: report IDs are now unique per generation (counter-based), report generation requires subject auth, and
dispute_resolution_timeis computed from the real dispute module instead of the stubbed helpers indefaults.rs.Related Issue
Changes
🔢 Unique report IDs
quicklendx-contracts/src/analytics.rsAnalyticsStorage::generate_report_idnow derives IDs from the previously-unusedrpt_cntcounter, the subject XDR, and the timestamp, and incrementsrpt_cnton each call. Two reports generated in the same ledger for different subjects no longer collide.Old derivation:
New derivation:
🔐 Auth on report generation
quicklendx-contracts/src/analytics.rsgenerate_business_report(business, period)requiresbusiness.require_auth().generate_investor_report(investor, period)requiresinvestor.require_auth().get_business_report(report_id),get_investor_report(report_id),get_platform_metrics(),get_performance_metrics(),export_analytics_snapshot().🧹 Remove dispute stubs, rewire to real implementation
quicklendx-contracts/src/defaults.rsget_invoices_with_disputes(returnedVec::new) andget_dispute_details(returnedOk(None)).quicklendx-contracts/src/analytics.rscalculate_performance_metricsnow reads disputes viacrate::dispute::get_invoices_with_disputesandcrate::dispute::get_dispute_details, sodispute_resolution_timereflects resolved disputes.🔌 Wiring
quicklendx-contracts/src/lib.rsinitializeplus the new analytics entrypoints.Verification Results
get_business_report(id_a).business_address == Asame_ledger_reports_have_distinct_idsmock_all_auths, signed by B, fails authreport_generation_requires_subject_authdispute_resolution_time == 3_600dispute_resolution_time_is_measureddispute_resolution_time == 2_000dispute_resolution_time_averagesCloses #2938