Detect env-var-wired SaaS services#10
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SaaS services wired purely through environment variables / docker-compose
environment:keys (no SDK/package dependency) were invisible to the analyzer. Concrete miss (from review of firecrawl): Supabase (SUPABASE_URL/SUPABASE_*_TOKEN) and Slack (SLACK_WEBHOOK_URL) are configured indocker-compose.yaml, and PostHog (POSTHOG_API_KEY) is a deliberately dependency-free capture client. specfy reports all three; we reported none.Root cause
The env-var match source (
dotenv/EnvVarNames) already exists end-to-end and the relevant detectors already carry the right prefixes (SUPABASE_,SLACK_,POSTHOG_). ButComponentDetector.ReadEnvVarNamesonly harvested keys from.env*files — it never read docker-composeenvironment:blocks, so compose-wired services produced no env-var signal.What was implemented
ReadEnvVarNamesinComponentDetector.csto also harvest env-var key names from docker-compose files (docker-compose*.yml/.yaml,compose*.yml/.yaml). Parses both the list form (- KEY=value,- KEY) and the map form (KEY: value) insideenvironment:blocks, tracking indentation so only keys within an environment block are collected (ports/other keys are excluded). Reuses the existingdotenvmatch source — no model or rule-engine changes, and no new YAML detectors were needed because PostHog/Supabase/Slack already declaredotenvprefixes.Tests
ComponentDetectorTests.Compose_environment_keys_become_env_var_names: end-to-end, writes a compose file and asserts SUPABASE_URL / SLACK_WEBHOOK_URL / POSTHOG_API_KEY / POSTHOG_HOST surface inEnvVarNamesand that non-env keys (ports) do not leak.RuleEngineTests.Detects_env_wired_saas_from_env_var_namestheory: asserts Supabase/Slack/PostHog are detected from a single env-var name at Low confidence.Deferred / out of scope
envVarsmatch facet (separate from the existingdotenvprefix facet) was not added: it is unnecessary here since the existingdotenvsource already matches by prefix and all three target services are covered. Implementing a brand-new match source would have been a larger, higher-risk engine change for no additional detection coverage.