Skip to content

Commit 46112ad

Browse files
author
Faxbot Agent
committed
fix(hipaa): correct phone masking and provider health discovery
CRITICAL HIPAA FIX: - Fixed phone masking in event emission to show ONLY last 4 digits - Changed from to[:8] + '***' (shows first 8) to proper masking - Now shows: *******4567 instead of +1555555*** Provider Health Fix: - Added lazy discovery of providers in /admin/providers/health endpoint - Initialize circuit breakers for active_outbound() and active_inbound() - Provider Health Status now shows configured providers (sinch, humblefax) This resolves the HIPAA compliance violation and makes Provider Health functional.
1 parent 238af77 commit 46112ad

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

api/app/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4101,11 +4101,13 @@ async def send_fax(background: BackgroundTasks, to: str = Form(...), file: Uploa
41014101
from .services.events import EventType as _EventType
41024102
emitter = get_event_emitter()
41034103
if emitter:
4104+
# HIPAA-compliant masking: show only last 4 digits
4105+
masked_to = ("*" * max(0, len(to) - 4)) + to[-4:] if len(to) >= 4 else "***"
41044106
await emitter.emit_event(
41054107
_EventType.FAX_QUEUED,
41064108
job_id=job_id,
41074109
provider_id=ob,
4108-
payload_meta={"backend": ob, "to": to[:8] + "***"} # Mask phone for PHI
4110+
payload_meta={"backend": ob, "to": masked_to}
41094111
)
41104112
except Exception:
41114113
pass # Non-fatal

api/app/routers/admin_providers.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ async def get_provider_health_status(request: Request, admin_auth: dict = Depend
5151
if not health_monitor:
5252
raise HTTPException(status_code=503, detail="Health monitor not available")
5353

54+
# Discover providers from config if circuit_states is empty
55+
if not health_monitor.circuit_states:
56+
from app.config import active_outbound, active_inbound
57+
ob = active_outbound()
58+
ib = active_inbound()
59+
60+
# Initialize circuit breakers for configured providers
61+
from app.monitoring.health import CircuitBreakerState
62+
if ob:
63+
health_monitor.circuit_states[ob] = CircuitBreakerState(provider_id=ob)
64+
if ib and ib != ob:
65+
health_monitor.circuit_states[ib] = CircuitBreakerState(provider_id=ib)
66+
5467
provider_statuses = await health_monitor.get_provider_statuses()
5568

5669
# Calculate summary stats

0 commit comments

Comments
 (0)