security: exclude flexoptix-marketplace data from all public API endpoints

Public price-comparison and hot-topics routes previously had no filter
for the flexoptix/flexoptix-selfconfigure/flexoptix-msrp marketplaces.
Flexoptix API data is customer-confidential and must not leave the system.

Adds marketplace NOT LIKE flexoptix% filter to:
- /api/price-comparison (top-50 CTE)
- /api/price-comparison/summary (both CTEs)
- /api/price-comparison/:sku (per-vendor subquery)
- /api/hot-topics price_drops query (vendor name filter)
This commit is contained in:
root 2026-07-07 14:44:57 +00:00
parent eb2888cb0e
commit 443c1f08c6
2 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,7 @@ hotTopicsRouter.get("/", async (req, res) => {
JOIN vendors v ON pc.vendor_id = v.id JOIN vendors v ON pc.vendor_id = v.id
JOIN transceivers t ON pc.transceiver_id = t.id JOIN transceivers t ON pc.transceiver_id = t.id
WHERE pc.delta_pct < -10 AND pc.detected_at > NOW() - INTERVAL '14 days' WHERE pc.delta_pct < -10 AND pc.detected_at > NOW() - INTERVAL '14 days'
AND v.name != 'Flexoptix'
ORDER BY pc.delta_pct ASC LIMIT 5 ORDER BY pc.delta_pct ASC LIMIT 5
`).catch(() => ({ rows: [] })); `).catch(() => ({ rows: [] }));

View File

@ -36,6 +36,7 @@ priceComparisonRouter.get("/summary", async (_req: Request, res: Response) => {
po.price, po.price,
po.currency po.currency
FROM price_observations po FROM price_observations po
WHERE po.marketplace NOT LIKE 'flexoptix%'
ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC
) )
SELECT SELECT
@ -55,6 +56,7 @@ priceComparisonRouter.get("/summary", async (_req: Request, res: Response) => {
po.price, po.price,
po.currency po.currency
FROM price_observations po FROM price_observations po
WHERE po.marketplace NOT LIKE 'flexoptix%'
ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC
) )
SELECT SELECT
@ -110,6 +112,7 @@ priceComparisonRouter.get("/", async (req: Request, res: Response) => {
po.price, po.price,
po.currency po.currency
FROM price_observations po FROM price_observations po
WHERE po.marketplace NOT LIKE 'flexoptix%'
ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC
) )
SELECT SELECT
@ -216,6 +219,7 @@ priceComparisonRouter.get("/:sku", async (req: Request, res: Response) => {
po.time po.time
FROM price_observations po FROM price_observations po
WHERE po.transceiver_id = $1 WHERE po.transceiver_id = $1
AND po.marketplace NOT LIKE 'flexoptix%'
ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC ORDER BY po.transceiver_id, po.source_vendor_id, po.time DESC
) po ) po
JOIN vendors v ON v.id = po.source_vendor_id JOIN vendors v ON v.id = po.source_vendor_id