EU Parliament Monitor โ€” API Documentation - v0.8.4
    Preparing search index...

    Hack23 Logo

    ๐Ÿ”„ EU Parliament Monitor โ€” Flowcharts

    Process & Data Flow Documentation for European Parliament Intelligence
    ๐Ÿ“ˆ Security Flows โ€ข ๐Ÿ”„ CI/CD Pipeline โ€ข ๐Ÿ“Š Data Processing

    Owner Version Effective Date Review Cycle

    ๐Ÿ“‹ Document Owner: CEO | ๐Ÿ“„ Version: 1.1 | ๐Ÿ“… Last Updated: 2026-03-19 (UTC)
    ๐Ÿ”„ Review Cycle: Quarterly | โฐ Next Review: 2026-06-19


    Document Focus Description Documentation Link
    Architecture ๐Ÿ›๏ธ Architecture C4 model showing current system structure View Source
    Future Architecture ๐Ÿ›๏ธ Architecture C4 model showing future system structure View Source
    Mindmaps ๐Ÿง  Concept Current system component relationships View Source
    Future Mindmaps ๐Ÿง  Concept Future capability evolution View Source
    SWOT Analysis ๐Ÿ’ผ Business Current strategic assessment View Source
    Future SWOT Analysis ๐Ÿ’ผ Business Future strategic opportunities View Source
    Data Model ๐Ÿ“Š Data Current data structures and relationships View Source
    Future Data Model ๐Ÿ“Š Data Enhanced European Parliament data architecture View Source
    Flowcharts ๐Ÿ”„ Process Current data processing workflows View Source
    Future Flowcharts ๐Ÿ”„ Process Enhanced AI-driven workflows View Source
    State Diagrams ๐Ÿ”„ Behavior Current system state transitions View Source
    Future State Diagrams ๐Ÿ”„ Behavior Enhanced adaptive state transitions View Source
    Security Architecture ๐Ÿ›ก๏ธ Security Current security implementation View Source
    Future Security Architecture ๐Ÿ›ก๏ธ Security Security enhancement roadmap View Source
    Threat Model ๐ŸŽฏ Security STRIDE threat analysis View Source
    Classification ๐Ÿท๏ธ Governance CIA classification & BCP View Source
    CRA Assessment ๐Ÿ›ก๏ธ Compliance Cyber Resilience Act View Source
    Workflows โš™๏ธ DevOps CI/CD documentation View Source
    Future Workflows ๐Ÿš€ DevOps Planned CI/CD enhancements View Source
    Business Continuity Plan ๐Ÿ”„ Resilience Recovery planning View Source
    Financial Security Plan ๐Ÿ’ฐ Financial Cost & security analysis View Source
    End-of-Life Strategy ๐Ÿ“ฆ Lifecycle Technology EOL planning View Source
    Unit Test Plan ๐Ÿงช Testing Unit testing strategy View Source
    E2E Test Plan ๐Ÿ” Testing End-to-end testing View Source
    Performance Testing โšก Performance Performance benchmarks View Source
    Security Policy ๐Ÿ”’ Security Vulnerability reporting & security policy View Source

    This document provides detailed process flow diagrams showing security controls, data flows, and decision points in the EU Parliament Monitor platform.


    This document aligns with Hack23's Information Security Management System (ISMS) policies and ISO 27001:2022 controls. All flowcharts demonstrate implementation of security controls required by these policies.

    ISMS Policy ISO 27001 Control Document Section Description
    Information Security Policy A.5.1 All sections Overarching security governance framework
    Secure Development Policy A.8.25, A.8.28 News Generation Security Flow, CI/CD Security Pipeline Secure coding practices, input validation, code review
    Access Control Policy A.5.15, A.5.18 MCP Client Connection Security Flow Authentication, authorization, least privilege
    Vulnerability Management Policy A.8.8 Vulnerability Management Workflow Vulnerability scanning, remediation, patch management
    Incident Response Policy A.5.24, A.5.25, A.5.26 Incident Response Flow Detection, response, recovery, post-incident review
    Change Management Policy A.8.32 CI/CD Security Pipeline, Release Workflow Controlled deployments, testing, approval gates
    Cryptography Policy A.8.24 Content Delivery Security Flow, Deployment Security Flow TLS 1.3, HTTPS-only, cryptographic signatures
    1. Defense in Depth: Multiple security layers (validation, sanitization, encoding, CSP)
    2. Least Privilege: Minimal permissions for GitHub Actions, MCP connections
    3. Secure by Default: HTTPS-only, CSP enforcement, input validation at every stage
    4. Fail Secure: Fallback content on validation failures, graceful degradation
    5. Separation of Duties: Automated checks, required approvals, independent verification
    6. Continuous Monitoring: Dependabot, CodeQL, npm audit, health checks
    7. Incident Response: Defined severity levels, escalation paths, post-mortem reviews
    8. Supply Chain Security: SBOM generation, SLSA attestations, dependency scanning
    • ISO 27001:2022: Controls A.5.1, A.5.15, A.5.18, A.5.24, A.5.25, A.5.26, A.8.8, A.8.24, A.8.25, A.8.28, A.8.32
    • NIST CSF 2.0: Identify (ID.RA, ID.SC), Protect (PR.AC, PR.DS, PR.IP), Detect (DE.CM), Respond (RS.AN, RS.MI), Recover (RC.RP)
    • CIS Controls v8.1: Controls 1, 4, 6, 8, 10, 16, 18
    • GDPR: Article 25 (Data protection by design), Article 32 (Security of processing)
    • NIS2 Directive: Risk management, incident handling, supply chain security
    • EU Cyber Resilience Act: Secure by default, vulnerability disclosure, security updates

    flowchart TD
    Start[๐Ÿš€ GitHub Actions Trigger<br/>Schedule: 06:00 UTC<br/>Manual: workflow_dispatch] --> CheckMCP{๐Ÿ”Œ MCP Server<br/>Available?}

    CheckMCP -->|โœ… Yes| ConnectMCP[๐Ÿ”— Connect to EP MCP Server<br/>stdio/localhost]
    CheckMCP -->|โŒ No| Fallback[โš ๏ธ Use Placeholder Content<br/>Log Error]

    ConnectMCP --> RetryCheck{๐Ÿ”„ Connection<br/>Successful?}
    RetryCheck -->|โŒ No| RetryCount{Retry < 3?}
    RetryCount -->|โœ… Yes| BackoffWait[โณ Wait 30s<br/>Between Retries]
    BackoffWait --> ConnectMCP
    RetryCount -->|โŒ No| Fallback

    RetryCheck -->|โœ… Yes| FetchData[๐Ÿ“ฅ Fetch Parliamentary Data<br/>Plenary Sessions<br/>Committee Meetings<br/>Documents, Voting Records]

    FetchData --> ValidateSchema{โœ… Validate<br/>JSON Schema?}
    ValidateSchema -->|โŒ Invalid| LogError1[๐Ÿ“ Log Validation Error<br/>Error Type<br/>Field Name] --> Fallback
    ValidateSchema -->|โœ… Valid| ValidateType{โœ… Type Check<br/>Data Types?}

    ValidateType -->|โŒ Invalid| LogError2[๐Ÿ“ Log Type Error<br/>Expected vs Actual] --> Fallback
    ValidateType -->|โœ… Valid| ValidateRange{โœ… Range Check<br/>Dates, Lengths?}

    ValidateRange -->|โŒ Invalid| LogError3[๐Ÿ“ Log Range Error<br/>Out of Bounds] --> Fallback
    ValidateRange -->|โœ… Valid| SanitizeHTML[๐Ÿงน Sanitize HTML<br/>Strip Script Tags<br/>Remove Event Handlers]

    Fallback --> AgentContext
    SanitizeHTML --> EncodeHTML[๐Ÿ”’ HTML Entity Encoding<br/>Convert: &lt; &gt; &amp; &quot; &#39;]

    EncodeHTML --> AgentContext[๐Ÿค– Copilot/LLM Agent<br/>Receives Article Type Context<br/>5 Types: week-ahead, motions,<br/>propositions, committee-reports,<br/>breaking-news]

    AgentContext --> GenerateEN[๐Ÿ“ Generate English Content<br/>Agent Calls MCP Tools<br/>Plenary, Committees,<br/>Documents, Voting Records]

    GenerateEN --> Translate[๐ŸŒ Translate Content<br/>English โ†’ 13 Languages<br/>14 Total Languages]

    Translate --> GenHTML[๐Ÿ“„ generateArticleHTML()<br/>Per Language<br/>SEO, JSON-LD, Open Graph]

    GenHTML --> HTMLValidate[โœ… Validate HTML<br/>htmlhint Rules<br/>Standards Compliance]

    HTMLValidate -->|โŒ Fail| FixHTML[๐Ÿ”ง Fix HTML Issues<br/>Auto-correct<br/>Report Issues]
    FixHTML --> HTMLValidate

    HTMLValidate -->|โœ… Pass| GenerateIndex[๐Ÿ“‹ Generate Language Indexes<br/>index-{lang}.html<br/>Sort by Date]

    GenerateIndex --> GenerateSitemap[๐Ÿ—บ๏ธ Generate Sitemap<br/>sitemap.xml<br/>SEO Optimization]

    GenerateSitemap --> CreateBranch[๐ŸŒฟ Create Branch<br/>news/{type}-{date}]

    CreateBranch --> CommitPR[๐Ÿ“ฆ Commit & Create PR<br/>Article HTML Files<br/>Updated Indexes & Sitemap]

    CommitPR --> MergePR[๐Ÿ”€ Merge PR to Main]

    MergePR --> DeployPages[๐Ÿš€ Deploy to GitHub Pages<br/>Updated Static Site]

    DeployPages --> Complete[โœ… Generation Complete<br/>Articles Published<br/>Site Updated]
    Complete --> End[๐ŸŽ‰ Workflow Success]

    style Start fill:#e8f5e9
    style CheckMCP fill:#fff4e1
    style ConnectMCP fill:#e1f5ff
    style Fallback fill:#ffe1e1
    style ValidateSchema fill:#e1f5ff
    style ValidateType fill:#e1f5ff
    style ValidateRange fill:#e1f5ff
    style SanitizeHTML fill:#e8f5e9
    style EncodeHTML fill:#e8f5e9
    style AgentContext fill:#e1f5ff
    style GenerateEN fill:#e8f5e9
    style Translate fill:#e8f5e9
    style GenHTML fill:#e8f5e9
    style HTMLValidate fill:#e1f5ff
    style CreateBranch fill:#e1f5ff
    style CommitPR fill:#e8f5e9
    style MergePR fill:#e8f5e9
    style DeployPages fill:#d4edda
    style Complete fill:#d4edda
    style End fill:#d4edda

    flowchart TD
    Input[๐Ÿ“ฅ External Input<br/>European Parliament API<br/>Untrusted Data] --> Layer1{๐Ÿ›ก๏ธ Layer 1<br/>Schema Validation}

    Layer1 -->|โŒ Invalid Structure| Reject1[โŒ Reject Input<br/>Log: Invalid JSON<br/>Use Fallback]
    Layer1 -->|โœ… Valid Structure| Layer2{๐Ÿ›ก๏ธ Layer 2<br/>Type Validation}

    Layer2 -->|โŒ Wrong Types| Reject2[โŒ Reject Input<br/>Log: Type Mismatch<br/>Use Fallback]
    Layer2 -->|โœ… Correct Types| Layer3{๐Ÿ›ก๏ธ Layer 3<br/>Range Validation}

    Layer3 -->|โŒ Out of Bounds| Reject3[โŒ Reject Input<br/>Log: Range Error<br/>Use Fallback]
    Layer3 -->|โœ… Within Bounds| Layer4{๐Ÿ›ก๏ธ Layer 4<br/>Content Sanitization}

    Layer4 --> StripScript[๐Ÿงน Strip Script Tags<br/>Remove: &lt;script&gt;<br/>Remove: &lt;iframe&gt;<br/>Remove: &lt;object&gt;]
    StripScript --> RemoveEvents[๐Ÿงน Remove Event Handlers<br/>Remove: onclick<br/>Remove: onerror<br/>Remove: onload]
    RemoveEvents --> ValidateURLs[๐Ÿ” Validate URLs<br/>Check Protocol<br/>Sanitize Path]

    ValidateURLs --> Layer5{๐Ÿ›ก๏ธ Layer 5<br/>HTML Encoding}

    Layer5 --> EncodeSpecial[๐Ÿ”’ Encode Special Chars<br/>&lt; โ†’ &amp;lt;<br/>&gt; โ†’ &amp;gt;<br/>&amp; โ†’ &amp;amp;<br/>&quot; โ†’ &amp;quot;<br/>&#39; โ†’ &amp;#39;]

    EncodeSpecial --> Layer6{๐Ÿ›ก๏ธ Layer 6<br/>CSP Compliance}

    Layer6 --> CheckCSP[โœ… Check CSP Headers<br/>No Inline Scripts<br/>No Eval()<br/>No External Scripts]

    CheckCSP -->|โŒ Violation| Reject4[โŒ Block Content<br/>Log: CSP Violation<br/>Return Error]
    CheckCSP -->|โœ… Compliant| SafeOutput[โœ… Safe Output<br/>Validated<br/>Sanitized<br/>Encoded]

    Reject1 --> FallbackContent[โš ๏ธ Fallback Content<br/>Placeholder Articles<br/>Safe Default]
    Reject2 --> FallbackContent
    Reject3 --> FallbackContent
    Reject4 --> FallbackContent

    SafeOutput --> DeliverContent[๐Ÿ“ค Deliver to Template<br/>Generate HTML<br/>Serve to Users]
    FallbackContent --> DeliverContent

    style Input fill:#fff4e1
    style Layer1 fill:#e1f5ff
    style Layer2 fill:#e1f5ff
    style Layer3 fill:#e1f5ff
    style Layer4 fill:#e8f5e9
    style Layer5 fill:#e8f5e9
    style Layer6 fill:#e8f5e9
    style Reject1 fill:#ffe1e1
    style Reject2 fill:#ffe1e1
    style Reject3 fill:#ffe1e1
    style Reject4 fill:#ffe1e1
    style SafeOutput fill:#d4edda
    style FallbackContent fill:#fff3cd
    style DeliverContent fill:#d4edda

    flowchart TD
    Trigger[๐Ÿ”” Git Event<br/>Push to PR<br/>Merge to Main] --> Checkout[๐Ÿ“ฅ Checkout Code<br/>SHA-Pinned Action<br/>actions/checkout@v4]

    Checkout --> SetupNode[โš™๏ธ Setup Node.js 25<br/>SHA-Pinned Action<br/>actions/setup-node@v6]

    SetupNode --> InstallDeps[๐Ÿ“ฆ Install Dependencies<br/>npm ci<br/>Reproducible Build<br/>package-lock.json]

    InstallDeps --> SecurityAudit{๐Ÿ” npm audit<br/>Vulnerabilities?}

    SecurityAudit -->|โŒ Moderate+| AuditFail[โŒ Security Audit Failed<br/>Block PR Merge<br/>Create Issue]
    SecurityAudit -->|โœ… None/Low| Lint[๐Ÿ” ESLint<br/>Security Rules<br/>Code Quality<br/>Complexity Check]

    Lint -->|โŒ Errors| LintFail[โŒ Lint Failed<br/>Block PR Merge<br/>Show Errors]
    Lint -->|โœ… Pass| Format[โœจ Prettier Check<br/>Code Formatting<br/>Consistency]

    Format -->|โŒ Not Formatted| FormatFail[โŒ Format Failed<br/>Run: npm run format<br/>Commit Changes]
    Format -->|โœ… Formatted| HTMLHint[๐Ÿ“„ HTMLHint<br/>HTML Validation<br/>Standards Compliance]

    HTMLHint -->|โŒ Errors| HTMLFail[โŒ HTML Failed<br/>Fix Issues<br/>Re-validate]
    HTMLHint -->|โœ… Pass| UnitTests[๐Ÿงช Unit Tests<br/>87 Tests<br/>Vitest]

    UnitTests -->|โŒ Fail| TestFail[โŒ Tests Failed<br/>Block PR Merge<br/>Debug Failures]
    UnitTests -->|โœ… Pass| IntegrationTests[๐Ÿ”— Integration Tests<br/>82 Tests<br/>MCP Client Tests]

    IntegrationTests -->|โŒ Fail| TestFail
    IntegrationTests -->|โœ… Pass| Coverage{๐Ÿ“Š Code Coverage<br/>&gt; 80% Lines?<br/>&gt; 75% Branches?}

    Coverage -->|โŒ Below Threshold| CoverageFail[โŒ Coverage Failed<br/>Add Tests<br/>Meet Threshold]
    Coverage -->|โœ… Above Threshold| CodeQL[๐Ÿ”’ CodeQL SAST<br/>Security Analysis<br/>Vulnerability Detection]

    CodeQL -->|โŒ Findings| CodeQLFail[โŒ CodeQL Failed<br/>Critical/High Issues<br/>Fix Vulnerabilities]
    CodeQL -->|โœ… Clean| BuildCheck[๐Ÿ—๏ธ Build Check<br/>News Generation<br/>Index Generation<br/>Sitemap Generation]

    BuildCheck -->|โŒ Fail| BuildFail[โŒ Build Failed<br/>Check Logs<br/>Fix Errors]
    BuildCheck -->|โœ… Pass| Approve[โœ… All Checks Passed<br/>Ready to Merge<br/>Deploy on Merge]

    AuditFail --> End[โŒ Pipeline Failed]
    LintFail --> End
    FormatFail --> End
    HTMLFail --> End
    TestFail --> End
    CoverageFail --> End
    CodeQLFail --> End
    BuildFail --> End
    Approve --> End[โœ… Pipeline Success]

    style Trigger fill:#e8f5e9
    style SecurityAudit fill:#ffe1e1
    style Lint fill:#e1f5ff
    style Format fill:#e1f5ff
    style HTMLHint fill:#e1f5ff
    style UnitTests fill:#e8f5e9
    style IntegrationTests fill:#e8f5e9
    style Coverage fill:#e1f5ff
    style CodeQL fill:#ffe1e1
    style BuildCheck fill:#e8f5e9
    style Approve fill:#d4edda
    style End fill:#d4edda
    style AuditFail fill:#ffe1e1
    style LintFail fill:#ffe1e1
    style TestFail fill:#ffe1e1
    style CodeQLFail fill:#ffe1e1

    flowchart TD
    Start[๐Ÿš€ Initialize MCP Client<br/>Connection Parameters<br/>Retry Config] --> CheckEnv{๐Ÿ” Check Environment<br/>USE_EP_MCP?}

    CheckEnv -->|โŒ Disabled| DisabledMode[โš ๏ธ MCP Disabled<br/>Skip Connection<br/>Use Fallback]
    CheckEnv -->|โœ… Enabled| AttemptCount{๐Ÿ”„ Attempt Count<br/>< Max Attempts?}

    AttemptCount -->|โŒ Exceeded| MaxRetries[โŒ Max Retries Reached<br/>Log Error<br/>Use Fallback]
    AttemptCount -->|โœ… Within Limit| SpawnProcess[โš™๏ธ Spawn MCP Process<br/>npx european-parliament-mcp-server<br/>stdio: pipe]

    SpawnProcess --> WaitConnection[โณ Wait for Ready<br/>Startup Delay: 500ms<br/>Monitor stderr]

    WaitConnection --> ConnectionCheck{โœ… Connection<br/>Established?}

    ConnectionCheck -->|โŒ Timeout| IncrementRetry[๐Ÿ”„ Increment Counter<br/>Calculate Backoff<br/>2^n seconds]
    IncrementRetry --> BackoffWait[โณ Exponential Backoff<br/>1s โ†’ 2s โ†’ 4s]
    BackoffWait --> AttemptCount

    ConnectionCheck -->|โŒ Process Error| ProcessError[โŒ Process Failed<br/>Log stderr<br/>Kill Process]
    ProcessError --> IncrementRetry

    ConnectionCheck -->|โœ… Connected| SendHandshake[๐Ÿค Send Initialize Request<br/>JSON-RPC 2.0<br/>List Available Tools]

    SendHandshake --> HandshakeCheck{โœ… Initialize<br/>Valid?}

    HandshakeCheck -->|โŒ Invalid| HandshakeFail[โŒ Initialize Failed<br/>Protocol Mismatch<br/>Close Connection]
    HandshakeFail --> IncrementRetry

    HandshakeCheck -->|โœ… Valid| Authenticated[โœ… Connection Ready<br/>Reset Retry Counter<br/>Log Success]

    Authenticated --> RequestLoop[๐Ÿ” Request Loop<br/>Send Requests<br/>60s Timeout Per Request]

    RequestLoop --> ValidateResponse{โœ… Validate<br/>Response?}

    ValidateResponse -->|โŒ Invalid| ResponseError[โŒ Invalid Response<br/>Log Error<br/>Retry Request]
    ResponseError --> RetryRequest{Retry < 3?}
    RetryRequest -->|โœ… Yes| RequestLoop
    RetryRequest -->|โŒ No| UseCached[โš ๏ธ Use Cached Data<br/>Or Fallback]

    ValidateResponse -->|โœ… Valid| ProcessData[โœ… Process Data<br/>Parse Response<br/>Extract Fields]

    DisabledMode --> End[๐ŸŽฏ Complete]
    MaxRetries --> End
    UseCached --> End
    ProcessData --> End

    style Start fill:#e8f5e9
    style CheckEnv fill:#fff4e1
    style AttemptCount fill:#e1f5ff
    style SpawnProcess fill:#e8f5e9
    style ConnectionCheck fill:#e1f5ff
    style HandshakeCheck fill:#e1f5ff
    style ValidateResponse fill:#e1f5ff
    style Authenticated fill:#d4edda
    style ProcessData fill:#d4edda
    style DisabledMode fill:#fff3cd
    style MaxRetries fill:#ffe1e1
    style ProcessError fill:#ffe1e1
    style HandshakeFail fill:#ffe1e1
    style ResponseError fill:#ffe1e1
    style End fill:#d4edda

    flowchart LR
    subgraph "User Browser"
    User[๐Ÿ‘ค User<br/>Browser Request]
    end

    subgraph "GitHub Pages"
    CDN[๐ŸŒ GitHub CDN<br/>TLS 1.3<br/>HTTPS Only]
    CACHE[๐Ÿ’พ Edge Cache<br/>Static Content<br/>Immutable]
    end

    subgraph "Security Headers"
    HSTS[๐Ÿ”’ HSTS<br/>max-age=31536000<br/>Force HTTPS]
    CSP[๐Ÿ›ก๏ธ CSP<br/>default-src 'self'<br/>No Inline Scripts]
    XCTO[๐Ÿ” X-Content-Type-Options<br/>nosniff]
    XFO[๐Ÿšซ X-Frame-Options<br/>DENY]
    end

    subgraph "Static Content"
    HTML[๐Ÿ“„ HTML<br/>Validated<br/>Sanitized]
    CSS[๐ŸŽจ CSS<br/>Inline Styles<br/>No External]
    end

    subgraph "Monitoring"
    LOGS[๐Ÿ“ Access Logs<br/>GitHub Analytics]
    METRICS[๐Ÿ“Š Metrics<br/>Requests<br/>Response Time]
    end

    User -->|HTTPS Request| CDN
    CDN -->|Check Cache| CACHE
    CACHE -->|Hit| Return
    CACHE -->|Miss| Fetch
    Fetch[Fetch from Origin] --> HTML
    HTML --> CSS
    CSS --> Apply_Headers

    Apply_Headers[Apply Security Headers] --> HSTS
    Apply_Headers --> CSP
    Apply_Headers --> XCTO
    Apply_Headers --> XFO

    HSTS --> Return[Return to User]
    CSP --> Return
    XCTO --> Return
    XFO --> Return

    CDN --> LOGS
    Return --> METRICS
    Return --> User

    style User fill:#e1f5ff
    style CDN fill:#f0f0f0
    style CACHE fill:#e8f5e9
    style HSTS fill:#ffe1e1
    style CSP fill:#ffe1e1
    style XCTO fill:#ffe1e1
    style XFO fill:#ffe1e1
    style HTML fill:#e8f5e9
    style CSS fill:#e8f5e9
    style Return fill:#d4edda

    flowchart TD
    Detection[๐Ÿ”” Incident Detection<br/>Security Alert<br/>Dependabot<br/>CodeQL<br/>User Report] --> Classify{๐Ÿ“Š Classify Severity<br/>CVSS Score<br/>Impact Assessment}

    Classify -->|P0 Critical| Critical[๐Ÿšจ P0: Critical<br/>Repository Compromise<br/>Malicious Content]
    Classify -->|P1 High| High[โš ๏ธ P1: High<br/>XSS Vulnerability<br/>Dependency Issue]
    Classify -->|P2 Medium| Medium[โ„น๏ธ P2: Medium<br/>Data Integrity<br/>Workflow Failure]
    Classify -->|P3 Low| Low[๐Ÿ“ P3: Low<br/>Documentation<br/>Non-Critical Bug]

    Critical --> ImmediateResponse[โšก Immediate Response<br/>Disable Workflows<br/>Revert Commits<br/>Notify Team]
    High --> UrgentResponse[๐Ÿ”ฅ Urgent Response<br/>Create Security Advisory<br/>Block PR Merges]
    Medium --> StandardResponse[๐Ÿ“‹ Standard Response<br/>Create Issue<br/>Schedule Fix]
    Low --> RoutineResponse[๐Ÿ“Œ Routine Response<br/>Add to Backlog<br/>Next Sprint]

    ImmediateResponse --> Contain[๐Ÿ”’ Containment<br/>Remove Malicious Content<br/>Isolate Compromised Code<br/>Revoke Tokens]
    UrgentResponse --> Contain
    StandardResponse --> Contain
    RoutineResponse --> Contain

    Contain --> Investigate[๐Ÿ” Investigation<br/>Review Git Logs<br/>Check Actions Logs<br/>Analyze CodeQL Findings]

    Investigate --> RootCause{๐ŸŽฏ Root Cause<br/>Identified?}

    RootCause -->|โŒ No| DeepDive[๐Ÿ”ฌ Deep Analysis<br/>Forensics<br/>External Review]
    DeepDive --> RootCause

    RootCause -->|โœ… Yes| Remediate[๐Ÿ”ง Remediation<br/>Apply Patches<br/>Update Dependencies<br/>Fix Vulnerabilities]

    Remediate --> Test[๐Ÿงช Testing<br/>Unit Tests<br/>Integration Tests<br/>Security Scans]

    Test -->|โŒ Fail| FixIssues[๐Ÿ› ๏ธ Fix Issues<br/>Debug<br/>Re-apply Fixes]
    FixIssues --> Remediate

    Test -->|โœ… Pass| Deploy[๐Ÿš€ Deploy Fix<br/>Merge PR<br/>GitHub Actions<br/>Update Documentation]

    Deploy --> Verify[โœ… Verification<br/>Monitor Metrics<br/>Check Logs<br/>Confirm Resolution]

    Verify -->|โŒ Not Resolved| Escalate[โฌ†๏ธ Escalate<br/>Senior Review<br/>External Help]
    Escalate --> Investigate

    Verify -->|โœ… Resolved| Document[๐Ÿ“ Documentation<br/>Incident Report<br/>Lessons Learned<br/>Update Threat Model]

    Document --> Communicate[๐Ÿ“ข Communication<br/>Security Advisory<br/>CHANGELOG.md<br/>Close Issue]

    Communicate --> PostMortem[๐Ÿ”„ Post-Mortem<br/>Team Review<br/>Process Improvements<br/>Update Procedures]

    PostMortem --> Complete[โœ… Incident Closed<br/>Controls Updated<br/>Metrics Recorded]

    style Detection fill:#fff4e1
    style Critical fill:#ffe1e1
    style High fill:#fff3cd
    style Medium fill:#e1f5ff
    style Low fill:#f0f0f0
    style Contain fill:#e8f5e9
    style Remediate fill:#e8f5e9
    style Deploy fill:#e8f5e9
    style Complete fill:#d4edda

    This workflow implements ISO 27001:2022 Control A.8.8 (Management of Technical Vulnerabilities) with defined severity levels and SLA-based remediation timelines.

    flowchart TD
    Discovery[๐Ÿ” Vulnerability Discovery] --> Source{Discovery<br/>Source}

    Source -->|Dependabot| DepAlert[๐Ÿค– Dependabot Alert<br/>Dependencies<br/>GitHub Security]
    Source -->|CodeQL| CodeQLAlert[๐Ÿ”’ CodeQL Finding<br/>SAST Scanning<br/>Security Issue]
    Source -->|npm audit| AuditAlert[๐Ÿ“ฆ npm audit<br/>Package Vulnerabilities<br/>CVE Database]
    Source -->|Manual| ManualReport[๐Ÿ‘ค Manual Report<br/>Security Researcher<br/>User Report]

    DepAlert --> Assess
    CodeQLAlert --> Assess
    AuditAlert --> Assess
    ManualReport --> Assess

    Assess[๐Ÿ“Š Assessment Phase] --> CVSSScore{๐ŸŽฏ CVSS Score<br/>Calculation}

    CVSSScore --> Exploit{๐Ÿ”ฌ Exploitability<br/>Analysis}
    Exploit --> Impact{๐Ÿ’ฅ Impact<br/>Assessment}

    Impact --> Prioritize{โšก Prioritization}

    Prioritize -->|Critical 9.0-10.0| Critical[๐Ÿšจ P0: Critical<br/>SLA: 24 hours<br/>Remote Code Execution<br/>Data Breach Risk]
    Prioritize -->|High 7.0-8.9| High[โš ๏ธ P1: High<br/>SLA: 7 days<br/>Privilege Escalation<br/>XSS/CSRF]
    Prioritize -->|Medium 4.0-6.9| Medium[โ„น๏ธ P2: Medium<br/>SLA: 30 days<br/>Information Disclosure<br/>DoS]
    Prioritize -->|Low 0.1-3.9| Low[๐Ÿ“ P3: Low<br/>SLA: 90 days<br/>Minor Issues<br/>Low Impact]

    Critical --> EmergencyTeam[๐Ÿšจ Emergency Response<br/>Notify Security Team<br/>Disable Affected Feature]
    High --> UrgentAction[๐Ÿ”ฅ Urgent Action<br/>Create Security Advisory<br/>Block Deployments]
    Medium --> StandardTrack[๐Ÿ“‹ Standard Track<br/>Create Issue<br/>Schedule Sprint]
    Low --> BacklogAdd[๐Ÿ“Œ Backlog<br/>Log for Future<br/>Next Release]

    EmergencyTeam --> Remediation
    UrgentAction --> Remediation
    StandardTrack --> Remediation
    BacklogAdd --> Remediation

    Remediation[๐Ÿ”ง Remediation Strategy] --> Strategy{Strategy<br/>Selection}

    Strategy -->|Available| Patch[๐Ÿฉน Apply Patch<br/>Update Dependency<br/>Upgrade Version]
    Strategy -->|Not Available| Workaround[๐Ÿ”€ Implement Workaround<br/>Code Changes<br/>Configuration Update]
    Strategy -->|Not Feasible| Mitigate[๐Ÿ›ก๏ธ Mitigate Risk<br/>Additional Controls<br/>Monitoring]
    Strategy -->|False Positive| Accept[โœ… Accept Risk<br/>Document Rationale<br/>Security Exception]

    Patch --> Testing
    Workaround --> Testing
    Mitigate --> Testing
    Accept --> Document

    Testing[๐Ÿงช Verification Testing] --> UnitTest[โœ… Unit Tests<br/>169 Tests Pass]
    UnitTest --> IntegTest[๐Ÿ”— Integration Tests<br/>82 Tests Pass]
    IntegTest --> SecScan[๐Ÿ”’ Security Scan<br/>CodeQL Clean<br/>npm audit Clean]

    SecScan --> TestResult{Tests<br/>Pass?}
    TestResult -->|โŒ Fail| FixFailed[๐Ÿ› ๏ธ Fix Failed Tests<br/>Debug Issues<br/>Adjust Fix]
    FixFailed --> Remediation

    TestResult -->|โœ… Pass| Deploy[๐Ÿš€ Deploy Fix<br/>Merge PR<br/>Production Release]

    Deploy --> Verify[โœ… Post-Deploy Verification] --> Rescan{Vulnerability<br/>Resolved?}

    Rescan -->|โŒ Not Fixed| Escalate[โฌ†๏ธ Escalate<br/>Senior Security Review<br/>External Consultation]
    Escalate --> Remediation

    Rescan -->|โœ… Fixed| Document[๐Ÿ“ Documentation]

    Document --> UpdateAdvisory[๐Ÿ“„ Update Security Advisory<br/>CVE Details<br/>Remediation Steps]
    UpdateAdvisory --> UpdateCHANGELOG[๐Ÿ“‹ Update CHANGELOG.md<br/>Security Fix Entry<br/>Version Bump]
    UpdateCHANGELOG --> CloseIssue[๐Ÿ”’ Close Issue<br/>Link to Commit<br/>Verification Evidence]

    CloseIssue --> Metrics[๐Ÿ“Š Update Metrics<br/>MTTR Calculation<br/>Vulnerability Stats]

    Metrics --> Review[๐Ÿ”„ Post-Fix Review<br/>Lessons Learned<br/>Process Improvement]

    Review --> Complete[โœ… Vulnerability Closed<br/>Evidence Recorded<br/>Controls Updated]

    style Discovery fill:#fff4e1
    style Critical fill:#ffe1e1
    style High fill:#fff3cd
    style Medium fill:#e1f5ff
    style Low fill:#f0f0f0
    style Patch fill:#e8f5e9
    style Testing fill:#e1f5ff
    style Deploy fill:#e8f5e9
    style Complete fill:#d4edda
    style Accept fill:#fff3cd
    Phase Control SLA ISMS Reference
    Discovery Automated scanning (Dependabot, CodeQL, npm audit) Continuous ISO 27001 A.8.8
    Assessment CVSS scoring, exploitability analysis 24 hours NIST SP 800-30
    Prioritization Risk-based tiers with SLAs By severity ISO 27001 A.5.9
    Remediation Patch/workaround/mitigate/accept 24h-90d ISO 27001 A.8.8
    Verification Testing, scanning, deployment validation Before close ISO/IEC 27001:2013 A.14.2.8
    Documentation Advisories, CHANGELOG, evidence Required ISO/IEC 27001:2013 A.12.1.1
    Metrics MTTR, vulnerability stats tracking Monthly ISO/IEC 27001:2013 A.18.2.1

    Mean Time to Remediate (MTTR) Targets:

    • Critical (P0): 24 hours
    • High (P1): 7 days
    • Medium (P2): 30 days
    • Low (P3): 90 days

    This flow shows the end-to-end secure data pipeline from European Parliament APIs through the MCP server to static site generation, with comprehensive security controls at each stage.

    flowchart TD
    subgraph "European Parliament APIs"
    EPAPI[๐Ÿ›๏ธ EP Official APIs<br/>MEPs, Sessions<br/>Documents, Votes]
    end

    subgraph "MCP Server Layer"
    MCPServer[โš™๏ธ EP MCP Server<br/>TypeScript 5.7<br/>Node.js 25]
    MCPTransport[๐Ÿ“ก JSON-RPC 2.0<br/>stdio Transport<br/>Protocol v1.0]
    MCPCache[๐Ÿ’พ LRU Cache<br/>TTL: 5 min<br/>Max: 500 entries]
    end

    subgraph "Client Layer"
    MCPClient[๐Ÿ”Œ MCP Client<br/>Custom JSON-RPC over stdio<br/>src/mcp/ep-mcp-client.ts<br/>Planned: @modelcontextprotocol/sdk]
    SchemaVal[๐Ÿงช Planned: Schema Validation<br/>JSON Schema<br/>Type Checking]
    TypeCheck[๐Ÿ” Planned: Type Validation<br/>TypeScript Interfaces<br/>Runtime Checks]
    end

    subgraph "Sanitization Pipeline"
    HTMLSan[๐Ÿงน Planned: HTML Sanitizer<br/>DOMPurify<br/>Strip Scripts]
    XSSEncode[๐Ÿ”’ Planned: XSS Encoding<br/>HTML Entities<br/>&lt; &gt; &amp; &quot; &#39;]
    URLVal[๐Ÿ”— Planned: URL Validation<br/>HTTPS Only<br/>Domain Whitelist]
    LengthCheck[๐Ÿ“ Planned: Length Validation<br/>Max Lengths<br/>Truncation]
    end

    subgraph "Content Generation"
    Template[๐Ÿ“„ Template Engine<br/>14 Languages<br/>HTML5]
    CSPCheck[๐Ÿ›ก๏ธ CSP Compliance<br/>JSON-LD Allowed<br/>No eval()]
    HTMLVal[โœ… HTML Validation<br/>htmlhint<br/>Standards Check]
    end

    subgraph "Output Layer"
    StaticFiles[๐Ÿ“ฆ Static HTML<br/>index-{lang}.html<br/>CSS Inline]
    Sitemap[๐Ÿ—บ๏ธ Sitemap.xml<br/>SEO Optimized<br/>14 Languages]
    Deploy[๐Ÿš€ GitHub Pages<br/>Static Site Hosting<br/>GitHub Actions Deploy]
    end

    subgraph "Error Handling"
    FallbackData[โš ๏ธ Fallback Content<br/>Placeholder Articles<br/>Safe Defaults]
    ErrorLog[๐Ÿ“ Error Logging<br/>Structured Logs<br/>GitHub Actions]
    end

    EPAPI -->|HTTPS Request| MCPServer
    MCPServer --> MCPTransport
    MCPTransport --> MCPCache

    MCPCache -->|Cache Hit| ReturnCached[โœ… Return Cached<br/>Skip API Call]
    MCPCache -->|Cache Miss| FetchFresh[๐Ÿ“ฅ Fetch Fresh<br/>Call EP API]

    ReturnCached --> MCPClient
    FetchFresh --> MCPClient

    MCPClient --> SchemaVal
    SchemaVal -->|โŒ Invalid| ErrorLog
    SchemaVal -->|โœ… Valid| TypeCheck

    TypeCheck -->|โŒ Invalid| ErrorLog
    TypeCheck -->|โœ… Valid| HTMLSan

    ErrorLog --> FallbackData
    FallbackData --> Template

    HTMLSan --> XSSEncode
    XSSEncode --> URLVal
    URLVal --> LengthCheck

    LengthCheck --> Template

    Template --> CSPCheck
    CSPCheck -->|โŒ Violation| ErrorLog
    CSPCheck -->|โœ… Compliant| HTMLVal

    HTMLVal -->|โŒ Invalid| FixHTML[๐Ÿ”ง Auto-Fix HTML<br/>Correct Issues]
    FixHTML --> HTMLVal
    HTMLVal -->|โœ… Valid| StaticFiles

    StaticFiles --> Sitemap
    Sitemap --> Deploy

    Deploy --> CDN[๐ŸŒ GitHub CDN<br/>Edge Caching<br/>Global Distribution]

    style EPAPI fill:#e3f2fd
    style MCPServer fill:#f0f4c3
    style MCPClient fill:#c8e6c9
    style HTMLSan fill:#fff9c4
    style XSSEncode fill:#ffe1e1
    style Template fill:#e1f5ff
    style StaticFiles fill:#e8f5e9
    style Deploy fill:#c8e6c9
    style FallbackData fill:#fff3cd
    style ErrorLog fill:#ffcdd2
    style CDN fill:#d4edda
    Layer Control Purpose Implementation
    API Layer HTTPS-only communication Encryption in transit TLS 1.3, HTTPS-only, HSTS via CDN/hosting config
    MCP Server JSON-RPC 2.0 protocol Structured communication Standard protocol implementation
    Caching LRU cache with TTL Performance + resilience 5 min TTL, 500 entry max
    Schema Validation JSON Schema enforcement (future control) Data structure integrity Planned: Ajv validator (strict mode), not yet implemented in codebase
    Type Checking Runtime type validation (future control) Type safety beyond TypeScript Planned: io-ts runtime checks, not yet implemented in codebase
    HTML Sanitization Planned: DOMPurify scrubbing (future control) XSS prevention Not yet in codebase; current: HTML entity encoding via template
    XSS Encoding HTML entity encoding (future control) Output encoding Planned: template-level encoding for all user-controlled data, not yet implemented in codebase
    URL Validation HTTPS + whitelist (future control) Prevent malicious redirects Planned: HTTPS-only + europarl.europa.eu allowlist for article/source URLs, not yet implemented in codebase
    CSP Enforcement JSON-LD inline scripts allowed; no eval() XSS mitigation default-src 'self'; script-src allows type=application/ld+json
    HTML Validation Standards compliance Cross-browser compatibility htmlhint, W3C validation
    Fallback Content Graceful degradation Availability Placeholder articles
    Error Logging Structured logging Debugging + monitoring GitHub Actions logs

    This workflow illustrates the full CI/CD content generation and validation pipeline for European Parliament news in 14 languages (PR/test-and-report.yml and release.yml). The scheduled daily .github/workflows/news-generation.yml job only runs the generate-and-commit subset (no HTML/SEO/a11y validation loop).

    flowchart TD
    Start[๐Ÿš€ Content Generation<br/>CI/CD: PRs / Releases<br/>Daily 06:00 UTC (subset)] --> FetchData[๐Ÿ“ฅ Fetch Source Data<br/>EP MCP Server<br/>Validated JSON]

    FetchData --> LangDetect{โš™๏ธ Language Args &<br/>Preset Expansion}

    LangDetect --> EN[๐Ÿ‡ฌ๐Ÿ‡ง English<br/>index.html]
    LangDetect --> SV[๐Ÿ‡ธ๐Ÿ‡ช Swedish<br/>index-sv.html]
    LangDetect --> DA[๐Ÿ‡ฉ๐Ÿ‡ฐ Danish<br/>index-da.html]
    LangDetect --> NO[๐Ÿ‡ณ๐Ÿ‡ด Norwegian<br/>index-no.html]
    LangDetect --> FI[๐Ÿ‡ซ๐Ÿ‡ฎ Finnish<br/>index-fi.html]
    LangDetect --> DE[๐Ÿ‡ฉ๐Ÿ‡ช German<br/>index-de.html]
    LangDetect --> FR[๐Ÿ‡ซ๐Ÿ‡ท French<br/>index-fr.html]
    LangDetect --> ES[๐Ÿ‡ช๐Ÿ‡ธ Spanish<br/>index-es.html]
    LangDetect --> NL[๐Ÿ‡ณ๐Ÿ‡ฑ Dutch<br/>index-nl.html]
    LangDetect --> AR[๐Ÿ‡ธ๐Ÿ‡ฆ Arabic<br/>index-ar.html]
    LangDetect --> HE[๐Ÿ‡ฎ๐Ÿ‡ฑ Hebrew<br/>index-he.html]
    LangDetect --> JA[๐Ÿ‡ฏ๐Ÿ‡ต Japanese<br/>index-ja.html]
    LangDetect --> KO[๐Ÿ‡ฐ๐Ÿ‡ท Korean<br/>index-ko.html]
    LangDetect --> ZH[๐Ÿ‡จ๐Ÿ‡ณ Chinese<br/>index-zh.html]

    EN --> ENTemplate[๐Ÿ“„ EN Template<br/>HTML5 Structure<br/>Semantic Tags]
    SV --> SVTemplate[๐Ÿ“„ SV Template<br/>HTML5 Structure<br/>Semantic Tags]
    DA --> DATemplate[๐Ÿ“„ DA Template<br/>HTML5 Structure<br/>Semantic Tags]
    NO --> NOTemplate[๐Ÿ“„ NO Template<br/>HTML5 Structure<br/>Semantic Tags]
    FI --> FITemplate[๐Ÿ“„ FI Template<br/>HTML5 Structure<br/>Semantic Tags]
    DE --> DETemplate[๐Ÿ“„ DE Template<br/>HTML5 Structure<br/>Semantic Tags]
    FR --> FRTemplate[๐Ÿ“„ FR Template<br/>HTML5 Structure<br/>Semantic Tags]
    ES --> ESTemplate[๐Ÿ“„ ES Template<br/>HTML5 Structure<br/>Semantic Tags]
    NL --> NLTemplate[๐Ÿ“„ NL Template<br/>HTML5 Structure<br/>Semantic Tags]
    AR --> ARTemplate[๐Ÿ“„ AR Template<br/>HTML5 Structure<br/>RTL Support]
    HE --> HETemplate[๐Ÿ“„ HE Template<br/>HTML5 Structure<br/>RTL Support]
    JA --> JATemplate[๐Ÿ“„ JA Template<br/>HTML5 Structure<br/>Semantic Tags]
    KO --> KOTemplate[๐Ÿ“„ KO Template<br/>HTML5 Structure<br/>Semantic Tags]
    ZH --> ZHTemplate[๐Ÿ“„ ZH Template<br/>HTML5 Structure<br/>Semantic Tags]

    ENTemplate --> ENSecCheck[๐Ÿ”’ EN Security<br/>Sanitize + Validate]
    SVTemplate --> SVSecCheck[๐Ÿ”’ SV Security<br/>Sanitize + Validate]
    DATemplate --> DASecCheck[๐Ÿ”’ DA Security<br/>Sanitize + Validate]
    NOTemplate --> NOSecCheck[๐Ÿ”’ NO Security<br/>Sanitize + Validate]
    FITemplate --> FISecCheck[๐Ÿ”’ FI Security<br/>Sanitize + Validate]
    DETemplate --> DESecCheck[๐Ÿ”’ DE Security<br/>Sanitize + Validate]
    FRTemplate --> FRSecCheck[๐Ÿ”’ FR Security<br/>Sanitize + Validate]
    ESTemplate --> ESSecCheck[๐Ÿ”’ ES Security<br/>Sanitize + Validate]
    NLTemplate --> NLSecCheck[๐Ÿ”’ NL Security<br/>Sanitize + Validate]
    ARTemplate --> ARSecCheck[๐Ÿ”’ AR Security<br/>Sanitize + Validate]
    HETemplate --> HESecCheck[๐Ÿ”’ HE Security<br/>Sanitize + Validate]
    JATemplate --> JASecCheck[๐Ÿ”’ JA Security<br/>Sanitize + Validate]
    KOTemplate --> KOSecCheck[๐Ÿ”’ KO Security<br/>Sanitize + Validate]
    ZHTemplate --> ZHSecCheck[๐Ÿ”’ ZH Security<br/>Sanitize + Validate]

    ENSecCheck --> Aggregate
    SVSecCheck --> Aggregate
    DASecCheck --> Aggregate
    NOSecCheck --> Aggregate
    FISecCheck --> Aggregate
    DESecCheck --> Aggregate
    FRSecCheck --> Aggregate
    ESSecCheck --> Aggregate
    NLSecCheck --> Aggregate
    ARSecCheck --> Aggregate
    HESecCheck --> Aggregate
    JASecCheck --> Aggregate
    KOSecCheck --> Aggregate
    ZHSecCheck --> Aggregate

    Aggregate[๐Ÿ“‹ Aggregate Results<br/>14 Language Indexes<br/>Collect Metadata] --> MainIndex[๐Ÿ  Generate Main Index<br/>index.html<br/>Language Selector]

    MainIndex --> Sitemap[๐Ÿ—บ๏ธ Generate Sitemap<br/>sitemap.xml<br/>All 14 Languages]

    Sitemap --> ValidateAll{โœ… Validate<br/>All Files?}

    ValidateAll -->|โŒ Validation Errors| ShowErrors[โŒ Show Errors<br/>htmlhint Output<br/>Line Numbers]
    ShowErrors --> FixErrors[๐Ÿ”ง Auto-Fix<br/>Common Issues<br/>Re-validate]
    FixErrors --> ValidateAll

    ValidateAll -->|โœ… All Valid| A11yCheck[โ™ฟ Accessibility Check<br/>WCAG 2.1 AA<br/>E2E Workflow Only]

    A11yCheck -->|โŒ A11y Issues| FixA11y[๐Ÿ”ง Fix A11y<br/>Add lang Attributes<br/>Alt Text]
    FixA11y --> A11yCheck

    A11yCheck -->|โœ… Compliant| SEOCheck[๐Ÿ“Š SEO Validation<br/>Meta Tags<br/>hreflang Links<br/>Release Workflow Only]

    SEOCheck --> Complete[โœ… Generation Complete<br/>14 Languages<br/>Ready to Deploy]

    style Start fill:#e3f2fd
    style LangDetect fill:#fff4e1
    style EN fill:#e8f5e9
    style FR fill:#e8f5e9
    style DE fill:#e8f5e9
    style ES fill:#e8f5e9
    style IT fill:#e8f5e9
    style PT fill:#e8f5e9
    style ENSecCheck fill:#ffe1e1
    style FRSecCheck fill:#ffe1e1
    style DESecCheck fill:#ffe1e1
    style ESSecCheck fill:#ffe1e1
    style ITSecCheck fill:#ffe1e1
    style PTSecCheck fill:#ffe1e1
    style Aggregate fill:#e1f5ff
    style MainIndex fill:#c8e6c9
    style Sitemap fill:#c8e6c9
    style Complete fill:#d4edda
    Control Applied to Purpose Standard
    HTML Sanitization All 14 languages XSS prevention OWASP ASVS 5.3
    HTML Entity Encoding All 14 languages Output encoding OWASP ASVS 5.2
    HTML Validation All 14 languages Standards compliance W3C HTML5
    Language Attributes All 14 languages Accessibility WCAG 2.1 AA 3.1.1
    hreflang Links All 14 languages SEO, crawling Google Guidelines
    CSP Headers All 14 languages Script execution control OWASP CSP
    Character Encoding All 14 languages UTF-8 declaration HTML5 Standard
    Text Direction Handling All 14 languages (LTR/RTL) Ensure correct text direction rendering HTML dir attribute / W3C HTML5

    Supported Languages:

    1. ๐Ÿ‡ฌ๐Ÿ‡ง English (en) - Primary
    2. ๐Ÿ‡ธ๐Ÿ‡ช Swedish (sv) - Nordic
    3. ๐Ÿ‡ฉ๐Ÿ‡ฐ Danish (da) - Nordic
    4. ๐Ÿ‡ณ๐Ÿ‡ด Norwegian (no) - Nordic
    5. ๐Ÿ‡ซ๐Ÿ‡ฎ Finnish (fi) - Nordic
    6. ๐Ÿ‡ฉ๐Ÿ‡ช German (de) - European
    7. ๐Ÿ‡ซ๐Ÿ‡ท French (fr) - European
    8. ๐Ÿ‡ช๐Ÿ‡ธ Spanish (es) - European
    9. ๐Ÿ‡ณ๐Ÿ‡ฑ Dutch (nl) - European
    10. ๐Ÿ‡ธ๐Ÿ‡ฆ Arabic (ar) - RTL
    11. ๐Ÿ‡ฎ๐Ÿ‡ฑ Hebrew (he) - RTL
    12. ๐Ÿ‡ฏ๐Ÿ‡ต Japanese (ja) - East Asian
    13. ๐Ÿ‡ฐ๐Ÿ‡ท Korean (ko) - East Asian
    14. ๐Ÿ‡จ๐Ÿ‡ณ Chinese (zh) - East Asian

    This flow shows the secure deployment pipeline from Git commit to GitHub Pages with comprehensive security gates, SBOM generation, and SLSA attestations. Note: linting, testing, and coverage gates apply to PR merges and release workflows; the daily news-generation workflow triggers GitHub Pages deployment directly after build.

    flowchart TD
    Commit[๐Ÿ’พ Git Commit<br/>Developer Push<br/>Feature Branch] --> SHAVerify[๐Ÿ” SHA Verification<br/>Git Integrity Check<br/>GPG Signature]

    SHAVerify --> GHActions[๐Ÿค– GitHub Actions<br/>Workflow Trigger<br/>ubuntu-latest]

    GHActions --> SecGates[๐Ÿ›ก๏ธ Security Gates<br/>PR & Release Workflows] --> Gate1{Gate 1:<br/>Linting}

    Gate1 -->|โŒ Fail| BlockDeploy1[๐Ÿšซ Block PR / Release<br/>ESLint Errors<br/>Fix Required]
    Gate1 -->|โœ… Pass| Gate2{Gate 2:<br/>Unit Tests}

    Gate2 -->|โŒ Fail| BlockDeploy2[๐Ÿšซ Block PR / Release<br/>169 Tests Failed<br/>Debug Required]
    Gate2 -->|โœ… Pass| Gate3{Gate 3:<br/>Integration Tests}

    Gate3 -->|โŒ Fail| BlockDeploy3[๐Ÿšซ Block PR / Release<br/>82 Tests Failed<br/>Fix Required]
    Gate3 -->|โœ… Pass| Gate4{Gate 4:<br/>Security Scan}

    Gate4 -->|โŒ Critical/High| BlockDeploy4[๐Ÿšซ Block PR / Release<br/>CodeQL Issues<br/>Vulnerability Fix]
    Gate4 -->|โœ… Pass| Gate5{Gate 5:<br/>Coverage}

    Gate5 -->|โŒ Below 80%| BlockDeploy5[๐Ÿšซ Block PR / Release<br/>Coverage Too Low<br/>Add Tests]
    Gate5 -->|โœ… Pass| Build[๐Ÿ—๏ธ Build Phase]

    Build --> GenNews[๐Ÿ“ฐ Generate News<br/>14 Languages<br/>All Article Types]
    GenNews --> GenIndex[๐Ÿ“‹ Generate Indexes<br/>Language Indexes<br/>Main Index]
    GenIndex --> GenSitemap[๐Ÿ—บ๏ธ Generate Sitemap<br/>sitemap.xml<br/>SEO Optimization]

    GenSitemap --> SBOM[๐Ÿ“ฆ SBOM Generation<br/>SPDX Format<br/>All Dependencies]

    SBOM --> Attest1[๐Ÿ” Build Provenance<br/>SLSA Level 3<br/>GitHub Attestations]
    Attest1 --> Attest2[๐Ÿ” SBOM Attestation<br/>Cryptographic Sign<br/>Sigstore]

    Attest2 --> Artifacts[๐Ÿ“ฆ Collect Artifacts<br/>HTML Files<br/>CSS Files<br/>Sitemap<br/>SBOM]

    Artifacts --> DeployPrep[๐Ÿš€ Deployment Prep<br/>Organize Files<br/>Check Integrity]

    DeployPrep --> DeployGHP[๐Ÿ“ค Deploy to GitHub Pages<br/>Static Files<br/>actions/deploy-pages]

    DeployGHP --> GHPages[๐ŸŒ GitHub Pages Live<br/>GitHub CDN<br/>Global Distribution]

    GHPages --> HealthCheck{๐Ÿฅ Health Check<br/>Site Accessible?}

    HealthCheck -->|โŒ Failed| Rollback[๐Ÿ”™ Rollback<br/>Revert to Previous<br/>Restore Last Good]
    Rollback --> NotifyFailure[๐Ÿ“ง Notify Team<br/>Deployment Failed<br/>Incident Created]

    HealthCheck -->|โœ… Success| Verify[โœ… Verification Phase] --> CheckHTTPS{HTTPS<br/>Working?}

    CheckHTTPS -->|โŒ No| Rollback
    CheckHTTPS -->|โœ… Yes| CheckContent{Content<br/>Loads?}

    CheckContent -->|โŒ No| Rollback
    CheckContent -->|โœ… Yes| CheckLangs{All 14<br/>Languages?}

    CheckLangs -->|โŒ Missing| Rollback
    CheckLangs -->|โœ… Present| CheckSitemap{Sitemap<br/>Valid?}

    CheckSitemap -->|โŒ Invalid| Rollback
    CheckSitemap -->|โœ… Valid| UpdateMetrics[๐Ÿ“Š Update Metrics<br/>Deployment Time<br/>Build Duration<br/>Success Rate]

    UpdateMetrics --> TagRelease[๐Ÿท๏ธ Tag Release<br/>Git Tag<br/>Version Bump<br/>Create GitHub Release]

    TagRelease --> NotifySuccess[๐Ÿ“ง Notify Team<br/>Deployment Successful<br/>Version + URL]

    NotifySuccess --> Complete[โœ… Deployment Complete<br/>Live on GitHub Pages<br/>Attested + Verified]

    style Commit fill:#e3f2fd
    style SHAVerify fill:#ffe1e1
    style Gate1 fill:#e1f5ff
    style Gate2 fill:#e1f5ff
    style Gate3 fill:#e1f5ff
    style Gate4 fill:#ffe1e1
    style Gate5 fill:#e1f5ff
    style BlockDeploy1 fill:#ffcdd2
    style BlockDeploy2 fill:#ffcdd2
    style BlockDeploy3 fill:#ffcdd2
    style BlockDeploy4 fill:#ffcdd2
    style BlockDeploy5 fill:#ffcdd2
    style SBOM fill:#fff9c4
    style Attest1 fill:#ffe1e1
    style Attest2 fill:#ffe1e1
    style DeployGHP fill:#c8e6c9
    style GHPages fill:#e8f5e9
    style Rollback fill:#ffcdd2
    style Complete fill:#d4edda
    Stage Control Purpose Implementation
    Commit SHA verification, GPG signatures Code integrity Git built-in
    Linting ESLint security rules Code quality, vulnerabilities eslint-plugin-security
    Unit Tests 169 tests, 82%+ coverage Functional correctness Vitest
    Integration Tests 82 MCP client tests API contract validation Vitest + custom JSON-RPC MCP client
    Security Scan CodeQL SAST Vulnerability detection GitHub CodeQL
    Coverage Gate 80% lines, 75% branches Test thoroughness Vitest v8 provider (@vitest/coverage-v8)
    SBOM SPDX JSON format Supply chain transparency Anchore SBOM Action
    Provenance SLSA Level 3 Build integrity GitHub Attestations
    Attestation Cryptographic signing Artifact authenticity Sigstore
    Health Check Multi-point verification Deployment validation Custom checks
    Rollback Automated revert Failure recovery Git + GitHub Pages re-deploy
    Metrics Deployment tracking Performance monitoring GitHub Actions logs

    Deployment Security Requirements:

    1. โœ… All security gates must pass (no critical/high vulnerabilities)
    2. โœ… SBOM generated and attested for every deployment
    3. โœ… SLSA Level 3 provenance attestation required
    4. โœ… Health checks must pass before declaring success
    5. โœ… Automatic rollback on any verification failure
    6. โœ… Team notification on success/failure
    7. โœ… Deployment metrics recorded for audit trail

    This comprehensive flow shows the automated release process with SLSA Level 3 attestations and documentation-as-code implementation.

    flowchart TD
    Start[๐Ÿš€ Release Trigger<br/>Manual or Tag Push] --> Prepare[๐Ÿ“‹ Prepare Job]

    Prepare --> Lint[๐Ÿ” Run Linter<br/>ESLint Validation]
    Lint --> HTMLVal[โœ… Validate HTML<br/>htmlhint]
    HTMLVal --> Coverage[๐Ÿ“Š Run Tests with Coverage<br/>169 Unit Tests<br/>82%+ Coverage]

    Coverage --> CoverageCheck{Coverage<br/>Thresholds?}
    CoverageCheck -->|โŒ Fail| Fail1[โŒ Build Failed]
    CoverageCheck -->|โœ… Pass| E2E[๐ŸŽญ Run E2E Tests<br/>Playwright Chromium]

    E2E --> E2ECheck{E2E Tests<br/>Pass?}
    E2ECheck -->|โŒ Fail| Fail2[โŒ Build Failed]
    E2ECheck -->|โœ… Pass| CleanDocs[๐Ÿงน Clean Old Documentation<br/>Remove docs/api, coverage, test-results]

    CleanDocs --> GenAPI[๐Ÿ“– Generate API Documentation<br/>JSDoc โ†’ docs/api/<br/>52 files]
    GenAPI --> CopyReports[๐Ÿ“‹ Copy Test Reports<br/>Coverage โ†’ docs/coverage/<br/>Test Results โ†’ docs/test-results/]

    CopyReports --> GenIndex[๐ŸŽจ Generate Documentation Index<br/>Beautiful Hub Page<br/>docs/index.html]

    GenIndex --> VerifyDocs{Verify<br/>Documentation<br/>Structure?}
    VerifyDocs -->|โŒ Missing Files| Fail3[โŒ Build Failed]
    VerifyDocs -->|โœ… Complete| CommitDocs[๐Ÿ’พ Commit Documentation<br/>Git Auto-Commit<br/>To Main Branch]

    CommitDocs --> TagVersion{Workflow<br/>Dispatch?}
    TagVersion -->|โœ… Yes| CreateTag[๐Ÿท๏ธ Create Version Tag<br/>npm version + git tag]
    TagVersion -->|โŒ No| Build[๐Ÿ”จ Build Job]
    CreateTag --> Build

    Build --> Checkout2[๐Ÿ“ฅ Checkout at Tag]
    Checkout2 --> GenNews{News<br/>Directory<br/>Empty?}
    GenNews -->|โœ… Yes| SampleNews[๐Ÿ“ฐ Generate Sample News<br/>Week Ahead Articles]
    GenNews -->|โŒ No| CreateArtifact
    SampleNews --> CreateArtifact[๐Ÿ“ฆ Create Release Artifacts<br/>Include docs/, playwright-report/<br/>ZIP Archive]

    CreateArtifact --> GenSBOM[๐Ÿ” Generate SBOM<br/>SPDX JSON Format<br/>Anchore SBOM Action]
    GenSBOM --> BuildProv[๐Ÿ“œ Build Provenance Attestation<br/>SLSA Level 3<br/>GitHub Attestations API]
    BuildProv --> SBOMAttest[๐Ÿ” SBOM Attestation<br/>Cryptographic Signing]

    SBOMAttest --> UploadArtifacts[๐Ÿ“ค Upload All Artifacts<br/>Build + Security Artifacts]

    UploadArtifacts --> Release[๐Ÿš€ Release Job]
    Release --> DraftNotes[๐Ÿ“ Draft Release Notes<br/>Release Drafter]
    DraftNotes --> CreateRelease[๐ŸŽ‰ Create GitHub Release<br/>Attach All Artifacts]

    CreateRelease --> Verify{Verification<br/>Required?}
    Verify -->|โœ… Yes| VerifyCmd[๐Ÿ” Verify Attestations<br/>gh attestation verify]
    Verify -->|โŒ No| Complete[โœ… Release Complete<br/>Documentation Published<br/>Artifacts Attested]
    VerifyCmd --> Complete

    style Start fill:#e3f2fd
    style Prepare fill:#f0f4c3
    style Lint fill:#e1f5ff
    style Coverage fill:#e1f5ff
    style E2E fill:#e1f5ff
    style CleanDocs fill:#fff9c4
    style GenAPI fill:#c8e6c9
    style CopyReports fill:#c8e6c9
    style GenIndex fill:#c8e6c9
    style CommitDocs fill:#a5d6a7
    style Build fill:#f0f4c3
    style GenSBOM fill:#ffe1e1
    style BuildProv fill:#ffe1e1
    style SBOMAttest fill:#ffe1e1
    style Release fill:#f0f4c3
    style CreateRelease fill:#c5cae9
    style Complete fill:#c8e6c9
    style Fail1 fill:#ffcdd2
    style Fail2 fill:#ffcdd2
    style Fail3 fill:#ffcdd2
    Stage Control Purpose ISMS Reference
    Validation Linter + HTML validation Code quality, syntax errors Quality standards
    Testing 169 unit tests, 82%+ coverage Functional correctness ยง3.3 Testing Requirements
    E2E Testing Playwright across browsers User workflow validation Quality assurance
    Documentation JSDoc, coverage, E2E reports Evidence generation ยง3.2 Architecture Documentation
    Version Control Git commit + tag Audit trail, traceability ISO 27001 A.12.1.1
    SBOM Generation SPDX format, all dependencies Supply chain transparency ยง4.4 Supply Chain Security
    Build Provenance SLSA Level 3 attestation Build integrity SLSA Framework
    SBOM Attestation Cryptographic signing Artifact authenticity Non-repudiation
    Verification gh attestation verify Release validation Trust establishment

    Integrity:

    • โœ… Generated automatically from code and tests
    • โœ… Version controlled with full git history
    • โœ… Reproducible from any release tag
    • โœ… Part of attested release artifacts

    Transparency:

    • โœ… Public access via GitHub Pages
    • โœ… Real-time updates with every release
    • โœ… Complete test coverage visibility
    • โœ… API documentation always current

    Compliance:

    • โœ… ISMS ยง3.2 architecture documentation requirement
    • โœ… ISO 27001 A.12.1.1 documented procedures
    • โœ… Audit trail for all documentation changes
    • โœ… Eliminates documentation drift


    Document Status: Active
    Next Review: 2026-05-24
    Owner: Development Team, Hack23 AB
    Classification: Public
    Version: 1.1