Spaces:
Running
Running
Commit History
4 days ago
-
fix(sonar): wave 8 - final sweep, all 21 remaining live findings
Z User- S8689/S5144: documented sanitizer/authority invariants (redact() contract, fixed-hostname + origin-form) - taint-model blind spots, NOSONAR justified - S3776 x3: extract collectNormalizedMessages, verifyRightsAndSweep, ReviewsHeader (16 -> <=15 each) - S8786/S5843: extract_refs_kb trailing-number + kW token validators (differential-fuzz equivalent: 0 mismatches / 200k cases), redact() regex linearized in both probe scripts, HEAD_RE_PARTS regrouped (0/60k) - css:S7924 x2: cyan-500 -> cyan-400 at the flagged rules (4.5:1 cleared) - S7503/S3626 write-strategies, S6582 worker, S4323 cables aliases, S7786 TypeError, S2486 comment style Verified: tsc clean, eslint clean, vitest 1394/1394, py_compile clean.5632e3b -
fix(sonar): wave 7 - cleanup round from live scan (93 findings across 65 files)
Z User- 34 in-scope follow-ups exposed by the 17:59 scan (refactor residuals: S3776 helper splits, S4323 type aliases, S6759 readonly on extracted components, S8786 bounded-regex justifications, S6551 scrub patterns, S9440/S7924 CSS at new positions) - python leftovers: 29x S1481 positional _, S8786 regex canonicalization (fuzz-verified), S3776 task24 step-fn hoisting, S1192 dialog/content-type consts - operator tooling: S9382 documented NOSONARs for deliberate poll/throttle loops + Promise.all for independent probes, S8689 second log site routed through redact(), S5144 second fetch site behind UPSTREAM_HOST_ALLOWLIST Verified: tsc clean, vitest 1394/1394, node --check + py_compile on touched scripts.6780540
7 days ago
-
security(audit-run-3): comprehensive security audit fixes (cloudflare security-audit-skill)
Security Audit Run 3Confirmed vulnerabilities fixed: - paymob-webhook: bind SIGNED obj.order.id to stored paymobOrderId (unsigned merchant_order_id was the only correlation key — replay-with-swap class); verify the callback's own signed currency (EGP pin now two-sided); preserve the original charge reference on refund/void events - promo quota release is now transaction-atomic with the refund/reject that compensates it (webhook tx + admin reject tx) - referral reward coupon is granted at ADMIN APPROVAL instead of registration (self-referral coupon farming closed); single decision path in decideApproval - wishlist add/list leak of unpublished (draft) course metadata — existence + isPublished validation on add/toggle, publish predicate on the list join - vision image-quota reservation leak on the per-user daily-cap 429 path (refund exactly once invariant restored); vision lanes re-keyed to the AUTHENTICATED account (u<id>) instead of spoofable client headers - forgotPassword: per-RECIPIENT s…ec34781
13 days ago
-
refactor(chatbot): anti-koshary structural pass — shared chatRequestPreflight for / and /stream (unify drifted admission sequences: chatId on all errors, malformed-JSON consumes rate bucket on both), clearChatHistory seam in chat-history lib, one shared ARABIC_CHAR_RE in chatbot-normalize
Z User7a80eb9
20 days ago
-
feat(chatbot): token-optimization layer v3.6.0 — minimum token spend, zero quality delta
ahmdelbaz28-uxMeasured on the real builders (scripts/token-audit.ts): - cache-friendly prompt layout: 47-56% of the prompt is now a byte-identical stable prefix (provider prompt caching discounts 50-90% of prompt tokens) - catalog gating: full 40-course catalog only on course/platform intent (sticky over recent history); featured 8-course sample otherwise — 6.3k chars (~1.6k+ tokens, ~3k Arabic BPE) saved per technical message - sliding-window history trim: 48-54% of shipped history chars cut (last 2 assistant turns + current question always full) - vision description cap 6000 -> 2400 chars (~900 tokens/frame) - rolling-summary transcript cap 40k -> 12k chars - web plugin attached only on current-info intent (1-3k tokens/attempt) - attempt budgets: OpenRouter sweep 10, last-resort 8 (was unbounded ~25-40 full-payload calls per message in degraded states) - token usage telemetry: every billed call now parses the OpenAI-compatible usage field and logs [Chatbot/Tokens] + aggregates (was: ze…8d2c603
21 days ago
-
fix(chatbot+youtube): deep audit root-cures — reply sanitizer no longer corrupts code/parens, Arabic ؟ sentence-end, INVALID_JSON 400, vision abort, blank-chat rejection, YT placeholder+replay+race cures
ahmdelbaz28-uxCHATBOT (8 fixes): - sanitizeReplyOutput: cleanup is now SEAM-SCOPED — the old global (\s*)/multi-space collapse destroyed every reply's code (f() → f), indentation and ASCII SLD boards; no-CJK text is now byte-identical - finalize-reply: U+061F ؟ added to SENTENCE_END_RE + trim scan — Arabic answers no longer look mid-sentence (needless rescue rounds) and closing questions are never cut off - POST /api/chatbot: malformed JSON now answers 400 INVALID_JSON (the /stream fix finally back-ported; was a false 500 + error log) - normalize: an all-blank conversation is rejected 400 BEFORE dispatch (burned a real provider call) - getChatResponse: permanent (no-keys) failure flag — persistence loop stops retrying the unwalkable, misconfigured deployments answer instantly - vision PASS-1 read now honors the caller abortSignal (gone clients stopped burning vision quota) - think-filter: length-changing lowercase (İ) no longer shifts indices and corrupts output — indexOfCI reports original-string i…c2fa8e6 -
feat(chatbot): LIVE SCREEN TEACHER — the bot sees the user's real screen (ETAP etc.) and guides step-by-step, zero guessing
ahmdelbaz28-uxClient (screen-share lane): - src/lib/screen-share.ts: getDisplayMedia manager — browser picker (explicit consent), snapshot-on-demand frame capture (1440px ladder, 300KB budget), 220px live preview at 2fps, honest teardown on track end. Feature-detected; unsupported browsers never see the button. - ChatBot.tsx: screen-share toggle next to attach, live share bar (preview + pulsing LIVE dot + 'اقرأ الآن' one-tap read), EVERY send while sharing auto-carries the CURRENT frame (manual attachment still wins), capture failure degrades to text-only with an honest notice. Server (teacher mode, no-guessing contract): - chatbot-normalize.ts (extracted, pure): validates image part source:"screen_capture" ONLY on the last user message — unknown tags ignored, data-URL/count/size guards unchanged. - chatbot-vision.ts: dedicated LIVE-SCREEN extraction prompt — verbatim UI reading (window title, menus, tabs, selected element, values), [غير مقروء] for unreadable, 'not visible in th…99b3964