Open Questions [TEAM_WHY_NEEDED] & Tech Debt
Use this board during engineering/product reviews to record the historical “Why?” behind non-obvious rules and track cleanup priorities.
A. Open [TEAM_WHY_NEEDED] Questions
[TEAM_WHY_NEEDED: Why does scheduler/backend/api.php return HTTP 200 with full API_DEBUG_TRACE on every request including errors and fatal crashes, instead of proper 4xx/5xx codes and server-side logging?][TEAM_WHY_NEEDED: Why are Google Calendar event creation failures silently swallowed (scheduler/backend/api.php:571-573) after reserving the DB row, leaving a booking with no Meet link and no user/host warning?][TEAM_WHY_NEEDED: Why do scheduler/backend/delete_json.php and dealflow/backend/delete_json.php require no authentication header unlike save_scheduler.php and save_dealflow.php?][TEAM_WHY_NEEDED: Why is scheduler/data/.htaccess missing from git even though scheduler/backend/public_config.php:6 states "The data/ folder itself is now blocked by data/.htaccess"?][TEAM_WHY_NEEDED: Why do both dealflow/api/create_offer.php (generates random offer_ ID, returns 201) and dealflow/api/save_dealflow.php (accepts caller-supplied id, returns 200) coexist — are both still called by planovi-flutter-app?][TEAM_WHY_NEEDED: Why is Turnstile omitted in Pricing Mode (dealflow/offer.php:1805, 1900) and skipped in dealflow/api/save_response.php:47 whenever turnstile_token is empty?][TEAM_WHY_NEEDED: Why is dealflow/test_generator.php deployed without an environment or auth guard, allowing anyone to write files into dealflow/data/?][TEAM_WHY_NEEDED: Does Supabase Storage bucket company-media restrict anon uploads to {company_id}/signatures/* via RLS tied to an active session, or can any caller with SUPABASE_ANON_KEY overwrite signature PNGs?][TEAM_WHY_NEEDED: Confirm mode='admin_edit' and deal_id are mutually exclusive in planovi-backend tokens, since offer.php:141-150 lets deal_id override submitFnUrl while keeping IS_ADMIN_EDIT payload format.][TEAM_WHY_NEEDED: Why is $appUrl hardcoded to 'https://dev-panel.planovi.app' in dealflow/payment-success.php:20 instead of being env-configured?][TEAM_WHY_NEEDED: Are both dealflow/inquiry-success.php and dealflow/payment-success.php actively used as Stripe success_url targets in planovi-backend, or did one replace the other?][TEAM_WHY_NEEDED: Why does dealflow/inquiry.php have no Cloudflare Turnstile or rate limiting before calling the public submit-inquiry Edge Function?][TEAM_WHY_NEEDED: Why do identical copies exist at both agreements/sign.php and dealflow/sign.php? Which path is canonical in production emails?][TEAM_WHY_NEEDED: Should #docFrame in agreements/sign.php use an iframe sandbox attribute when rendering htmlContent via srcdoc?][TEAM_WHY_NEEDED: Does the "24 godziny" expiry text in the GoTrue auth email templates match the actual GOTRUE_MAILER_OTP_EXP value configured on VPS?][TEAM_WHY_NEEDED: What is the status and timeline of the Laravel 11 migration (laravel-app/ contains only .env.example)? Should branding/security fixes go into the plain PHP microservices first?][TEAM_WHY_NEEDED: Why does README.md reference an offers/ microservice and Python runtime when neither exists in this repository?]
B. Critical Security Anomalies (Actionable)
- Hardcoded Google OAuth Credentials & Dev Redirect URI:
scheduler/backend/config_google.php:5-7hardcodesGOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET, andhttps://dev-scheduler.planovi.app/backend/auth_callback.phpin git. Rotate credentials and load from.env. - Committed GCP OAuth Reference JSON:
scheduler/backend/gcp_clientId_clientSecret(not used, just for reference).jsonis tracked in git. Remove from repo and scrub history. - Live OAuth Tokens Committed in Git + Missing
.htaccess: 34 files acrossscheduler/data/*.jsonandscheduler/backend/data/*.jsoncontain non-emptygoogle_access_token/google_refresh_tokenvalues committed to git, andscheduler/data/.htaccessis missing from git. Revoke/rotate tokens, addscheduler/data/.htaccess(Require all denied), and gitignore runtimedata/*.jsonand*.log/*.txt. - Hardcoded Fallback Turnstile Secret + Bypassable Check:
dealflow/api/save_response.php:45has a hardcoded fallback string forTURNSTILE_SECRET_KEY, and line 47 skips verification completely ifturnstile_tokenis omitted. - Unauthenticated File Deletion Endpoints:
dealflow/backend/delete_json.phpandscheduler/backend/delete_json.phpaccept unauthenticatedPOST {"id":"..."}fromAccess-Control-Allow-Origin: *and unlink arbitrary JSON files indata/. - Client-Spoofable
company_idin Lead Submission:dealflow/api/save_response.php:70trusts$new_response['company_id']from the untrusted browser payload while inserting viaSUPABASE_SERVICE_KEY(bypassing RLS), instead of readingcompany_idfromdealflow/data/{offer_id}.json. - OAuth Login CSRF on Google Calendar Connect:
scheduler/backend/auth_start.php:15andauth_callback.php:21use raw$client_idas OAuthstatewithout a signed/session nonce, allowing an attacker to bind their Google account to another tenant’s scheduler ID. - Information Disclosure in API Responses:
scheduler/backend/api.phpleaks fullAPI_DEBUG_TRACE(internal server file paths, Google FreeBusy timestamps, Supabase error bodies) in every public response;dealflow/api/save_response.php:121returns raw Supabase error text indebug. - Timing-Unsafe Secret Checks:
save_scheduler.php:100,save_dealflow.php:104, andcreate_offer.php:61use!==instead ofhash_equals(). - Client-Side Self-XSS in Inquiry Summary:
dealflow/inquiry.php:836-849injects unescaped form values intoinnerHTML. - Unauthenticated File-Writing Dev Script:
dealflow/test_generator.phpwrites 3 JSON files todealflow/data/on everyGETrequest.
C. Verified Bugs & Code Discrepancies
- Broken Tenant Logo in Offer Mode (
dealflow/offer.php:945): Checks undefined$branding['logo_url']instead of$offer_data['branding']['logo_url']; tenant logos never render in Offer Mode. - Duplicate Config Fetch & Duplicate
MutationObserverin Scheduler: Both inline JS inscheduler/index.php:1111, 1190-1407andscheduler/assets/script_v2.js:469, 556-770independently fetchpublic_config.php, definegenerateCustomFields(), and attachMutationObservers to#form-view. - Broken
fileCustom Field in Scheduler (script_v2.js:410, 713-719): Renders<input type="file">, but JSON-encodesFormData.get()intocustom_fields, serializingFileobjects as{}. - Missing
LOCK_EXon Token Refresh Write (scheduler/backend/api.php:199): Concurrent visitors refreshing an expired Google access token can race onfile_put_contents($jsonPath, ...)and corrupt the JSON file. - Header Logo Duplication in Signing Portal (
agreements/sign.php:445-453): PrependscompanyLogo<img>without hiding the default#brandIconSVG; unused#brandImgelement exists at line 241. - Domain Typos (
planowi.appwithw): Present inagreements/sign.php:345,348,350,dealflow/sign.php:345,348,350,dealflow/payment-success.php:262, andlocalStoragekey'planowi_theme'(sign.php:366,369). - Quote-Unsafe
.envLoaders:agreements/sign.php,dealflow/sign.php,dealflow/inquiry.php,dealflow/inquiry-success.php, anddealflow/payment-success.phpdo not strip surrounding quotes from.envvalues. - Hardcoded Dev Legal Links & Cookie Banner Path: Footers across
scheduler/index.php,dealflow/inquiry.php,dealflow/inquiry-success.php,dealflow/payment-success.php, andsign.phppoint tohttps://dev-main.planovi.app/assets/for_preview/index; bothcookie-banner.phpfiles link to non-existent relative path/assets/for_preview/index.php. - Complete Branding Migration Pending: All Zone 1 (GoTrue emails, inquiry/payment pages) and Zone 2 (scheduler, offer, sign) views still use legacy
#0F172A/#14B8A6/#2DD4BFtokens and linear luminance> 0.5instead ofBRANDING_GUIDE.md(#09090B/#32CA42and sRGB> 0.42).
D. Dead, Duplicate & Orphan Files
-
scheduler/default.php— Unused Hostinger welcome placeholder page. -
dealflow/sign.php— Byte-for-byte duplicate ofagreements/sign.php. -
dealflow/cookie-banner.php&scheduler/cookie-banner.php— Duplicate partials (whitespace-only diff). -
dealflow/api/data/deal_1771006118990.json&scheduler/backend/data/*.json(2 files) — Orphan JSON files inside wrong nesteddata/folders never read by current endpoints. -
scheduler/backend/api_debug.log(3,041 lines),scheduler/backend/delete_log.txt(55 lines),dealflow/backend/delete_log.txt(9 lines) — Runtime log files tracked in git. -
dealflow/data/*.json(71 files) &scheduler/data/*.json(75 files) — Runtime/dev data files tracked in git. -
.github/— Empty directory left after commitd3db7aba. -
config.php— Included only byscheduler/index.php, with none of its URL constants (BASE_URL,SCHEDULER_URL,DEALFLOW_URL,ASSETS_URL, etc.) referenced anywhere in the repo.