Skip to content

[ Release 2025-08-06 ] Part 2 Security Remediation, Dependency Overhaul - #456

Merged
ct3685 merged 22 commits into
productionfrom
staging
Aug 6, 2025
Merged

[ Release 2025-08-06 ] Part 2 Security Remediation, Dependency Overhaul#456
ct3685 merged 22 commits into
productionfrom
staging

Conversation

@ct3685

@ct3685 ct3685 commented Aug 6, 2025

Copy link
Copy Markdown

[ Release 2025-08-06 ] Part 2 Security Remediation, Dependency Overhaul

This PR represents the second major phase of security remediation and dependency modernization across the codebase. Key changes include:

  • Code Removal: Deprecated the legacy /api/ai/stream route and the associated FlowiseStream utility, removing real-time AI chat streaming tied to Flowise socket connections.
  • Security Hardening:
    • Added validation layers to guard against SSRF in web crawling and sitemap parsing (isSecureURL checks).
    • Introduced utility functions for stricter input validation and normalization (sanitizeURL, validateEnumArray, etc.).
  • Dependency Upgrades:
    • Widespread update of both dependencies and devDependencies in all packages (web, utils, db, server, components, etc.), addressing outdated and vulnerable versions.
    • Includes updates to packages like @emotion/*, ioredis, jose, stripe, typeorm, handlebars, cypress, eslint, typescript, and many more.
  • Security-driven Overrides:
    • Pinned or elevated transitive packages known for security exposure (e.g., prismjs, express, serve-static, cookie, postcss, webpack-dev-server, etc.).
  • Validation Refactor in Server:
    • Consolidated feedback type parsing in chat-messages controller using new reusable validateEnumArray() logic for consistency and safety.
  • Runtime & Build Enhancements:
    • Upgraded pyodide and standardized the TypeScript target to include ES2022.
    • Improved retry handling for BWS CLI invocations (bws-retry-utils.js) to better manage rate limits.

This update is part of an ongoing effort to reduce technical debt, eliminate insecure legacy code paths, and modernize the platform’s runtime environment. Additional refactors and cleanups will follow in future patches.

maxtechera and others added 22 commits August 5, 2025 19:51
- SSRF #29: FlowiseStream.ts - Added URL validation before fetch
- SSRF #28: utils.ts xmlScrape - Added isSecureURL validation
- SSRF #27: utils.ts crawl - Added isSecureURL validation
- Type Confusion #6: getChatMessage.ts - Added Array.isArray check

Security improvements:
- Created centralized URL validation in validator.ts
- Blocks localhost, private IPs, cloud metadata endpoints
- Type-safe enum validation to prevent parameter tampering
- Minimal, surgical fixes without breaking functionality

Fixes GitHub code scanning alerts #29, #28, #27, #6
…ml-workflow

feat: Add SonarCloud Static Analysis GitHub Workflow
…rabilities

Fix/critical security vulnerabilities
…security

- Update embed submodule to track ct/staging-pnpm-recursive-updates branch
- Upgrade various dependencies in package.json files across multiple packages to their latest versions for better performance and security
- Ensure consistency in package versions and resolve potential vulnerabilities
…roved compatibility and security

- Upgrade cypress to version 13.17.0 for enhanced testing capabilities
- Update lint-staged to version 15.2.0 for better performance
- Modify dependency versions in pnpm-lock.yaml to use minimum required versions for better stability
- Remove deprecated request package from packages-answers/utils/package.json to streamline dependencies
…roved compatibility and performance

- Add postcss@8.4.31, tsup@8.3.5, and jsforce@3.10.0 to package.json for enhanced functionality
- Remove react-scripts from packages/ui/package.json to streamline dependencies
- Upgrade tsup in packages-answers/ui/package.json to version 8.3.5 for better build performance
- Modify pnpm-lock.yaml to reflect updated dependency versions for consistency and stability
…roved functionality

- Refactor BWS Secure scripts to utilize execBwsCommandWithRetrySync for better error handling and retry logic
- Update README.md for clearer instructions on creating access tokens
- Upgrade dotenv, dotenv-cli, yargs, and axios in package.json for compatibility and performance improvements
- Add bws-retry-utils.js for managing rate limits and retry logic in BWS commands
- Ensure consistent logging and error handling across BWS Secure scripts
- Change 'as' to 'AS' for consistency in stage definitions
- Ensure clarity in multi-stage build process by standardizing syntax
- Change submodule branch from ct/staging-pnpm-recursive-updates to a-main
- Update subproject commit reference for improved stability
- Add synchronous sleep function in bws-retry-utils.js for improved rate limit handling
- Upgrade actions/checkout from v3 to v4 for enhanced functionality
- Set fetch-depth to 0 for complete history retrieval during checkout
- Delete the SonarCloud analysis workflow file, running CI analysis with Automatic Analysis.
- Change 'AS' to 'as' for consistency in stage definitions
- Improve clarity in multi-stage build process by standardizing syntax
- Remove 'path-to-regexp: "0.1.12"' from pnpm.overrides in package.json
- This was forcing @oclif/core@4.0.7 to use old path-to-regexp version without .match() method
- Fixes 'pathRegexp.match is not a function' error that prevented CLI command registration
- CLI now properly discovers start/worker commands when environment variables are provided
- Revert multer-cloud-storage back to ^4.1.0 (was incorrectly blamed for the issue)
- Deployment should now work as CLI commands are properly discoverable
…otentially

security: upgrade dependencies to eliminate known vulnerabilities across monorepo
@vercel

vercel Bot commented Aug 6, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
answerai-docs ✅ Ready (Inspect) Visit Preview Aug 6, 2025 2:03pm
the-answerai ✅ Ready (Inspect) Visit Preview Aug 6, 2025 2:03pm

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2025

Copy link
Copy Markdown

@ct3685 ct3685 added dependencies Pull requests that update a dependency file major-upgrade security-update labels Aug 6, 2025
@ct3685
ct3685 marked this pull request as ready for review August 6, 2025 14:06
@ct3685
ct3685 merged commit 48a58da into production Aug 6, 2025
30 of 32 checks passed
@maxtechera
maxtechera temporarily deployed to staging - theanswer-iek0 August 6, 2025 14:08 — with Render Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file major-upgrade security-update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants