-
Notifications
You must be signed in to change notification settings - Fork 1
[LFXV2-918] fix(zoom): default to mock zoom webhook validator #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -78,7 +78,8 @@ func SetupZoom(config ZoomConfig) ZoomConfig { | |||||||||
| slog.Info("Zoom webhook validation configured") | ||||||||||
| config.Validator = validator | ||||||||||
| default: | ||||||||||
| slog.Warn("Zoom webhook validation not configured", logging.PriorityCritical()) | ||||||||||
| slog.Warn("Zoom webhook validation not configured - using mock validator", logging.PriorityCritical()) | ||||||||||
|
||||||||||
| slog.Warn("Zoom webhook validation not configured - using mock validator", logging.PriorityCritical()) | |
| slog.Error("Zoom webhook validation not configured - using mock validator", logging.PriorityCritical()) |
| slog.Warn("Zoom webhook validation not configured - using mock validator", logging.PriorityCritical()) | |
| slog.Warn("Zoom webhook validation not configured - using mock validator") |
🤖 Prompt for AI Agents
In cmd/meeting-api/platforms/zoom.go around line 81, the code logs a warning
with slog.Warn but adds logging.PriorityCritical() which mismatches level;
either change the call to a higher severity (e.g., use slog.Error or slog.Warn
with appropriate semantics) if this truly merits a critical priority, or remove
the PriorityCritical() attribute if a warning is sufficient; update the log
invocation so the severity and the priority attribute are consistent (e.g.,
replace slog.Warn(..., logging.PriorityCritical()) with slog.Error(...,
logging.PriorityCritical()) for critical, or keep slog.Warn(...) and drop the
PriorityCritical() argument).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for environment detection patterns that distinguish production from development
# Search for common environment variable patterns
rg -n --type=go -C3 '\b(ENV|ENVIRONMENT|DEPLOYMENT|STAGE)\b' -g '!vendor/**' -g '!*_test.go'
# Search for other configuration validation or startup checks
rg -n --type=go -C3 'IsConfigured|ValidateConfig|checkConfig' -g '!vendor/**' -g '!*_test.go'Repository: linuxfoundation/lfx-v2-meeting-service
Length of output: 1185
🏁 Script executed:
#!/bin/bash
# Read the zoom.go file to see the full context of SetupZoom function
cat -n cmd/meeting-api/platforms/zoom.go | head -90Repository: linuxfoundation/lfx-v2-meeting-service
Length of output: 3740
🏁 Script executed:
#!/bin/bash
# Search for SetupZoom function calls
echo "=== SetupZoom function calls ==="
rg -n 'SetupZoom' --type=go -B2 -A2 -g '!vendor/**'
# Search for main function or initialization
echo -e "\n=== Main function and app initialization ==="
rg -n 'func main|func init' --type=go -B1 -A10 -g '!vendor/**' | head -100
# Search for app configuration or startup validation
echo -e "\n=== Configuration/startup validation patterns ==="
rg -n 'panic|fatal|os\.Exit|log\.Fatal' --type=go -B2 -A2 -g '!vendor/**' -g '!*_test.go' | head -80Repository: linuxfoundation/lfx-v2-meeting-service
Length of output: 2812
🏁 Script executed:
#!/bin/bash
# Read main.go to see full run() function and initialization
cat -n cmd/meeting-api/main.go | head -100Repository: linuxfoundation/lfx-v2-meeting-service
Length of output: 3845
🏁 Script executed:
#!/bin/bash
# Read config.go to see environment parsing and validation
cat -n cmd/meeting-api/config.goRepository: linuxfoundation/lfx-v2-meeting-service
Length of output: 5150
Add environment-based safeguards to prevent mock webhook validation in production.
While this change successfully prevents service crashes, defaulting to a mock webhook validator means webhook signature validation will be bypassed when Zoom configuration is missing. Since the service defaults to production mode (see LFX_ENVIRONMENT in config.go), this could pose a security risk if the service runs without proper Zoom webhook configuration.
The codebase already detects environment via LFX_ENVIRONMENT variable (dev/staging/prod, defaulting to prod). Consider:
- Fail startup in production if webhook validation is not properly configured (neither
ZOOM_WEBHOOK_SECRET_TOKENnorMOCK_ZOOM_WEBHOOK=true) - Only allow mock validator when explicitly in development/testing mode
- Validate webhook configuration status before returning from
SetupZoom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a mock webhook validator in production is a critical security vulnerability. The mock validator bypasses all signature validation (always returns nil), which means any attacker could send fake webhook events to your system without authentication.
This default case is reached when neither MOCK_ZOOM_WEBHOOK=true nor ZOOM_WEBHOOK_SECRET_TOKEN is set. In production environments, this should either fail fast to prevent the service from starting with insecure configuration, or at minimum not set any validator at all.
Consider these alternatives:
The PriorityCritical() log attribute is appropriate but insufficient - it logs the issue but still proceeds with an insecure configuration.