How palantir/phishcatch works
Main components
• Chrome Extension: Located in the “extension” directory. This is the primary client-side component.
• Frontend/UI: Built using React (see the “react-popup” folder including app.tsx, debug.tsx, and form components).
• Background & Content Scripts: These include files like background.ts, content.ts, and a comprehensive “lib” folder (functions for hashing, notification handling, debouncing, etc.). They perform core phishing detection tasks.
• Testing and configuration: Contains tests under “__tests__” and configuration files such as package.json, tsconfig.json, webpack configs.
• Server Component: Found in the “server” folder.
• It has a Dockerfile and Python code (app/__init__.py, main.py) with a requirements.txt, indicating that it’s a backend service (possibly for logging alerts, further processing, or bridging extension alerts with backend analytics).
• Policy Templates: The “policy-templates” directory includes platform-specific policy files for Mac (plist) and Windows (.reg) that likely facilitate deployment or enterprise management for browsers like Chrome and Edge.
• CI/CD and Governance: Includes configuration files for CircleCI (in .circleci) and Palantir’s internal policies (.palantir/policy.yml).
Relationships and interactions
• The extension’s React-based popup UI interacts with state management (MobX used in “mobx” folders) and sends alerts or notifications using the library functions (e.g., sendAlert).
• The “Policy Templates” are used for enterprise configuration. Represent them as auxiliary components that might be applied to configure or restrict browser behavior on managed systems.
Important architectural patterns or design principles
• Separation of concerns: The project’s design clearly segregates the client (extension UI, background, content) from the server component.
• Modular design: The “src/lib” utilities and “react-popup” components show a modular approach to handling tasks (such as hashing, debouncing, interacting with notifications).
• Configurable deployments: The inclusion of multiple configuration files (ESLint, Prettier, Webpack, and policy templates) reinforces the attention to coding standards, environment configurations, and enterprise-readiness in deployment.
• Testing and Continuous Integration: Presence of Jest configuration and CircleCI settings denote a test-driven and CI/CD-driven design.
• Clear labels for each major part (e.g., “Chrome Extension - UI (React)”, “Content Script”, “Background Script”, “Shared Libraries”, “Backend Server”, “Enterprise Policy Templates”).
• From web pages → Content Script → Background Script.
• From Extension Components → Backend Server (via API calls).
• From CI/CD pipelines (CircleCI) → Deployment/Build processes.
• Optionally, highlight the testing pipeline (Jest and test files) as an auxiliary component that underpins quality assurance.
• Integration points with the policies for enterprise configurations.