fix(api): consumer rejects malformed heartbeats with no host block (no phantom hosts)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,12 @@ export class HostAgentConsumerService implements OnApplicationBootstrap {
|
||||
|
||||
private async onHeartbeat(licenseId: string, payload: HeartbeatPayload): Promise<void> {
|
||||
if (!(await this.isValidTenant(licenseId))) return;
|
||||
// A well-formed v2 heartbeat always carries a host block. Reject malformed
|
||||
// payloads so a stray/empty publish can't create a phantom host row.
|
||||
if (!payload || typeof payload.host !== 'object' || payload.host === null) {
|
||||
this.logger.warn(`ignoring malformed heartbeat for license ${licenseId} (no host block)`);
|
||||
return;
|
||||
}
|
||||
const now = new Date();
|
||||
|
||||
await this.updateLegacyConnection(licenseId, now);
|
||||
|
||||
Reference in New Issue
Block a user