- Replace plaintext tip (transceiver_db) and llm_gateway DB passwords with env-var references guarded by fail-fast checks, across 15 scripts + sql runbook. Covers quoted exports, unquoted psql calls, python env dicts and env-or-hardcoded-default fallbacks. - Untrack training-data/*.jsonl (~48MB, kept on disk) and gitignore *.jsonl. - Add .security-scan-allowlist for legit false positives: vendor name flexoptix, own homelab infra, sibling-project codenames in the sync journal, env-resolved DB URIs, example placeholders, ML tokenizer tokens. - Pre-push leak scanner goes from 397 to 0 findings, green without --no-verify. Follow-up (not in this commit): rotate the leaked values (llm_gateway first, tip fleet-wide coordinated); git history still holds the old passwords.
83 lines
3.9 KiB
SQL
83 lines
3.9 KiB
SQL
-- 010: Add image_url, product_page_url, datasheet_url columns and populate vendor URLs
|
|
-- Run on Erik: PGPASSWORD="$PGPASSWORD" psql -h localhost -p 5433 -U tip -d transceiver_db -f sql/010-vendor-urls.sql
|
|
|
|
-- Add columns (idempotent)
|
|
ALTER TABLE transceivers ADD COLUMN IF NOT EXISTS image_url TEXT;
|
|
ALTER TABLE transceivers ADD COLUMN IF NOT EXISTS product_page_url TEXT;
|
|
ALTER TABLE transceivers ADD COLUMN IF NOT EXISTS datasheet_url TEXT;
|
|
ALTER TABLE switches ADD COLUMN IF NOT EXISTS image_url TEXT;
|
|
ALTER TABLE switches ADD COLUMN IF NOT EXISTS product_page_url TEXT;
|
|
|
|
-- FLEXOPTIX product page URLs (strip :variant suffix)
|
|
UPDATE transceivers
|
|
SET product_page_url = 'https://www.flexoptix.net/en/' ||
|
|
LOWER(REPLACE(REPLACE(
|
|
CASE
|
|
WHEN part_number LIKE '%:%' THEN SPLIT_PART(part_number, ':', 1)
|
|
ELSE part_number
|
|
END,
|
|
'.', '-'), ' ', '-')) || '.html'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'FLEXOPTIX')
|
|
AND part_number IS NOT NULL
|
|
AND product_page_url IS NULL;
|
|
|
|
-- 10Gtek product page URLs
|
|
UPDATE transceivers
|
|
SET product_page_url = 'https://www.10gtek.com/transceiver'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = '10Gtek')
|
|
AND product_page_url IS NULL;
|
|
|
|
-- Fluxlight product page URLs (pattern: fluxlight.com/{PART_NUMBER}-FL/)
|
|
UPDATE transceivers
|
|
SET product_page_url = 'https://fluxlight.com/' || REPLACE(COALESCE(part_number, slug), ' ', '-') || '/'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Fluxlight')
|
|
AND part_number IS NOT NULL
|
|
AND product_page_url IS NULL;
|
|
|
|
-- GBICS product page URLs
|
|
UPDATE transceivers
|
|
SET product_page_url = 'https://gbics.com/compatible-transceivers/'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'GBICS')
|
|
AND product_page_url IS NULL;
|
|
|
|
-- SFPcables product page URLs
|
|
UPDATE transceivers
|
|
SET product_page_url = 'https://www.sfpcables.com/'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'SFPcables')
|
|
AND product_page_url IS NULL;
|
|
|
|
-- Juniper Networks product page URLs (generic Juniper optics page)
|
|
UPDATE transceivers
|
|
SET product_page_url = 'https://www.juniper.net/us/en/products/pluggable-optics.html'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Juniper Networks')
|
|
AND product_page_url IS NULL;
|
|
|
|
-- Switch vendor product page URLs
|
|
UPDATE switches SET product_page_url = 'https://www.cisco.com/site/us/en/products/networking/switches/index.html'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Cisco') AND product_page_url IS NULL;
|
|
|
|
UPDATE switches SET product_page_url = 'https://www.arista.com/en/products/switches'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Arista Networks') AND product_page_url IS NULL;
|
|
|
|
UPDATE switches SET product_page_url = 'https://www.juniper.net/us/en/products/switches.html'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Juniper Networks') AND product_page_url IS NULL;
|
|
|
|
UPDATE switches SET product_page_url = 'https://www.nvidia.com/en-us/networking/ethernet-switching/'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'NVIDIA') AND product_page_url IS NULL;
|
|
|
|
UPDATE switches SET product_page_url = 'https://www.edgecore.com/products'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Edgecore') AND product_page_url IS NULL;
|
|
|
|
UPDATE switches SET product_page_url = 'https://www.celestica.com/open-networking-switches'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Celestica') AND product_page_url IS NULL;
|
|
|
|
UPDATE switches SET product_page_url = 'https://www.asterfusion.com/products/'
|
|
WHERE vendor_id = (SELECT id FROM vendors WHERE name = 'Asterfusion') AND product_page_url IS NULL;
|
|
|
|
-- Summary
|
|
SELECT 'Transceivers with product_page_url' as metric, COUNT(*) as count FROM transceivers WHERE product_page_url IS NOT NULL
|
|
UNION ALL
|
|
SELECT 'Transceivers with image_url', COUNT(*) FROM transceivers WHERE image_url IS NOT NULL
|
|
UNION ALL
|
|
SELECT 'Switches with product_page_url', COUNT(*) FROM switches WHERE product_page_url IS NOT NULL;
|