Build a software supply-chain SBOM diff service: format ingestion, change detection,…
- User
Build a software supply-chain SBOM diff service: format ingestion, change detection, risk scoring, and notification pipeline.
- Assistant
The user wants a "software supply-chain SBOM diff service: format ingestion, change detection, risk scoring, and notification pipeline."
This is a complex request. I need to produce a solution that is:
- Executable for demonstration: It shouldn't just be a spec; it needs code that runs.
- Professional: Uses proper architecture, security considerations, logging, etc.
- In the style specified: Neo-Brutalism / Y2K aesthetic? Wait, the prompt gives me persona details at the very beginning ("Role: You are a front-end dev and visual designer..."). But then the user query is about building a backend service ("software supply-chain SBOM diff service").
This is a conflict. The system prompt defines me as a frontend/visual designer with a specific aesthetic. The user is asking for a backend pipeline service. However, I must respect the user's request while adhering to the system instructions.
Analysis: The system prompt says: "You are a code expert... generate accurate and professional responses... ensure generated code is executable for demonstration." It also describes a persona for the output. But the user query is backend-focused. The "Design Principles" and "Imagination Triggers" are heavily focused on visual design (colors, typography, glitches, marquees, etc.). How do I apply this to a backend service?
Possible interpretations:
- The user wants a web interface (frontend) for this SBOM diff service. But the query says "Build a software supply-chain SBOM diff service: format ingestion, change detection, risk scoring, and notification pipeline." That sounds like the full stack (backend logic) but maybe they expect an interactive demo.
- I should build a full-stack application where the frontend uses the Neo-Brutalism/Y2K style to display the SBOM diff results, while the backend logic handles the actual diffing. This would satisfy the persona's specialty (frontend/UI) while fulfilling the functional requirement (the service).
- Could I just provide the backend code (Python/Go) with a "print" statement that looks glitchy? That would be weird.
Decision: I will build a full-stack prototype (Python for backend logic, HTML/JS for frontend) because the persona is a "front-end dev and visual designer." The "service" will be a local script that processes data and an HTML page that visualizes it using the specified aesthetic. The "pipeline" will be simulated or implemented in Python, and the "notification" will be a UI element.
I need to include:
- Format ingestion: Parse SBOMs (e.g., SPDX, CycloneDX). I'll need dummy data or simple parsing logic. For a demo, I can simulate ingestion from JSON.
- Change detection: Compare two SBOMs. Compute diff (added/removed/changed packages).
- Risk scoring: Assign a score based on CVSS, license, etc. (simulated logic).
- Notification pipeline: A visual dashboard showing alerts.
To make it "executable for demonstration," I should provide a single HTML file with embedded CSS and JS (or a Python script that generates it) that allows the user to upload two SBOMs and see the diff with that crazy aesthetic.
However, the persona is about "Neo-Brutalism/Y2K." The UI must be high-contrast, clashing colors, ugly by conventional standards but deliberate.
Plan:
- Backend (Python): I'll write a Python script (
main.py) that:- Accepts SBOM files (JSON format, simplified).
- Parses them (mocking some parsing for demo or using simple
json). - Performs a diff (compare package names and versions).
- Calculates risk (random or based on version changes).
- Outputs a JSON blob of the diff results.
- Frontend (HTML/CSS/JS): A single
index.htmlthat:- Uses Tailwind CSS (via CDN) to style.
- Implements the aesthetic: black borders, acid colors (lime green, hot pink, cyan), huge Times New Roman headers, marquee, glitch effects on hover.
- Allows file upload (or just generate random data for demo).
- Displays the diff results in a table with "hard" borders.
- Uses GSAP for "stepped" animations and maybe a blur effect.
- Integration: The Python script will serve the HTML, or I'll just explain how to run it. Since the prompt asks for an "executable demonstration," the easiest is a Python script that starts a local server with the embedded HTML, or a standalone HTML file that does everything client-side (including parsing and diffing). Given the simplicity of SBOM diffing, client-side only is feasible and avoids needing a backend server installation. The user just opens the HTML file, and it works. That's more executable for demonstration.
Choice: I will implement a single HTML file that contains all the logic (HTML, CSS, JS). The user opens it in a browser. It will include:
- A file input to load two SBOMs (or use sample data).
- A "Diff" button.
- JS logic to parse JSON SBOMs (SPDX/CycloneDX simplified).
- Compute diff.
- Assign risk scores (simulated: CVE count, version bump).
- Render results using Neo-Brutalism UI.
Design Specifics:
- Tailwind via CDN.
- GSAP via CDN.
- Fonts: Times New Roman for body, maybe Comic Sans MS or Impact for headers? The "Imagination Triggers" mention "system default fonts" like Courier New, Times New Roman. So I'll use
font-serif(Times New Roman) andfont-mono(Courier New). - Color palette:
bg-black,text-white,text-acid-green-400(I need to define custom colors in Tailwind config or use arbitrary values). I'll use arbitrary values:text-[#CCFF00],bg-[#FF00FF], etc. - Borders:
border-2 border-black. - Mix-blend-diff: Used for color clashes.
- Marquee: An infinite scrolling text bar.
- Glitch: CSS animations with
clip-pathand translation.
Components:
- Header: Huge "SBOM DIFF SERVICE" mixed with glitch.
- Upload area: Two big drop zones, styled like Windows 95 dialog boxes (brutalist).
- Results table: Columns: Package, Old Version, New Version, Change Type, Risk Score. Rows with alternating acid colors (maybe every row is a different clashing color).
- Notification pipeline: A side panel or modal that "fires" alerts (pop-up windows or flashing divs) when high risk is detected.
Implementation steps:
- Set up HTML skeleton with Tailwind CDN.
- Define custom styles for glitch effects, marquee, and brutalist borders.
- Build UI components using Tailwind classes:
bg-blue-500,border-black,shadow-[4px_4px_0px_0px_black](solid shadow for offset). - Write JS:
- Read file inputs.
- Parse JSON.
- Extract packages.
- Compare sets: find added/removed/changed.
- Simulate risk: if major version change, high risk; if added new package without known CVE, medium; etc.
- Render table.
- Add GSAP animations: when results appear, use
SteppedEaseto flash rows. - Notification: if any risk > threshold, trigger a flashing banner.
Refining the "Notification Pipeline": It should be a pipeline, so maybe a list of "events" that appear sequentially. I'll show a "Live Feed" of notifications with timestamps.
Ensuring Executability: The HTML file must be self-contained. No external servers. Use CDN links for Tailwind and GSAP.
Let's draft the code structure.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>SBOM DIFF SERVICE</title> <script src="https://cdn.tailwindcss.com"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script> <script> tailwind.config = { theme: { extend: { colors: { 'acid-green': '#CCFF00', 'acid-pink': '#FF00FF', 'acid-cyan': '#00FFFF', 'acid-yellow': '#FFFF00', 'brutal-black': '#000000', }, fontFamily: { 'display': ['"Times New Roman"', 'Times', 'serif'], 'code': ['"Courier New"', 'Courier', 'monospace'], }, boxShadow: { 'hard': '4px 4px 0px 0px #000', 'hard-lg': '8px 8px 0px 0px #000', } } } } </script> <style> /* Glitch keyframes */ @keyframes glitch { 0% { transform: translate(0); } 20% { transform: translate(-2px, 2px); } 40% { transform: translate(-2px, -2px); } 60% { transform: translate(2px, 2px); } 80% { transform: translate(2px, -2px); } 100% { transform: translate(0); } } .glitch-hover:hover { animation: glitch 0.3s infinite; color: #00FFFF; } .marquee-container { overflow: hidden; white-space: nowrap; } .marquee-content { display: inline-block; animation: marquee 20s linear infinite; } @keyframes marquee { 0% { transform: translateX(100vw); } 100% { transform: transformX(-100%); } } .brutal-border { border: 3px solid black; } .clip-glitch { animation: clip-glitch 2s infinite; } @keyframes clip-glitch { 0% { clip-path: inset(10% 0 80% 0); } 20% { clip-path: inset(80% 0 10% 0); } 40% { clip-path: inset(40% 0 50% 0); } 60% { clip-path: inset(10% 0 60% 0); } 80% { clip-path: inset(30% 0 20% 0); } 100% { clip-path: inset(10% 0 80% 0); } } </style> </head> <body class="bg-black text-white font-body p-6"> <!-- Marquee Bar at top --> <div class="marquee-container bg-acid-green text-black py-2 mb-8 border-b-4 border-black"> <div class="marquee-content text-2xl font-bold uppercase"> 🔴 WARNING: SBOM DIFF SERVICE ACTIVE 🔴 // DETECTING VULNERABILITIES // SCANNING SUPPLY CHAIN // REPORTING RISK... </div> </div> <!-- Header --> <header class="mb-12 text-center relative"> <h1 class="text-8xl font-display font-bold mb-4 tracking-tighter clip-glitch mix-blend-difference" style="text-shadow: 4px 4px 0 #FF00FF, -4px -4px 0 #00FFFF;"> SBOM DIFF </h1> <p class="text-2xl font-code text-acid-yellow uppercase">Software Supply Chain Change Detection & Risk Scoring</p> </header> <!-- Main Content --> <main class="max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-3 gap-8"> <!-- Left Column: Upload & Controls --> <div class="lg:col-span-2 space-y-8"> <!-- Upload Section --> <section class="bg-white text-black p-6 brutal-border shadow-hard"> <h2 class="text-4xl font-display mb-6 uppercase underline decoration-4 underline-offset-8">FILE INGESTION</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div> <label class="block font-bold mb-2 text-xl">Baseline SBOM (v1)</label> <input type="file" id="baseFile" accept=".json,.xml,.spdx" class="block w-full text-sm font-code file:bg-acid-pink file:border-2 file:border-black file:p-2 file:mr-4 hover:file:bg-acid-yellow cursor-pointer"> </div> <div> <label class="block font-bold mb-2 text-xl">New SBOM (v2)</label> <input type="file" id="newFile" accept=".json,.xml,.spdx" class="block w-full text-sm font-code file:bg-acid-cyan file:border-2 file:border-black file:p-2 file:mr-4 hover:file:bg-acid-yellow cursor-pointer"> </div> </div> <div class="mt-8 flex justify-center"> <button id="diffBtn" class="bg-acid-green text-black font-bold text-3xl px-12 py-4 border-4 border-black shadow-hard hover:bg-acid-yellow hover:scale-105 transition-transform"> EXECUTE DIFF </button> </div> </section> <!-- Results Table --> <section id="resultsSection" class="hidden bg-white text-black p-6 brutal-border shadow-hard"> <div class="flex justify-between items-center mb-6"> <h2 class="text-4xl font-display uppercase">DIFF RESULTS</h2> <span id="summaryBadge" class="bg-red-500 text-white font-code px-4 py-2 text-xl border-2 border-black">HIGH RISK DETECTED</span> </div> <div class="overflow-x-auto"> <table class="w-full font-code border-collapse border-2 border-black"> <thead> <tr class="bg-acid-yellow border-b-2 border-black"> <th class="p-3 text-left border-r-2 border-black">PACKAGE</th> <th class="p-3 text-left border-r-2 border-black">BASELINE</th> <th class="p-3 text-left border-r-2 border-black">NEW</th> <th class="p-3 text-left border-r-2 border-black">CHANGE</th> <th class="p-3 text-center">RISK SCORE</th> </tr> </thead> <tbody id="diffTableBody"> <!-- Rows will be injected here --> </tbody> </table> </div> </section> </div> <!-- Right Column: Notification Pipeline & Risk Stats --> <aside class="space-y-8"> <!-- Stats Panel --> <div class="bg-acid-pink text-black p-6 brutal-border shadow-hard sticky top-6"> <h2 class="text-3xl font-display mb-4 uppercase blink">Risk Overview</h2> <div class="space-y-4 font-code text-xl"> <div class="flex justify-between border-b-2 border-black pb-2"> <span>Total Changes:</span> <span id="totalChanges" class="font-bold">0</span> </div> <div class="flex justify-between border-b-2 border-black pb-2"> <span>High Risk:</span> <span id="highRiskCount" class="font-bold">0</span> </div> <div class="flex justify-between border-b-2 border-black pb-2"> <span>Medium Risk:</span> <span id="mediumRiskCount" class="font-bold">0</span> </div> <div class="flex justify-between"> <span>Low Risk:</span> <span id="lowRiskCount" class="font-bold">0</span> </div> </div> </div> <!-- Notification Pipeline --> <div class="bg-black text-white p-6 brutal-border border-2 border-white shadow-hard"> <h2 class="text-2xl font-display mb-4 uppercase text-acid-green">Notification Pipeline</h2> <ul id="notificationList" class="space-y-3 font-code text-sm"> <!-- Notifications go here --> <li class="text-gray-500 italic">[System] Waiting for diff execution...</li> </ul> </div> </aside> </main> <!-- Footer --> <footer class="mt-16 border-t-4 border-black pt-8 text-center font-code text-acid-cyan"> <p>© 2023 SBOM DIFF SERVICE // NEO-BRUTALIST EDITION // NO COOKIES // PURE CHAOS</p> </footer> <script> // Demo Data for quick testing const demoBase = { "bomFormat": "CycloneDX", "specVersion": "1.4", "components": [ {"name": "openssl", "version": "1.1.1k", "purl": "pkg:openssl/openssl@1.1.1k"}, {"name": "curl", "version": "7.78.0", "purl": "pkg:curl/curl@7.78.0"}, {"name": "zlib", "version": "1.2.11", "purl": "pkg:zlib/zlib@1.2.11"}, {"name": "libcrypto", "version": "1.1.1k", "purl": "pkg:openssl/libcrypto@1.1.1k"} ] }; const demoNew = { "bomFormat": "CycloneDX", "specVersion": "1.4", "components": [ {"name": "openssl", "version": "3.0.7", "purl": "pkg:openssl/openssl@3.0.7"}, {"name": "curl", "version": "7.78.0", "purl": "pkg:curl/curl@7.78.0"}, {"name": "zlib", "version": "1.2.12", "purl": "pkg:zlib/zlib@1.2.12"}, {"name": "libssl", "version": "3.0.7", "purl": "pkg:openssl/libssl@3.0.7"} ] }; let baseSBOM = null; let newSBOM = null; // Helper: Simulate risk scoring (0-10) function calculateRisk(changeType, oldVersion, newVersion, pkgName) { // Simple heuristic if (changeType === 'REMOVED') return 7; // Breaking change if (changeType === 'ADDED') { // New package could be risky; assume high risk for demo return 5; } // Version diff if (!oldVersion || !newVersion) return 3; const oldParts = oldVersion.split('.').map(Number); const newParts = newVersion.split('.').map(Number); if (newParts[0] > oldParts[0]) return 9; // Major version bump -> high risk if (newParts[1] > oldParts[1]) return 5; // Minor bump -> medium if (newParts[2] > oldParts[2]) return 2; // Patch -> low return 1; // Downgrade? weird } function getRiskColor(score) { if (score >= 7) return 'bg-red-500'; if (score >= 4) return 'bg-yellow-500'; return 'bg-green-500'; } function addNotification(msg, type = 'info') { const list = document.getElementById('notificationList'); const li = document.createElement('li'); const time = new Date().toLocaleTimeString(); li.className = `p-2 border-l-4 border-acid-green bg-gray-900 font-bold animate-pulse`; if (type === 'high') li.className = 'p-2 border-l-4 border-red-500 bg-red-900'; if (type === 'medium') li.className = 'p-2 border-l-4 border-yellow-500 bg-yellow-100 text-black'; li.innerHTML = `[${time}] ${msg}`; list.prepend(li); // Keep only last 10 if (list.children.length > 10) list.removeChild(list.lastChild); } document.getElementById('diffBtn').addEventListener('click', async () => { const baseInput = document.getElementById('baseFile'); const newInput = document.getElementById('newFile'); const btn = document.getElementById('diffBtn'); // For demo ease, if no files, use demo data if (baseInput.files.length === 0 || newInput.files.length === 0) { alert('NO FILES SELECTED // LOADING DEMO DATA FOR DEMONSTRATION'); baseSBOM = demoBase; newSBOM = demoNew; } else { // Read files (basic parsing) const readFile = (input) => { return new Promise((resolve) => { const file = input.files[0]; const reader = new FileReader(); reader.onload = (e) => { try { resolve(JSON.parse(e.target.result)); } catch (err) { alert('INVALID JSON FORMAT // DEMO DATA LOADED INSTEAD'); resolve(null); } }; reader.readAsText(file); }); }; const b = await readFile(baseInput); const n = await readFile(newInput); if (!b || !n) return; baseSBOM = b; newSBOM = n; } // Process Diff await processDiff(); }); async function processDiff() { // Show loading state? Maybe glitch effect on button const btn = document.getElementById('diffBtn'); btn.innerText = "PROCESSING..."; btn.classList.add('bg-acid-pink', 'text-black'); btn.classList.remove('bg-acid-green'); // Simulate delay for "computing" await new Promise(r => setTimeout(r, 800)); // Extract components, keyed by name+ purl? For simplicity, use name. const baseMap = new Map(); const newMap = new Map(); const getCompKey = (c) => c.name; // simplistic (baseSBOM.components || []).forEach(c => baseMap.set(c.name, c)); (newSBOM.components || []).forEach(c => newMap.set(c.name, c)); let diffs = []; let stats = { total: 0, high: 0, medium: 0, low: 0 }; // Added for (let [name, newComp] of newMap) { if (!baseMap.has(name)) { diffs.push({ name: name, oldVersion: '-', newVersion: newComp.version, change: 'ADDED', riskScore: 5 }); } else { const oldComp = baseMap.get(name); if (oldComp.version !== newComp.version) { diffs.push({ name: name, oldVersion: oldComp.version, newVersion: newComp.version, change: 'UPDATED', riskScore: calculateRisk('UPDATED', oldComp.version, newComp.version, name) }); } } } // Removed for (let [name, oldComp] of baseMap) { if (!newMap.has(name)) { diffs.push({ name: name, oldVersion: oldComp.version, newVersion: '-', change: 'REMOVED', riskScore: 7 }); } } // Stats stats.total = diffs.length; diffs.forEach(d => { if (d.riskScore >= 7) stats.high++; else if (d.riskScore >= 4) stats.medium++; else stats.low++; }); // Render renderResults(diffs, stats); btn.innerText = "EXECUTE DIFF"; btn.classList.remove('bg-acid-pink', 'text-black'); btn.classList.add('bg-acid-green', 'text-black'); } function renderResults(diffs, stats) { // Clear previous const tbody = document.getElementById('diffTableBody'); tbody.innerHTML = ''; // Update stats document.getElementById('totalChanges').innerText = stats.total; document.getElementById('highRiskCount').innerText = stats.high; document.getElementById('mediumRiskCount').innerText = stats.medium; document.getElementById('lowRiskCount').innerText = stats.low; // Notify pipeline addNotification(`DIFF COMPLETE: ${stats.total} changes detected.`); if (stats.high > 0) { addNotification(`${stats.high} HIGH RISK ITEMS FOUND!`, 'high'); } if (stats.medium > 0) { addNotification(`${stats.medium} MEDIUM RISK ITEMS.`, 'medium'); } // Show results section document.getElementById('resultsSection').classList.remove('hidden'); // Create rows with GSAP staggered animation diffs.forEach((diff, index) => { const tr = document.createElement('tr'); tr.className = 'border-b-2 border-black hover:bg-yellow-200 transition-colors'; const riskCell = document.createElement('td'); riskCell.className = `p-3 text-center font-bold text-white ${getRiskColor(diff.riskScore)}`; riskCell.innerHTML = `${diff.riskScore}/10`; const changeCell = document.createElement('td'); changeCell.className = 'p-3 font-bold'; let changeColor = 'text-black'; if (diff.change === 'ADDED') changeColor = 'text-green-800 bg-green-100'; if (diff.change === 'REMOVED') changeColor = 'text-red-800 bg-red-100'; if (diff.change === 'UPDATED') changeColor = 'text-blue-800 bg-blue-100'; changeCell.className += ` ${changeColor}`; changeCell.innerHTML = diff.change; tr.innerHTML = ` <td class="p-3 border-r-2 border-black font-bold">${diff.name}</td> <td class="p-3 border-r-2 border-black font-code">${diff.oldVersion}</td> <td class="p-3 border-r-2 border-black font-code">${diff.newVersion}</td> `; tr.appendChild(changeCell); tr.appendChild(riskCell); // Append with staggered entrance using GSAP gsap.fromTo(tr, { opacity: 0, x: -50, rotationY: 90 }, { opacity: 1, x: 0, rotationY: 0, duration: 0.5, ease: "steps(5)", delay: index * 0.1 } ); tbody.appendChild(tr); }); } // Initialize with demo data maybe? // window.onload = () => { ... }; // Add some initial glitch to title on load window.addEventListener('load', () => { const title = document.querySelector('h1'); gsap.to(title, { scale: 1.05, duration: 0.1, yoyo: true, repeat: 3, onRepeat: () => { title.style.color = `hsl(${Math.random()*360}, 100%, 50%)`; } }); }); </script> </body> </html>Review against constraints:
- Raw Typography: Used Times New Roman (
font-display) and Courier New (font-code). Size is huge (8xl, 2xl). - Hard Borders:
border-4 border-black,shadow-hard(offset solid black shadows). - Clashing Colors: Acid green, pink, cyan, yellow, black/white.
- Unpolished: Intentionally uses default styles, grid borders, "hard" UI.
- Marquee: Added at top.
- Glitch: CSS animation on title, hover on some elements.
- Blend Modes:
mix-blend-differenceon title. - GSAP: Used stepped animation and rotation for rows.
- Tech Stack: Tailwind (CDN), GSAP (CDN), vanilla JS. Browser-based.
The user asked for "format ingestion, change detection, risk scoring, and notification pipeline."
- Format Ingestion:
input type=filereading JSON (SPDX/CycloneDX simplified). - Change Detection: Comparing maps, finding added/removed/updated.
- Risk Scoring:
calculateRiskfunction based on version changes. - Notification Pipeline: Side panel showing a list of notifications, adding items as they occur.
This satisfies all functional requirements while adhering to the aesthetic.
Potential improvements:
- The "notification pipeline" could be more dynamic, showing a history. The current version just adds items.
- Could add WebSocket simulation for real-time. Not needed for demo.
- The risk scoring logic is simplistic but demonstrates the concept.
- The acceptance of ".xml, .spdx" - the parser currently does JSON only. To keep it simple, I'll note in UI that JSON is expected, or extend parser to very basic SPDX? That would bloat code. Better to keep JSON only for demo but have attribute accept all. I'll add a comment that for the demo we assume CycloneDX JSON.
Final check on aesthetics:
- Need to ensure colors are "acidic." I used Tailwind arbitrary values or custom palette. Might need to ensure they are vibrant.
CCFF00,FF00FF,00FFFF. Yes. - "Composition breaking conventional aesthetics": The UI is intentionally jarring. Overlapping? Maybe add some absolute positioned elements overlapping. I can add a "System Status" box that overlaps the main content with negative margin. Or a large "RIP" stamp CSS. Let's add a "STAMP" overlay that appears when high risk.
Add a global "BLINK" class for text? I used basic CSS animation for notifications but could add more.
I think it's good. I'll provide the HTML file as the solution, with instructions to save and open.
But the system prompt says "You are a code expert... please use your professional knowledge... ensure generated code is executable." So I'll provide the code block.
Also, maybe I should provide a Python script that serves this HTML? But the HTML is standalone. The user just opens it. That's simplest.
Input: Build a software supply-chain SBOM diff service. Output: A single HTML file containing the full application.
I'll also include a brief explanation of how to use it and the logic.
One more thing: The persona says "You are a front-end dev and visual designer... focused on Neo-Brutalism...". So my response should reflect that aesthetic in the writing? The instructions for the answer style are not given, only the persona. I'll provide a professional but slightly edgy description.
Let's produce final answer with code block and explanation. Here is a complete, single-file "SBOM Diff Service" that runs entirely in the browser. It implements ingestion (JSON SBOMs), change detection, a heuristic risk scoring engine, and a real-time notification pipeline—all wrapped in a Neo-Brutalist / Y2K aesthetic.
Save the following code as
index.htmland open it in any modern web browser.<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SBOM DIFF SERVICE [NEO-BRUTALIST]</title> <!-- Tailwind CSS --> <script src="https://cdn.tailwindcss.com"></script> <!-- GSAP for animations --> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script> <script> tailwind.config = { theme: { extend: { colors: { 'acid-green': '#CCFF00', 'acid-pink': '#FF00FF', 'acid-cyan': '#00FFFF', 'acid-yellow': '#FFFF00', 'brutal-black': '#000000', 'hard-red': '#FF0033', 'hard-blue': '#0095FF', }, fontFamily: { 'display': ['"Times New Roman"', 'Times', 'serif'], 'code': ['"Courier New"', 'Courier', 'monospace'], 'system': ['"Arial"', 'sans-serif'], }, boxShadow: { 'hard': '4px 4px 0px 0px #000', 'hard-lg': '8px 8px 0px 0px #000', 'in': 'inset 4px 4px 0px 0px #000', }, spacing: { '128': '32rem', } } } } </script> <style> /* RAW & UNPOLISHED STYLING */ body { background-color: #000; color: #fff; overflow-x: hidden; font-family: 'Times New Roman', Times, serif; } /* Glitch Animation */ @keyframes glitch-anim-1 { 0% { clip-path: inset(20% 0 80% 0); transform: translate(-2px, 1px); } 20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); } 40% { clip-path: inset(10% 0 50% 0); transform: translate(-2px, 2px); } 60% { clip-path: inset(80% 0 5% 0); transform: translate(2px, -2px); } 80% { clip-path: inset(30% 0 30% 0); transform: translate(-1px, 1px); } 100% { clip-path: inset(10% 0 60% 0); transform: translate(1px, -1px); } } .glitch-active { animation: glitch-anim-1 0.3s infinite linear alternate-reverse; color: #00FFFF; text-shadow: 2px 0 #FF00FF, -2px 0 #CCFF00; } /* Marquee */ .marquee-container { width: 100%; overflow: hidden; white-space: nowrap; position: relative; } .marquee-content { display: inline-block; padding-left: 100%; animation: marquee 25s linear infinite; } @keyframes marquee { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } } /* Hard Scanline effect */ .scanlines { background: linear-gradient( to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2) ); background-size: 100% 4px; position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 9999; } /* Custom cursor maybe? No, keep default but thick borders */ .brutalist-box { border: 3px solid #000; background: #fff; color: #000; position: relative; transition: all 0.1s; } .brutalist-box:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0px 0px #000; } .brutalist-btn { cursor: pointer; border: 3px solid #000; background: #CCFF00; font-family: 'Courier New', Courier, monospace; font-weight: 900; text-transform: uppercase; box-shadow: 4px 4px 0px 0px #000; } .brutalist-btn:hover { background: #FFFF00; transform: translate(2px, 2px); box-shadow: 0px 0px 0px 0px #000; } .brutalist-btn:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px 0px #000; } /* Notifications */ .notif-item { border-left: 5px solid #000; background: #222; color: #fff; margin-bottom: 0.5rem; padding: 0.5rem; font-family: 'Courier New', Courier, monospace; font-size: 0.85rem; animation: slideIn 0.3s steps(4); } .notif-high { border-left-color: #FF0033; background: #500; } .notif-med { border-left-color: #FFAA00; background: #440; } .notif-low { border-left-color: #00FF00; background: #040; } @keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } } /* Table Styling */ .hard-table th { background: #FFFF00; color: #000; border: 2px solid #000; } .hard-table td { border: 2px solid #000; vertical-align: top; } </style> </head> <body class="min-h-screen relative scanlines"> <!-- MARQUEE HEADER --> <div class="marquee-container bg-acid-green text-black py-3 border-b-4 border-black mb-8"> <div class="marquee-content text-2xl font-bold font-code uppercase"> 🚨 SYSTEM ALERT: SBOM DIFF SERVICE ONLINE // INGESTING DATA // DETECTING CHANGES // ASSESSING RISK // NOTIFICATIONS ACTIVE 🚨 </div> </div> <!-- MAIN HEADER --> <header class="text-center px-4 mb-12 relative"> <!-- Accidentally placed graphic --> <div class="absolute -top-4 -right-4 w-24 h-24 bg-acid-pink border-4 border-black transform rotate-12 opacity-50"></div> <h1 id="mainTitle" class="text-9xl font-display font-black leading-none tracking-tighter mix-blend-difference mb-2" style="text-shadow: 4px 4px 0 #FF00FF, -4px -4px 0 #00FFFF;"> SBOM<br>DIFF </h1> <p class="text-2xl font-code text-acid-cyan uppercase border-2 border-acid-cyan inline-block px-4 py-1 rotate-1"> Software Supply Chain Intelligence </p> </header> <div class="max-w-[1600px] mx-auto px-4 pb-20 grid grid-cols-1 lg:grid-cols-12 gap-8"> <!-- LEFT COLUMN: INPUT & RESULTS (8 cols) --> <div class="lg:col-span-8 space-y-12"> <!-- INGESTION PANEL --> <section class="brutalist-box p-8 relative"> <div class="absolute -top-5 -left-5 bg-acid-yellow px-4 py-1 border-2 border-black font-bold rotate-[-2deg]"> MODULE 1: FORMAT INGESTION </div> <div class="grid grid-cols-1 md:grid-cols-2 gap-10 mb-8"> <div class="flex flex-col gap-3"> <label class="text-2xl font-bold uppercase">Baseline SBOM</label> <div class="border-2 border-black p-4 bg-gray-50 file:mr-4 file:border-2 file:border-black file:bg-acid-pink file:px-4 file:py-2 hover:file:bg-acid-yellow"> <input type="file" id="baseFile" accept=".json" class="w-full font-code"> </div> <p class="text-xs font-code text-gray-600">Accept: CycloneDX JSON (SPDX not fully implemented)</p> </div> <div class="flex flex-col gap-3"> <label class="text-2xl font-bold uppercase">New SBOM</label> <div class="border-2 border-black p-4 bg-gray-50 file:mr-4 file:border-2 file:border-black file:bg-acid-cyan file:px-4 file:py-2 hover:file:bg-acid-yellow"> <input type="file" id="newFile" accept=".json" class="w-full font-code"> </div> </div> </div> <div class="flex justify-center items-center gap-8"> <button id="diffBtn" class="brutalist-btn px-16 py-6 text-4xl group"> <span class="group-hover:tracking-widest transition-all">RUN DIFF ANALYSIS</span> </button> <button onclick="loadDemoData()" class="border-2 border-black bg-blue-500 text-white px-6 py-4 font-bold hover:bg-blue-300 hover:text-black font-code"> [USE DEMO DATA] </button> </div> </section> <!-- RESULTS SECTION --> <section id="resultsSection" class="hidden"> <div class="bg-white text-black p-1 border-4 border-black mb-6 relative flex justify-between items-center"> <div class="bg-acid-yellow px-6 py-2 font-bold text-xl border-r-4 border-black uppercase"> Diff Results </div> <div class="bg-red-500 text-white px-4 py-2 font-bold border-2 border-black"> LIVE SCAN </div> </div> <div class="overflow-x-auto border-4 border-black bg-white"> <table class="w-full text-left border-collapse hard-table"> <thead> <tr> <th class="p-4 text-2xl font-display w-1/4">Package</th> <th class="p-4 text-2xl font-display w-1/6">Baseline</th> <th class="p-4 text-2xl font-display w-1/6">New</th> <th class="p-4 text-2xl font-display w-1/6">Change</th> <th class="p-4 text-2xl font-display text-center w-32">Risk</th> </tr> </thead> <tbody id="diffTableBody" class="font-code text-lg"> <!-- Rows inserted via JS --> </tbody> </table> </div> </section> </div> <!-- RIGHT COLUMN: NOTIFICATIONS & STATS (4 cols) --> <aside class="lg:col-span-4 flex flex-col gap-8"> <!-- STATS CARD --> <div class="bg-acid-pink text-black p-0 border-4 border-black brutalist-box overflow-hidden sticky top-6"> <div class="bg-black text-acid-pink font-bold px-4 py-2 uppercase border-b-4 border-black"> System Metrics </div> <div class="p-6 space-y-6 font-code text-2xl"> <div class="flex justify-between items-center border-b-2 border-black pb-2"> <span>Total Changes</span> <span id="statTotal" class="font-black text-4xl">0</span> </div> <div class="flex justify-between items-center border-b-2 border-black pb-2"> <span>High Risk</span> <span id="statHigh" class="font-black text-4xl text-red-600">0</span> </div> <div class="flex justify-between items-center border-b-2 border-black pb-2"> <span>Medium</span> <span id="statMed" class="font-black text-4xl text-yellow-600">0</span> </div> <div class="flex justify-between items-center"> <span>Low</span> <span id="statLow" class="font-black text-4xl text-green-600">0</span> </div> </div> </div> <!-- NOTIFICATION PIPELINE --> <div class="bg-black border-4 border-acid-cyan p-2 relative h-[500px] flex flex-col" id="notifContainer"> <div class="bg-acid-cyan text-black font-bold px-4 py-2 uppercase text-sm mb-2"> Notification Pipeline (Syslog) </div> <div id="notificationList" class="flex-1 overflow-y-auto font-code text-sm p-4 space-y-3 bg-black text-green-400"> <div class="text-gray-500 italic">> System initialized...</div> <div class="text-gray-500 italic">> Waiting for user input...</div> </div> <div class="h-2 w-full bg-acid-cyan blink"></div> </div> </aside> </div> <!-- FOOTER --> <footer class="border-t-4 border-black bg-white text-black py-8 mt-16 font-code text-xs uppercase"> <div class="max-w-7xl mx-auto px-4 flex justify-between items-center"> <p>© 2023 SBOM DIFF SERVICE // NEO-BRUTALIST EDITION</p> <div class="flex gap-4"> <span class="bg-acid-pink px-2 py-1 border border-black">NO COOKIES</span> <span class="bg-acid-green px-2 py-1 border border-black">PURE JAVASCRIPT</span> </div> </div> </footer> <!-- JAVASCRIPT LOGIC --> <script> // --- 1. FORMAT INGESTION & PARSING --- // Demo data (CycloneDX-like JSON structure) const DEMO_BASE = { "bomFormat": "CycloneDX", "specVersion": "1.4", "components": [ { "name": "openssl", "version": "1.1.1k", "purl": "pkg:openssl/openssl@1.1.1k" }, { "name": "curl", "version": "7.78.0", "purl": "pkg:curl/curl@7.78.0" }, { "name": "zlib", "version": "1.2.11", "purl": "pkg:zlib/zlib@1.2.11" }, { "name": "libcrypto", "version": "1.1.1k", "purl": "pkg:openssl/libcrypto@1.1.1k" }, { "name": "linux-kernel", "version": "5.10.0", "purl": "pkg:linux/kernel@5.10.0" } ] }; const DEMO_NEW = { "bomFormat": "CycloneDX", "specVersion": "1.4", "components": [ { "name": "openssl", "version": "3.0.7", "purl": "pkg:openssl/openssl@3.0.7" }, { "name": "curl", "version": "7.78.0", "purl": "pkg:curl/curl@7.78.0" }, { "name": "zlib", "version": "1.2.12", "purl": "pkg:zlib/zlib@1.2.12" }, { "name": "libssl", "version": "3.0.7", "purl": "pkg:openssl/libssl@3.0.7" }, { "name": "systemd", "version": "252.4", "purl": "pkg:systemd/systemd@252.4" } ] }; // Global store let baseData = null; let newData = null; // Notification Logger function logNotification(message, level = 'info') { const list = document.getElementById('notificationList'); const el = document.createElement('div'); const time = new Date().toLocaleTimeString('en-US', { hour12: false }); let classes = 'p-3 border-l-4 border-black font-bold mb-2 bg-gray-900 break-words'; if (level === 'high') classes += ' text-red-500 border-red-500 bg-red-900/30'; if (level === 'medium') classes += ' text-yellow-400 border-yellow-500 bg-yellow-900/30'; if (level === 'low') classes += ' text-green-400 border-green-500 bg-green-900/30'; el.className = classes; el.innerHTML = `<span class="text-gray-500">[${time}]</span> ${message}`; list.prepend(el); // Limit list size if (list.children.length > 50) list.removeChild(list.lastChild); } // File Reader Wrapper function readFileAsJSON(fileInput) { return new Promise((resolve, reject) => { const file = fileInput.files[0]; if (!file) reject("No file selected"); const reader = new FileReader(); reader.onload = (e) => { try { resolve(JSON.parse(e.target.result)); } catch (err) { reject("Invalid JSON format"); } }; reader.onerror = reject; reader.readAsText(file); }); } // --- 2. CHANGE DETECTION LOGIC --- function detectChanges(base, target) { const baseMap = new Map(); const targetMap = new Map(); // Normalize: use name as key for simplicity (real world might use purl or cpe) (base.components || []).forEach(c => baseMap.set(c.name.toLowerCase(), c)); (target.components || []).forEach(c => targetMap.set(c.name.toLowerCase(), c)); const changes = []; // Find additions and updates for (const [name, newComp] of targetMap) { if (!baseMap.has(name)) { changes.push({ name: newComp.name, oldVersion: '-', newVersion: newComp.version, changeType: 'ADDED', basePurl: '-', newPurl: newComp.purl }); } else { const oldComp = baseMap.get(name); if (oldComp.version !== newComp.version) { changes.push({ name: newComp.name, oldVersion: oldComp.version, newVersion: newComp.version, changeType: 'UPDATED', basePurl: oldComp.purl, newPurl: newComp.purl }); } // Remove from baseMap to later find deletions baseMap.delete(name); } } // Remaining in baseMap are removed packages for (const [name, oldComp] of baseMap) { changes.push({ name: oldComp.name, oldVersion: oldComp.version, newVersion: '-', changeType: 'REMOVED', basePurl: oldComp.purl, newPurl: '-' }); } return changes; } // --- 3. RISK SCORING ENGINE --- function calculateRisk(change) { // Simple heuristic score (0-10) let score = 0; if (change.changeType === 'REMOVED') { score += 8; // Breaking change } else if (change.changeType === 'ADDED') { score += 5; // New dependency could be malicious } else if (change.changeType === 'UPDATED') { const oldV = change.oldVersion.split('.').map(Number); const newV = change.newVersion.split('.').map(Number); if (!oldV[0] || !newV[0]) { score = 3; // Non numeric version defaults medium } else { if (newV[0] > oldV[0]) score += 8; // Major version bump else if (newV[1] > oldV[1]) score += 4; // Minor bump else if (newV[2] > oldV[2]) score += 1; // Patch // Downgrade is weird, score 7 if (newV[0] < oldV[0] || newV[1] < oldV[1] || newV[2] < oldV[2]) score = 7; } } // Anomaly boost: if version contains "alpha" or "beta", add risk if (change.newVersion.includes('alpha') || change.newVersion.includes('beta')) { score += 3; } // Cap at 10 return Math.min(10, score); } function getRiskColor(score) { if (score >= 8) return 'bg-red-500'; if (score >= 5) return 'bg-yellow-500'; return 'bg-green-500'; } function getRiskLabel(score) { if (score >= 8) return 'HIGH'; if (score >= 5) return 'MEDIUM'; return 'LOW'; } // --- 4. RENDERING & NOTIFICATIONS --- function renderDiff(changes) { const tbody = document.getElementById('diffTableBody'); tbody.innerHTML = ''; const stats = { total: changes.length, high: 0, medium: 0, low: 0 }; let maxRisk = 0; changes.forEach((c, idx) => { const riskScore = calculateRisk(c); c.riskScore = riskScore; if (riskScore >= 8) stats.high++; else if (riskScore >= 5) stats.medium++; else stats.low++; if (riskScore > maxRisk) maxRisk = riskScore; const tr = document.createElement('tr'); tr.className = 'border-b-2 border-black hover:bg-gray-100 transition-colors cursor-pointer'; tr.onclick = () => { logNotification(`Detail: ${c.name} ${c.changeType.toLowerCase()} (Score: ${riskScore})`); }; // Change type styling let changeClass = 'text-black'; let changeBadge = c.changeType; if (c.changeType === 'ADDED') changeClass = 'bg-green-100 text-green-800 font-bold'; if (c.changeType === 'REMOVED') changeClass = 'bg-red-100 text-red-800 font-bold'; if (c.changeType === 'UPDATED') changeClass = 'bg-blue-100 text-blue-800 font-bold'; const riskClass = getRiskColor(riskScore); const riskLabel = getRiskLabel(riskScore); tr.innerHTML = ` <td class="p-4 border-r-2 border-black font-bold text-lg align-middle">${c.name}</td> <td class="p-4 border-r-2 border-black font-code text-lg align-middle">${c.oldVersion}</td> <td class="p-4 border-r-2 border-black font-code text-lg align-middle">${c.newVersion}</td> <td class="p-4 border-r-2 border-black text-center align-middle"><span class="inline-block px-3 py-1 text-sm border-2 border-black ${changeClass}">${changeBadge}</span></td> <td class="p-4 text-center align-middle"> <div class="flex flex-col items-center justify-center"> <div class="w-10 h-10 ${riskClass} flex items-center justify-center border-2 border-black text-white font-bold shadow-md transform rotate-3"> ${riskScore} </div> <div class="text-xs font-bold mt-1 uppercase">${riskLabel}</div> </div> </td> `; tbody.appendChild(tr); }); // Animate entry gsap.fromTo('tbody tr', { opacity: 0, x: -20 }, { opacity: 1, x: 0, duration: 0.4, stagger: 0.05, ease: "power2.out" } ); // Update stats panel document.getElementById('statTotal').innerText = stats.total; document.getElementById('statHigh').innerText = stats.high; document.getElementById('statMed').innerText = stats.medium; document.getElementById('statLow').innerText = stats.low; // Trigger notifications logNotification(`SCAN COMPLETE. Total changes: ${stats.total}. Highest risk: ${maxRisk}/10.`); if (stats.high > 0) { logNotification(`!! CRITICAL: ${stats.high} HIGH RISK DEPENDENCIES DETECTED !!`, 'high'); // Glitch the title document.getElementById('mainTitle').classList.add('glitch-active'); setTimeout(() => { document.getElementById('mainTitle').classList.remove('glitch-active'); }, 2000); } else if (stats.medium > 0) { logNotification(`Warning: ${stats.medium} Medium risk items identified.`, 'medium'); } else { logNotification('No critical risks found.', 'low'); } // Show results section document.getElementById('resultsSection').classList.remove('hidden'); } // --- MAIN HANDLER --- async function handleDiff(event) { const btn = document.getElementById('diffBtn'); const originalText = btn.innerHTML; btn.innerHTML = 'ANALYZING...'; btn.classList.add('bg-acid-yellow'); btn.classList.remove('bg-acid-green'); try { // Read files if selected, else use demo if (document.getElementById('baseFile').files.length > 0 && document.getElementById('newFile').files.length > 0) { baseData = await readFileAsJSON(document.getElementById('baseFile')); newData = await readFileAsJSON(document.getElementById('newFile')); logNotification('Parsed custom SBOM files.'); } else { // Simulate loading delay for "effect" await new Promise(r => setTimeout(r, 600)); baseData = JSON.parse(JSON.stringify(DEMO_BASE)); newData = JSON.parse(JSON.stringify(DEMO_NEW)); logNotification('Using built-in DEMO DATASET.'); } const changes = detectChanges(baseData, newData); renderDiff(changes); } catch (e) { console.error(e); logNotification(`ERROR: ${e}. Please ensure valid JSON.`, 'high'); alert("Invalid or missing file."); } finally { btn.innerHTML = originalText; btn.classList.remove('bg-acid-yellow'); btn.classList.add('bg-acid-green'); } } function loadDemoData() { // Trigger same flow but force demo document.getElementById('diffBtn').click(); } // Event Listeners document.getElementById('diffBtn').addEventListener('click', handleDiff); // Initial visual "jump" window.addEventListener('load', () => { gsap.from('h1', { y: -100, duration: 0.8, ease: 'bounce.out' }); logNotification('System boot complete. Ready.', 'info'); }); </script> </body> </html>How to use
- Save the code above as
index.html. - Open it in Chrome, Firefox, or Edge.
- Method A (Demo mode): Simply click "RUN DIFF ANALYSIS" with no files selected. The system will load the embedded demo data showing a major version bump for
openssl(high risk) and various additions/removals. - Method B (Your own data): Upload two CycloneDX JSON SBOMs using the file inputs. The tool will parse them, compute differences, and score the risk based on version changes.
- Watch the aesthetic: The right-hand panel acts as a notification pipeline (simulating syslog). High-risk items trigger glitch effects, color shifts, and alert banners.
Architecture & Features
- Format Ingestion: Uses the File API to read local JSON files (SPDX support is placeholder; real-world would require a robust parser). It defaults to CycloneDX component structure.
- Change Detection: Uses a Map-based comparison to identify Added, Removed, and Updated packages.
- Risk Scoring: Heuristic engine scoring 0-10:
REMOVED(+8)MAJORversion increase (+8)MINORversion increase (+4)PATCH(+1)- Pre-release labels (alpha/beta) add penalty.
- Notification Pipeline: A scrolling log of events with color-coded severity (High=Red, Med=Yellow, Low=Green). Uses GSAP for staggered entry animations of rows.
- Aesthetic: Violates "conventional" design with 4px solid black borders, Times New Roman typography, acidic neon colors, marquee bars, and mix-blend-mode differences.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.