Arx 0.4.3: app renamed to Arx, first-open help (installer window + website), colours
fc0cb1f verified Download app/renderer/report.js from Devseis/Arx: direct link, hf CLI and curl.
- Browser
- Download file 7.82 kB
-
https://huggingface.co/spaces/Devseis/Arx/resolve/main/app/renderer/report.js
- Command line
-
hf download hf://spaces/Devseis/Arx/app/renderer/report.js
-
curl -L -o report.js https://huggingface.co/spaces/Devseis/Arx/resolve/main/app/renderer/report.js
7.82 kB
| // Builds the self-contained HTML report that the main process prints to PDF. | |
| import { SECTION_TITLES } from './auditor-core.js'; | |
| const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); | |
| const STATUS_COLOR = { Compliant: '#1a7f37', 'Non-Compliant': '#c4242f', NotApplicable: '#6e7781', Pending: '#9a6700', Error: '#8250df' }; | |
| const RISK_COLOR = { High: '#c4242f', Medium: '#bc4c00', Low: '#9a6700', Unknown: '#8250df', None: '#6e7781' }; | |
| const badge = (text, color) => `<span class="badge" style="color:${color};border-color:${color}">${esc(text)}</span>`; | |
| export function buildReportHtml({ evidence, findings, summary, ai, sha256, model, sources }) { | |
| const host = evidence.host; | |
| const started = evidence.audit.started_at.replace('T', ' ').slice(0, 19); | |
| const counts = evidence.summary; | |
| const phone = evidence.source.kind === 'web' || ['ios', 'android'].includes(host.os_family); | |
| const EVIDENCE_LABEL = { detected: 'detected', 'self-reported': 'self-reported' }; | |
| const sectionHtml = ['baseline', 'gdpr', 'aiact', 'org'].map(sectionId => { | |
| const rows = evidence.results.filter(r => r.section === sectionId).map(r => { | |
| const f = findings[r.id]; | |
| let detail = ''; | |
| if (f && r.status !== 'Compliant' && r.status !== 'NotApplicable') { | |
| detail = `<tr class="detail"><td colspan="4"> | |
| <p>${esc(f.finding)}</p> | |
| <p><b>Risk:</b> ${badge(f.risk.level, RISK_COLOR[f.risk.level] || '#6e7781')} ${esc(f.risk.reason)}</p> | |
| ${f.recommendation.length ? `<p><b>What to do:</b></p><ol>${f.recommendation.map(s => `<li>${esc(s)}</li>`).join('')}</ol>` : ''} | |
| ${f.verification ? `<p><b>How to verify:</b> ${esc(f.verification)}</p>` : ''} | |
| <p class="refs">${f.references.map(esc).join(' · ')}</p> | |
| </td></tr>`; | |
| } | |
| const source = r.evidence ? `<br><span class="muted">${esc(EVIDENCE_LABEL[r.evidence])}</span>` : ''; | |
| return `<tr><td>${esc(r.name)}${source}</td><td>${badge(r.status, STATUS_COLOR[r.status])}</td><td>${esc(r.actual)}</td><td>${esc(r.expected)}</td></tr>${detail}`; | |
| }).join(''); | |
| return `<h2>${esc(SECTION_TITLES[sectionId])}</h2> | |
| <table><thead><tr><th style="width:30%">Check</th><th style="width:14%">Status</th><th>Found</th><th style="width:20%">Required</th></tr></thead><tbody>${rows}</tbody></table>`; | |
| }).join(''); | |
| const aiHtml = ai ? `<h2>AI TOOLS FOUND — EU AI ACT CLASSIFICATION</h2> | |
| <p>${esc(ai.summary)}</p> | |
| <table><thead><tr><th>Tool</th><th>Approved</th><th>Default risk class</th><th>GDPR</th><th>Action</th></tr></thead><tbody> | |
| ${ai.tools.map(t => `<tr><td><b>${esc(t.tool)}</b><br><span class="muted">${esc(t.kind)}</span></td><td>${t.approved ? 'Yes' : 'No'}</td> | |
| <td>${esc(t.default_risk_class)}<br><span class="muted">High-risk if: ${esc(t.becomes_high_risk_if.join('; '))}</span></td> | |
| <td>${esc(t.gdpr)}</td><td>${esc(t.action)}</td></tr>`).join('')} | |
| </tbody></table><p class="muted">${esc(ai.log_retention)} The purpose of use was not stated; the classification must be confirmed for each actual use.</p>` : ''; | |
| return `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Arx audit — ${esc(host.hostname)}</title> | |
| <style> | |
| body { font: 10.5pt/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #16181d; margin: 0; } | |
| .cover { border-top: 6px solid #ED2939; padding: 18px 0 10px; margin-bottom: 14px; } | |
| h1 { font-size: 22pt; margin: 0 0 4px; } h2 { font-size: 12.5pt; margin: 22px 0 8px; color: #00A1DE; letter-spacing: .03em; page-break-after: avoid; } | |
| .meta { display: grid; grid-template-columns: 150px 1fr; gap: 2px 12px; font-size: 10pt; margin: 10px 0; } | |
| .meta b { color: #5b6270; font-weight: 600; } | |
| .score { display: flex; gap: 18px; align-items: center; background: #f5f6f9; border-radius: 8px; padding: 12px 16px; margin: 12px 0; } | |
| .score .big { font-size: 30pt; font-weight: 800; } | |
| .badge { display: inline-block; border: 1px solid; border-radius: 10px; padding: 0 7px; font-size: 8.5pt; font-weight: 700; white-space: nowrap; } | |
| table { width: 100%; border-collapse: collapse; font-size: 9pt; page-break-inside: auto; } | |
| th { text-align: left; background: #f5f6f9; padding: 5px 6px; font-size: 8.5pt; text-transform: uppercase; color: #5b6270; } | |
| td { padding: 5px 6px; border-bottom: 1px solid #e2e5eb; vertical-align: top; word-break: break-word; } | |
| tr { page-break-inside: avoid; } | |
| tr.detail td { background: #fbfbfd; border-left: 3px solid #ED2939; } | |
| tr.detail p { margin: 3px 0; } tr.detail ol { margin: 2px 0 4px 18px; padding: 0; } | |
| .refs, .muted { color: #5b6270; font-size: 8.5pt; } | |
| .gaps li { margin: 3px 0; } | |
| .note { border-left: 3px solid #00A1DE; background: #f5f6f9; padding: 8px 12px; font-size: 9pt; margin-top: 18px; } | |
| .foot { font-size: 8pt; color: #5b6270; margin-top: 18px; word-break: break-all; } | |
| </style></head><body> | |
| <div class="cover"> | |
| <div class="muted">DEVSEIS ENDPOINT AUDIT · READ-ONLY</div> | |
| <h1>${esc(host.hostname)}</h1> | |
| <div class="meta"> | |
| <b>Operating system</b><span>${esc(host.os_name)} ${esc(host.os_version)}${host.build ? ` (build ${esc(host.build)})` : ''}</span> | |
| ${phone ? `<b>Device</b><span>${esc(host.device_model || '')}</span> | |
| <b>Browser</b><span>${esc(host.browser || '')}</span>` : `<b>Serial number</b><span>${esc(host.serial_number || '')}</span>`} | |
| <b>Audit date</b><span>${esc(started)}</span> | |
| ${phone ? `<b>Checked by</b><span>Phone self-check in the browser: ${evidence.results.filter(r => r.evidence === 'detected').length} results detected, ${evidence.results.filter(r => r.evidence === 'self-reported').length} self-reported</span>` | |
| : `<b>Run as</b><span>${esc(evidence.audit.execution_user)}${evidence.audit.is_admin ? ' (administrator)' : ' (not administrator — some checks could not be read)'}</span>`} | |
| </div> | |
| <div class="score"><div class="big">${summary.score.percent}%</div> | |
| <div>${summary.score.compliant} of ${summary.score.assessed} assessed checks compliant<br> | |
| ${Object.entries(counts).map(([k, v]) => `${badge(`${v} ${k}`, STATUS_COLOR[k])}`).join(' ')}</div></div> | |
| </div> | |
| <h2>EXECUTIVE SUMMARY</h2> | |
| <p>${esc(summary.summary)}</p> | |
| ${summary.next_steps.length ? `<p><b>Next steps</b></p><ol>${summary.next_steps.map(s => `<li>${esc(s)}</li>`).join('')}</ol>` : ''} | |
| ${summary.top_gaps.length ? `<h2>TOP GAPS</h2><ul class="gaps">${summary.top_gaps.map(g => | |
| `<li>${badge(g.risk, RISK_COLOR[g.risk])} <b>${esc(g.name)}</b> — ${esc(g.found)}</li>`).join('')}</ul>` : ''} | |
| ${sectionHtml} | |
| ${aiHtml} | |
| <div class="note">${phone | |
| ? `This report records what the browser detected on this phone and the answers given by its user at the audit date, and compares them with the | |
| Devseis baseline. Results marked self-reported were not verified on the device; a browser cannot read a phone's security settings. | |
| It supports ISO 27001 internal audits, GDPR Article 32 and EU AI Act deployer duties; it is not a certification and not legal advice.` | |
| : `This report records the settings found on this computer at the audit date and compares them with the | |
| Devseis baseline. It supports ISO 27001 internal audits, GDPR Article 32 and EU AI Act deployer duties; it is not a | |
| certification and not legal advice. Organisational controls reflect the answers given in organisational.conf.`}</div> | |
| <div class="foot">Evidence SHA-256: ${esc(sha256)}<br> | |
| Findings written by: ${esc(model || 'built-in report writer')} (${sources.model} by the AI model, ${sources.template} by the built-in writer)<br> | |
| ${phone ? 'Phone self-check' : 'Collector'} ${esc(evidence.source.collector)} ${esc(evidence.source.collector_version)} · catalog ${esc(evidence.catalog_version)}</div> | |
| </body></html>`; | |
| } | |