fix: narrow server-entry evidence and pin standardize to the checked app repo (#4137) - #4249
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #4233 (which was rebase-merged while a final review round was still in flight, so this commit missed the merge). Two review findings against the app-type classification that #4233 introduced:
1.
app.js/main.jswere counted as server entry points.classifyNonNodeTypetreatedserver,app, andmain(×.js/.mjs/.cjs/.ts) as evidence that "a process runs here", which suppresses thestaticclassification. But beside anindex.html,app.jsandmain.jsare at least as likely to be browser scripts the page loads — so a real static site stayedunknownand was still offered the Node PM2 standardizer. That is the exact false positive #4137 was filed about, traded in to avoid a much rarer false negative. The basename list is now justserver, the one name that can only mean a server (ecosystem.config.*still counts, unchanged).2.
/api/standardize/*could standardize a repo it never type-checked.resolveStandardizeTargetinserver/routes/standardize.jsreturnedrepoPath || app.repoPath, so it ranstandardizeRefusalFor(app)against the record named byappIdand then rewrote whateverrepoPaththe request supplied. A permitted NodeappIdpaired with another directory would carry a Python or Docker project straight past the refusal, making the gate decorative — and #4233 is what gave that gate real work to do. It now returns the checked record's ownrepoPath. No caller sends both (apiSystem.js's wrappers send one or the other, and the socket handler already usedapp.repoPath), so this only closes the hole.Test plan
cd server && npx vitest run services/streamingDetect.test.js services/pm2Standardizer.test.js routes/standardize.test.js services/socket.test.js routes/apps— 272 passed / 1 skipped.classifyNonNodeTypecoverage: the server-basename list now asserts onlyserver.{js,mjs,cjs,ts}and the ecosystem configs suppress classification, with a new case pinningindex.html+index.js/app.js/main.jsasstatic.appIdsent alongside a foreignrepoPathanalyzes the app's own repo, not the supplied one.Refs #4137