Skip to content

Commit 3600f72

Browse files
committed
fix(apps): harden public app endpoints against disclosure, DoS, view tampering
- Whitelist public listing + detail responses via toPublicAppListItem/toPublicAppDetail (drops originalPrompt/finalPrompt/sessionToken/userId/deploymentId/parentAppId; private-repo GitHub URLs owner-only) - Keep prompt + code visible on public apps (intended feature); owner still receives userId/deploymentId - Bound page/search + query timeout + dedicated publicApps rate limit - Deduplicate views via viewerHash (unique index + upsert + COUNT DISTINCT) with backfill migration - Add regression tests for DTO deny-list and request-shape validation
1 parent 918e974 commit 3600f72

16 files changed

Lines changed: 3319 additions & 45 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ALTER TABLE `app_views` ADD `viewer_hash` text;--> statement-breakpoint
2+
-- Backfill existing rows with their unique id so historical view counts are
3+
-- preserved under COUNT(DISTINCT viewer_hash) and the unique index below is
4+
-- satisfied. Going-forward dedup uses a per-viewer/per-bucket hash on insert.
5+
UPDATE `app_views` SET `viewer_hash` = `id` WHERE `viewer_hash` IS NULL;--> statement-breakpoint
6+
CREATE UNIQUE INDEX `app_views_app_viewer_idx` ON `app_views` (`app_id`,`viewer_hash`);

0 commit comments

Comments
 (0)