Security: WS-Rollenprüfung, JWT-Cookie statt localStorage, XSS/SSRF-Fixes, RDP-Consent-Secret
Some checks failed
IT Nexus Deploy / Build Frontend (push) Has been cancelled
IT Nexus Deploy / Deploy to Production (push) Has been cancelled

- WebSocket Shell/RDP: Rollenprüfung statt nur JWT-Gültigkeit (war: jeder eingeloggte User konnte fremde Agents per Shell/RDP übernehmen)
- JWT_SECRET: Server bricht ab statt mit unsicherem Default weiterzulaufen
- Auth: Token läuft jetzt über httpOnly-Cookie statt localStorage (XSS-Schutz gegen Session-Diebstahl)
- WS-Auth: Token nicht mehr als URL-Query-Param (landete in nginx-Logs), sondern als erste Message bzw. automatisch via Cookie
- Frontend: toter Rollen-Check (isSuperAdmin/isAdmin ohne Funktionsaufruf) in AgentDetailPage gefixt
- XSS: DOMPurify-Sanitizing für alle marked.parse()-Renderstellen (KI-Antworten, Kommentare, Knowledge Base)
- E-Mail: HTML-Escaping für alle ticket-gesteuerten Felder (auch über öffentliche Ticket-Route erreichbar)
- SSRF-Schutz beim Knowledge-Base-URL-Import (blockt private/Loopback-Adressen)
- TV-Dashboard: Shared-Key statt komplett offenem Endpoint
- Striktes Rate-Limit auf /login, must_change_password serverseitig erzwungen
- Agent (C#) v2.7.0: RDP-Consent/Disconnect/Capture verlangen jetzt ein Pro-Session-Secret (war: jeder lokale Prozess konnte Consent vortäuschen), DataDir-ACL für agent.log/status.json
- FIDO-PINs AES-256-GCM-verschlüsselt statt Klartext, Retention-Job für alte patch_commands/audit_log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 13:27:17 +02:00
parent 3ea28def4c
commit 81b1c326fc
47 changed files with 706 additions and 235 deletions

View File

@@ -1,4 +1,5 @@
using System.Net.Sockets;
using System.Text;
using System.Windows;
using System.Windows.Media.Animation;
@@ -7,14 +8,16 @@ namespace ITNexusAgent.UI;
public partial class RdpActiveIndicatorWindow : Window
{
private readonly int _port;
private readonly string _secret;
private readonly DateTime _startedAt = DateTime.Now;
private readonly System.Windows.Threading.DispatcherTimer _timer = new();
private bool _signaled = false;
public RdpActiveIndicatorWindow(int port)
public RdpActiveIndicatorWindow(int port, string secret)
{
InitializeComponent();
_port = port;
_secret = secret;
Loaded += (s, e) =>
{
@@ -47,8 +50,10 @@ public partial class RdpActiveIndicatorWindow : Window
{
using var tcp = new TcpClient();
tcp.Connect("127.0.0.1", _port);
tcp.GetStream().WriteByte(1);
tcp.GetStream().Flush();
var stream = tcp.GetStream();
stream.Write(Encoding.ASCII.GetBytes(_secret));
stream.WriteByte(1);
stream.Flush();
}
catch { }
}

View File

@@ -1,4 +1,5 @@
using System.Net.Sockets;
using System.Text;
using System.Windows;
namespace ITNexusAgent.UI;
@@ -6,13 +7,15 @@ namespace ITNexusAgent.UI;
public partial class RdpConsentWindow : Window
{
private readonly int _port;
private readonly string _secret;
private bool _answered = false;
private System.Threading.CancellationTokenSource _countdownCts = new();
public RdpConsentWindow(int port)
public RdpConsentWindow(int port, string secret)
{
InitializeComponent();
_port = port;
_secret = secret;
_ = RunCountdownAsync(_countdownCts.Token);
}
@@ -53,8 +56,10 @@ public partial class RdpConsentWindow : Window
{
using var tcp = new TcpClient();
tcp.Connect("127.0.0.1", _port);
tcp.GetStream().WriteByte((byte)(accepted ? 1 : 0));
tcp.GetStream().Flush();
var stream = tcp.GetStream();
stream.Write(Encoding.ASCII.GetBytes(_secret));
stream.WriteByte((byte)(accepted ? 1 : 0));
stream.Flush();
}
catch { }
}