Commit b4fef39
committed
Harden codebase: fix bugs, remove dead code, improve security and performance
Server:
- Fix broken comment update/delete (was querying snippetId=0, added getComment(id))
- Remove insecure /api/test-import endpoint (no auth, hardcoded user)
- Add auth + ownership checks to collection GET/list endpoints
- Add privacy check to GET /api/snippets/:id (private snippets hidden from non-owners)
- Eliminate triple-fallback pattern (simpleStorage → storage → raw SQL) in routes
- Remove 400-line dead MemStorage class and simple-storage.ts module
- Fix DatabaseStorage: static db import instead of dynamic import in every method
- Remove error stack traces from API error responses
- Add parseId() helper for numeric route param validation
- Cascade snippet deletion to comments table
- Add request body size limit (1mb)
- Clean up duplicate 404 handlers, excessive debug logging
- Remove debug/fix files: db_fix.js, storage_fix.js, debug_storage.ts, winston-test.ts
Client:
- Fix transformSnippet falsy-value bug (|| → ?? for viewCount:0, isFavorite:false)
- Fix CommentSection calling apiRequest with wrong argument order
- Fix Tags.tsx using non-existent 'tag' prop instead of 'tags' array
- Fix Layout.tsx passing unsupported 'isPublicView' prop to Header
- Fix 5 components importing non-existent 'useAuth' export from AuthContext
- Fix useAuthenticatedFetch sending uid instead of Firebase ID token
- Fix ForgotPasswordForm: wire directly to Firebase sendPasswordResetEmail
- Simplify AuthContext: remove DOM notification system, localStorage sync hack
- Remove dead components: AdvancedSearch, CreateSnippetModal, FixedLucideIcon,
GlobalSVGMonitor, ThemeSelector, TagCloud
- Remove dead files: firebase-config.js, all .backup files, SnippetCard.test.tsx
- Strip ~200 lines of console.log debug noise across components
- Remove window.location.reload() from import success flow
Build/deps:
- Remove 16 unused npm dependencies (passport, express-session, framer-motion, etc.)
- Remove Replit plugin code from vite.config.ts
- Remove winston-test.ts from build output, enable tree-shaking
- Fix CI workflow: correct script names, update to actions v4 + Node 20
- Fix check-no-hardcode.sh: filename typo and subshell variable bug
- Fix server/vite.ts allowedHosts type error
- Zero TypeScript errors, clean build
Made-with: Cursor1 parent c0b2a5e commit b4fef39
45 files changed
Lines changed: 3678 additions & 16028 deletions
File tree
- .github/workflows
- client/src
- components
- __tests__
- auth
- contexts
- hooks
- lib
- pages
- scripts
- server
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
| 1 | + | |
| 2 | + | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | | - | |
13 | 10 | | |
14 | 11 | | |
15 | 12 | | |
| |||
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
23 | | - | |
24 | 20 | | |
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
29 | 25 | | |
30 | | - | |
31 | 26 | | |
32 | 27 | | |
33 | 28 | | |
34 | 29 | | |
35 | | - | |
| 30 | + | |
36 | 31 | | |
37 | 32 | | |
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
41 | 36 | | |
42 | | - | |
| 37 | + | |
43 | 38 | | |
44 | 39 | | |
45 | 40 | | |
| |||
51 | 46 | | |
52 | 47 | | |
53 | 48 | | |
54 | | - | |
| 49 | + | |
55 | 50 | | |
56 | | - | |
57 | 51 | | |
58 | 52 | | |
59 | 53 | | |
60 | 54 | | |
61 | 55 | | |
62 | 56 | | |
63 | | - | |
64 | 57 | | |
65 | | - | |
| 58 | + | |
| 59 | + | |
66 | 60 | | |
67 | | - | |
68 | 61 | | |
69 | 62 | | |
70 | 63 | | |
71 | 64 | | |
72 | 65 | | |
73 | | - | |
74 | 66 | | |
75 | 67 | | |
76 | 68 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | 69 | | |
96 | | - | |
97 | | - | |
98 | 70 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
106 | 75 | | |
107 | 76 | | |
108 | 77 | | |
109 | | - | |
| 78 | + | |
110 | 79 | | |
111 | 80 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 81 | + | |
124 | 82 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | 83 | | |
154 | | - | |
155 | 84 | | |
156 | 85 | | |
157 | | - | |
| 86 | + | |
158 | 87 | | |
159 | | - | |
160 | 88 | | |
161 | 89 | | |
162 | 90 | | |
163 | 91 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 92 | | |
168 | 93 | | |
169 | 94 | | |
170 | | - | |
171 | | - | |
| 95 | + | |
| 96 | + | |
172 | 97 | | |
173 | 98 | | |
174 | | - | |
175 | 99 | | |
176 | 100 | | |
177 | 101 | | |
178 | 102 | | |
179 | 103 | | |
180 | 104 | | |
181 | | - | |
| 105 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
0 commit comments