Skip to content

feat: 使用 source-map-parser-node 包进行处理代码解析#20

Merged
MasonChow merged 2 commits intomainfrom
fix/code-review-issues
Sep 4, 2025
Merged

feat: 使用 source-map-parser-node 包进行处理代码解析#20
MasonChow merged 2 commits intomainfrom
fix/code-review-issues

Conversation

@MasonChow
Copy link
Copy Markdown
Owner

No description provided.

- Fixed operating_guide tool to read from README.md instead of external directory
- Added URL validation to prevent SSRF attacks in fetchSourceMapContent
- Improved error message sanitization to avoid exposing internal details
- Fixed method name typo (praseStack -> parseStack)
- Added JSON validation for external package responses
- Updated build configuration for WebAssembly support
- Added TypeScript declarations for source_map_parser_node package
Copilot AI review requested due to automatic review settings September 4, 2025 11:12
@MasonChow MasonChow changed the title feat: 使用 source-map-parser-mcp 包进行处理代码解析 feat: 使用 source-map-parser-node 包进行处理代码解析 Sep 4, 2025
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 1.85185% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.64%. Comparing base (af1f258) to head (19811a8).

Files with missing lines Patch % Lines
src/parser.ts 0.00% 48 Missing and 1 partial ⚠️
src/server.ts 0.00% 4 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
- Coverage   20.06%   17.64%   -2.43%     
==========================================
  Files           4        5       +1     
  Lines         294      340      +46     
  Branches       19       20       +1     
==========================================
+ Hits           59       60       +1     
- Misses        233      278      +45     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the source map parsing implementation to use the source_map_parser_node npm package instead of a local WASM-based parser. The changes include removing external WASM files, updating build configuration for WASM support, and adding security improvements like URL validation and error message sanitization.

  • Replace local WASM parser with source_map_parser_node npm package
  • Add security enhancements including URL validation and error message sanitization
  • Update build configuration to support WASM plugins and manage dependencies

Reviewed Changes

Copilot reviewed 9 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vite.config.mjs Added WASM plugins and updated external dependencies configuration
src/server.ts Changed documentation file path and added error message sanitization
src/parser.ts Replaced local WASM parser with npm package and added security validations
src/main.ts Renamed main function to stdio
src/external/ Removed local WASM parser files and external directory
package.json Added source_map_parser_node dependency and WASM build plugins
build.sh Removed external directory copying logic
Comments suppressed due to low confidence (1)

src/parser.ts:1

  • The regex pattern for sanitizing error messages is too restrictive and may remove important debugging information like parentheses, brackets, or quotes that could be helpful for developers. Consider a more balanced approach that removes only potentially sensitive patterns while preserving useful debugging context.
import * as sourceMapParser from 'source_map_parser_node';

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MasonChow MasonChow merged commit 6536571 into main Sep 4, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants