Skip to content

fix(static_config): only trust defineConfig fromvite-plus#2060

Merged
fengmk2 merged 12 commits into
voidzero-dev:mainfrom
liangmiQwQ:fix/reject-defineConfig-import-not-from-viteplus
Jul 6, 2026
Merged

fix(static_config): only trust defineConfig fromvite-plus#2060
fengmk2 merged 12 commits into
voidzero-dev:mainfrom
liangmiQwQ:fix/reject-defineConfig-import-not-from-viteplus

Conversation

@liangmiQwQ

@liangmiQwQ liangmiQwQ commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

At present, static config only checks if the export default statement's callee is defineConfig.

So, if I import defineConfig from other sources and modify the input in the function, or define a variable called defineConfig, the static config analyze will get broken.

For example, if you are using a preset which automatically generates tasks, you will get:

$ vpr build
Task "build" not found.
Select a task (↑/↓, Enter to run, type to search): build

  No matching tasks. Press Escape to clear search.

If the defineConfig modify its import structure, you may get:

$ vpr dev
error: Failed to load task graph
* Failed to load task config file for package at "/Users/liangmi/code/liangmiQwQ/is-github-bot/"
* unknown field `missions`, expected one of `cache`, `tasks`, `enablePrePostScripts`

This PR adds source check and only trust defineConfig from vite-plus package.

This problem is discovered when I am doing attempts in my personal Vite+ config preset.

🤖 Generated with Codex

@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 4e5a3cb
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a4b5201915e6f0008f3e93e

@liangmiQwQ

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf702d8c87

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_static_config/src/lib.rs Outdated
Comment thread crates/vite_static_config/src/lib.rs Outdated
Comment thread crates/vite_static_config/src/lib.rs Outdated
@liangmiQwQ

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d343cc552

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_static_config/src/lib.rs Outdated
Comment thread crates/vite_static_config/src/lib.rs Outdated
@liangmiQwQ

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4bded2ec89

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_static_config/src/lib.rs Outdated
@liangmiQwQ

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1cae72a270

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_static_config/src/lib.rs Outdated
Comment thread crates/vite_static_config/src/lib.rs Outdated
Comment thread crates/vite_static_config/src/lib.rs Outdated
Comment thread crates/vite_static_config/src/lib.rs Outdated
Comment thread crates/vite_static_config/src/lib.rs Outdated
@liangmiQwQ liangmiQwQ changed the title fix(static_config): reject defineConfig from untrusted sources fix(static_config): only trust defineConfig fromvitest Jul 6, 2026
@liangmiQwQ liangmiQwQ changed the title fix(static_config): only trust defineConfig fromvitest fix(static_config): only trust defineConfig fromvite-plus Jul 6, 2026
@liangmiQwQ

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 3d2fc136cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@liangmiQwQ liangmiQwQ marked this pull request as ready for review July 6, 2026 04:42
@liangmiQwQ liangmiQwQ requested review from fengmk2 and wan9chi July 6, 2026 04:42

@fengmk2 fengmk2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@liangmiQwQ That was indeed a problem, thank you for fixing it.

@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member

@liangmiQwQ Could you add the error message to the PR description? This way, people can get a clearer understanding of the specific issue being fixed. Even if I know what the error is, others who are unfamiliar with it should be able to understand the problem at a glance.

@liangmiQwQ

Copy link
Copy Markdown
Collaborator Author

@fengmk2 It may just be simple task not found for most cases. Or if the function's input type is changed, it will prompt an error. I've added both of them to PR description

@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member

@liangmiQwQ I will run a round simplify before I merge.

- Reuse oxc's ModuleExportName::name() instead of the hand-rolled
  three-variant matcher.
- Collapse the eager import scan plus interleaved mutable flag into a
  single immutable pass over the program body.
- Extract the duplicated "vite-plus" / "defineConfig" literals into
  named constants.
@fengmk2 fengmk2 force-pushed the fix/reject-defineConfig-import-not-from-viteplus branch from 336d469 to 4e5a3cb Compare July 6, 2026 06:58
@fengmk2 fengmk2 merged commit b9b15c4 into voidzero-dev:main Jul 6, 2026
44 checks passed
@liangmiQwQ liangmiQwQ deleted the fix/reject-defineConfig-import-not-from-viteplus branch July 6, 2026 07:21
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.

2 participants