How hariharan-2411/sectest works
Purpose and Entry Points
SecTest Pro is a Chrome/Brave Manifest V3 security-testing extension for authorized web-app testing. It scans page inputs, applies guarded payloads without submission, performs passive recon, tracks scope/programs, validates findings, and produces reports. The extension entry surfaces are the MV3 manifest, service worker, content script, and React popup: src/manifest.json, src/pages/Background/index.js, src/pages/Content/index.js, src/pages/Popup/index.jsx.
Extension Control Plane
The popup is the operator-facing orchestration layer: it manages scan/payload/recon/settings state, communicates with the active-tab content script, and persists operational data through Chrome storage. The background worker supplies extension-wide defaults, message handling, rate limiting, and enforcement boundaries. Shared configuration and browser persistence adapters isolate runtime settings from UI logic: src/pages/Popup/Popup.jsx, src/pages/Background/index.js, src/utils/chromeStorageAdapter.js.
Page Scanning and Test Execution
The content script is the only component intended to inspect or mutate the loaded target DOM. It enumerates form controls into serializable metadata, inserts reachability markers, applies payloads only to compatible text-like controls, and visually marks modified fields. Popup-to-content messages form the principal browser-side execution path; form submission, navigation, cookie mutation, and storage-value reading remain outside that path. Core paths: src/pages/Content/index.js, src/utils/extraction.js, src/utils/payloads.js.
Safety, Scope, and Audit Boundary
Testing is constrained by host/program scope, dry-run versus live mode, explicit confirmations, payload validation, and action-rate limits. Scope is also modeled as program assets and can be synchronized with the companion agent. Findings are retained rather than silently discarded, while audit/notification utilities provide traceability and user feedback. Core paths: src/utils/scope.js, src/utils/programs.js, src/utils/validate.js, src/utils/notify.js.
Recon, Evidence, and Finding Lifecycle
Passive recon derives page inventory, forms, storage-key names, headers, and script-change signals locally. Detection helpers identify reflection, taint/sinks, secret indicators, and differential/oracle evidence. These observations become findings, then pass through deterministic confidence scoring; noise is excluded from escalation, and report generation defaults to likely-or-better findings. The optional prose layer may explain a score but cannot alter it. Core paths: src/utils/reconHelpers.js, src/utils/findings.js, src/utils/validate.js, src/utils/reportBuilder.js.
AI and External Service Boundary
AI payload generation supports local Ollama and Groq through provider abstractions; a Supabase Edge Function proxies Groq-related requests. AI is advisory: deterministic validation remains authoritative for confidence and reporting. Authentication and remote persistence integrations are separated behind utility clients. Core paths: src/utils/aiProvider.js, src/utils/aiModels.js, src/utils/supabaseClient.js, supabase/functions/groq-proxy/index.ts.
Companion Agent and Tool Execution
The optional Node.js companion agent is a loopback HTTP service for recon tools unavailable to browser extensions. It authenticates requests, rechecks synchronized scope per request, classifies tools by risk, rate-limits execution, and invokes allow-listed binaries without a shell. Active tools require an additional environment gate. Its triage subproject is a separate runner-oriented stage for processing results. Core paths: agent/server.js, agent/lib/tools.js, agent/lib/scope.js, agent/triage/runner.js.
Runtime and Deployment Shape
The main runtime is React/Webpack packaged as a Chrome MV3 extension, using Chrome extension APIs and browser-tab messaging. The optional agent runs Node.js directly or in Docker and binds to loopback; it invokes installed/containerized reconnaissance binaries. Supabase hosts the optional TypeScript edge proxy, while Ollama and Groq are external AI endpoints. Build composition is defined in webpack.config.js, agent containerization in agent/Dockerfile and agent/docker-compose.yml.
Main entry points: index.js Content Script · index.jsx React Popup · scope.js Scope & Programs · validate.js Deterministic Validation
Components 21
Chrome MV3 Extension
Browser-side operator interface and guarded page testing.
- MV3 Manifest
src/manifest.json - React Popup · Manages scan, payload, recon, settings, and active-tab commands.
src/pages/Popup/index.jsx - Background Worker · Applies extension-wide messaging, defaults, and rate limits.
src/pages/Background/index.js - Chrome Storage Adapter
src/utils/chromeStorageAdapter.js - Content Script · Only browser component permitted to inspect or alter target-page DOM.
src/pages/Content/index.js - Control Extraction · Serializes compatible form-control metadata for the popup.
src/utils/extraction.js - Guarded Payloads · Applies payloads only to compatible text-like controls without submission.
src/utils/payloads.js - Extension Build
webpack.config.js
Evidence Pipeline
Local recon, validation, and reporting.
- Scope & Programs · Models allowed hosts and program assets.
src/utils/scope.js - Passive Recon · Collects local page, form, header, key-name, and script-change observations.
src/utils/reconHelpers.js - Findings Lifecycle · Retains observations for deterministic confidence evaluation.
src/utils/findings.js - Deterministic Validation · Enforces confirmations, payload checks, noise exclusion, and authoritative scoring.
src/utils/validate.js - Report Builder · Defaults output to likely-or-better findings.
src/utils/reportBuilder.js - Audit & Notifications
src/utils/notify.js
Optional Remote Services
Advisory AI and remote integration boundary.
- AI Provider Layer · Selects local Ollama or Groq providers without controlling validation.
src/utils/aiProvider.js - Supabase Client
src/utils/supabaseClient.js - Groq Edge Proxy · Proxies Groq-related requests.
supabase/functions/groq-proxy/index.ts
Companion Agent
Loopback-only tooling for browser-inaccessible reconnaissance.
- Loopback Agent Server · Authenticates requests and rechecks synchronized scope before tool execution.
agent/server.js - Allow-listed Tool Runner · Risk-classifies and rate-limits shell-free binary invocation; active tools need an environment gate.
agent/lib/tools.js - Agent Scope Guard
agent/lib/scope.js - Triage Runner · Separate runner-oriented processing for agent results.
agent/triage/runner.js
Connections 25
- MV3 Manifest → Background Worker: registers
- MV3 Manifest → Content Script: injects
- Extension Build → MV3 Manifest: packages
- React Popup → Background Worker: extension messages
- React Popup → Content Script: active-tab commands
- React Popup → Chrome Storage Adapter: persists state
- Background Worker → Scope & Programs: enforces defaults
- Content Script → Control Extraction: enumerates controls
- Content Script → Guarded Payloads: uses
- Scope & Programs → Content Script: authorizes testing
- Content Script → Passive Recon: supplies page signals
- Passive Recon → Findings Lifecycle: creates observations
- Content Script → Findings Lifecycle: records test evidence
- Findings Lifecycle → Deterministic Validation: scores
- Deterministic Validation → Report Builder: filters reportable findings
- Deterministic Validation → Audit & Notifications: emits audit feedback
- React Popup → AI Provider Layer: requests suggestions
- AI Provider Layer → Supabase Client: remote provider access
- Supabase Client → Groq Edge Proxy: invokes
- AI Provider Layer → Guarded Payloads: advises candidates · Generated candidates remain subject to deterministic checks.
- React Popup → Loopback Agent Server: optional loopback requests
- Scope & Programs → Agent Scope Guard: synchronizes programs
- Loopback Agent Server → Agent Scope Guard: rechecks scope
- Loopback Agent Server → Allow-listed Tool Runner: authorizes execution
- Allow-listed Tool Runner → Triage Runner: produces results