Taxpoynt Docs
Compliance
Security Baseline Report (Report 1)
Source file: SECURITY_BASELINE_REPORT_2026-02-21.md
Executive Summary
This is the first security report for the current hardening cycle.
- Report ID:
SEC-REPORT-001 - Status: Baseline (Pre-Fix)
- Date: February 21, 2026
- Repository:
platform-clean - Branch:
main - Commit:
ed9a4d2
Outcome at baseline:
- No confirmed SQL injection vulnerability in invoice retrieval paths.
- Security controls are present (ORM usage, tenant scoping, input validation).
- Some assurance gaps remain (unsafe raw-SQL API usage in helper services, e2e boot failure, dependency audit blocked by network).
Scope
Assessed components:
- API backend under
apps/api. - Invoice retrieval and ingestion flows in SI/AP modules.
- Raw SQL usage patterns across backend services.
- Local static and dynamic security checks available in this environment.
Out of scope for this baseline:
- External penetration against deployed staging/production.
- Third-party infrastructure and cloud controls.
- Full SCA over internet (blocked by DNS/network constraints in this environment).
Methodology
Security workflow executed:
- Static code review for SQL injection patterns and trust boundaries.
- SAST-oriented checks:
pnpm run lint(apps/api)pnpm run typecheck(apps/api)
- Dynamic checks:
- Attempted full e2e run via
pnpm run test:e2e --runInBand - Added and executed targeted security tests for SQLi-like payloads.
- Attempted full e2e run via
- SCA attempt:
pnpm audit --prod(failed due environment network resolution issue).
Findings
F1: SQLi in Invoice Retrieval Paths Not Confirmed
- Severity: Informational
- Status: No exploit confirmed
Key evidence:
- Invoice retrieval uses Prisma ORM queries, not string-concatenated SQL:
apps/api/src/modules/si/infrastructure/persistence/prisma-invoice.repository.ts:47apps/api/src/modules/si/infrastructure/persistence/prisma-invoice.repository.ts:103
- Tenant guard prevents cross-organization invoice access:
apps/api/src/modules/si/application/use-cases/get-invoice.use-case.ts:11apps/api/src/modules/ap/infrastructure/http/ap.controller.ts:1025
- Global input validation is enabled:
apps/api/src/main.ts:11
Conclusion:
No evidence of the classic vulnerable pattern ... WHERE invoice_id = ' + input + ... in assessed invoice retrieval code paths.
F2: Unsafe Raw-SQL APIs Present in Helper Services
- Severity: Medium
- Status: Open (hardening recommended)
Observed usage:
apps/api/src/modules/firs-config/services/firs-credentials.service.ts:65apps/api/src/modules/si/services/connector-flag.service.ts:43apps/api/src/modules/si/services/mono-account-registry.service.ts:33apps/api/src/modules/si/services/mono-webhook-status-store.service.ts:22
Assessment:
- Current queries appear static with positional parameters (
$1,$2, etc.). - No template interpolation into SQL strings was found during this baseline.
- Risk remains elevated because
*RawUnsafeAPIs are easier to misuse in future changes.
F3: Full E2E Security Coverage Blocked by Bootstrapping Failure
- Severity: Medium (assurance gap)
- Status: Open
Attempted command:
pnpm run test:e2e --runInBand
Result:
- Nest injector recursion crash:
RangeError: Maximum call stack size exceeded
- This blocked full HTTP-level dynamic security verification through the normal e2e harness.
F4: Dependency Audit Blocked by Network/DNS Constraints
- Severity: Low (assurance gap)
- Status: Open
Attempted command:
pnpm audit --prod
Result:
- Failed with
EAI_AGAIN registry.npmjs.org. - Dependency vulnerability enumeration is incomplete in this baseline.
Security Tests Added in This Baseline
apps/api/src/modules/si/application/use-cases/__tests__/get-invoice.security.spec.ts- Verifies SQLi-like invoice ID does not bypass org boundary.
apps/api/src/modules/ap/application/use-cases/__tests__/ingest-ap-invoice.security.spec.ts- Verifies SQLi-like invoice number is rejected before persistence.
Execution result:
- Both tests passed.
Existing Security Regression Check Re-Run
Re-ran:
src/modules/environments/application/use-cases/__tests__/create-environment.security.spec.ts
Result:
- Passed (7/7).
Overall Risk (Baseline)
- Current SQLi risk in assessed invoice retrieval paths: Low
- Residual engineering risk: Medium
Residual risk drivers:
- Use of unsafe raw query APIs in non-invoice helper services.
- Blocked full e2e dynamic validation in current test harness state.
- Incomplete SCA due network constraint.
Remediation Plan Before Final Report
- Replace
.$queryRawUnsafe/.$executeRawUnsafewith safe equivalents where feasible. - Fix Nest DI recursion to restore full e2e execution.
- Re-run e2e security probes after fix.
- Run
pnpm audit --prodin network-enabled environment. - Optionally run controlled staged DAST/pentest with approved credentials and scope.
Exit Criteria for Final Report (Report 2)
Final report can be issued when all of the following are true:
- Raw unsafe SQL usage reduced or justified with documented safeguards.
- E2E harness executes successfully and security probes are re-run.
- Dependency audit results are collected and triaged.
- All added security regression tests remain passing.