@jxtools/promptline 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@ export function SessionSection({ session, project, onMutate, defaultExpanded = t
|
|
|
37
37
|
|
|
38
38
|
async function handleClearPrompts(e: React.MouseEvent) {
|
|
39
39
|
e.stopPropagation();
|
|
40
|
+
if (!window.confirm('Clear all prompts?')) return;
|
|
40
41
|
try {
|
|
41
42
|
await api.clearPrompts(project, session.sessionId);
|
|
42
43
|
onMutate();
|
package/vite-plugin-api.ts
CHANGED
|
@@ -23,6 +23,10 @@ import {
|
|
|
23
23
|
|
|
24
24
|
const QUEUES_DIR = join(homedir(), '.promptline', 'queues');
|
|
25
25
|
|
|
26
|
+
export function isSafeSegment(s: string): boolean {
|
|
27
|
+
return s.length > 0 && !s.includes('/') && !s.includes('\\') && !s.includes('..');
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
function parseBody(req: IncomingMessage): Promise<Record<string, unknown>> {
|
|
27
31
|
return new Promise((resolve, reject) => {
|
|
28
32
|
let body = '';
|
|
@@ -160,6 +164,10 @@ async function handleApi(
|
|
|
160
164
|
// Parse URL segments: /api/projects/:project/sessions/:sessionId/prompts/:promptId
|
|
161
165
|
const segments = url.replace(/^\/api\//, '').split('/').map(decodeURIComponent);
|
|
162
166
|
|
|
167
|
+
if (!segments.every(isSafeSegment)) {
|
|
168
|
+
return jsonError(res, 400, 'Invalid path segment');
|
|
169
|
+
}
|
|
170
|
+
|
|
163
171
|
// GET /api/projects
|
|
164
172
|
if (segments[0] === 'projects' && segments.length === 1 && method === 'GET') {
|
|
165
173
|
return json(res, 200, listProjects(QUEUES_DIR));
|