shakacode / shakacode/pack-config-diff
Address remaining review feedback from PR #8
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Context
PR #8 ("Add comprehensive docs for newcomers") received two late-round automated reviews (from claude[bot]) after all inline threads were resolved. These items were deferred to a follow-up PR to keep #8 focused.
Source comments:
- https://github.com/shakacode/pack-config-diff/pull/8#issuecomment-4149911599
- https://github.com/shakacode/pack-config-diff/pull/8#issuecomment-4149916677
Must-fix
-
Secrets exposure via
dumpwithout--clean(configCleaner.ts)
Plugins likeDefinePluginandEnvironmentPluginroutinely contain API keys and auth tokens. Since--cleanis opt-in,dumpcan inadvertently serialize secrets. At minimum add a visible docs warning; consider whether--cleanshould default totrueor emit a[SENSITIVE]placeholder for known-sensitive plugin properties unconditionally. -
diffalways evaluates function-exporting configs in production mode (cli.ts)
Both--leftand--rightJS configs are resolved withargv = { mode: "production" }. A user running--left=webpack.dev.js --right=webpack.prod.jssilently gets two production configs compared. Add a--modeflag (or--left-mode/--right-mode), or at minimum a runtime warning when a function export is detected. -
resolveRealPathsuffix splicing bug (fileWriter.ts:70)
target.slice(current.length)assumescurrentis a character-for-character prefix oftarget, which breaks on case-normalizing filesystems whererealpathSyncchanges the byte-length. Usepath.join(realpathSync(current), path.relative(current, target))instead.
Should-fix
-
YAML header injection via embedded newlines (
yamlSerializer.ts:44-46)
Metadata values with embedded\ncan inject extra lines into the YAML comment header block, potentially adding content that looks like YAML directives. -
Absolute path bypass in build matrix (
buildConfigFile.ts:125)
Env-var expansion can yield absolute paths that skip the CWD-escape check. Not a vulnerability given the trusted-input contract, but worth guarding or documenting at the field level. -
resolveBuildEnvironmentLabelsilent NODE_ENV fallback (cli.ts:631)
Undocumented behavior whereNODE_ENVis used as the output label. A user who setsNODE_ENV=developmentin the build'senvironmentmap will silently get "development" as the output directory name. -
applyEnvVariablesmissing key validation (cli.ts:527)
Keys from--envare set directly onprocess.envwithout validation. ReuseisValidEnvVarNamefrombuildConfigFile.tsto reject malformed keys early. -
Hand-rolled YAML serializer (
yamlSerializer.ts)
js-yaml'sdump()already handles all the quoting edge-cases this custom serializer guards against. ReplacingYamlSerializerwith a thinyaml.dump()wrapper plus custom type definitions forFunctionandRegExpwould eliminate ~300 lines of fragile serialization logic.
Code quality
-
getConstructorNameduplicated 3x (configCleaner.ts,configSerializer.ts,yamlSerializer.ts)
Each has a near-identical implementation with subtly different return types. Extract to a shared utility to reduce drift. -
resolveRealPathedge case comment (fileWriter.ts)
The fallback when walking to the FS root is correct but the safety guarantee is not obvious. Add a short comment explaining the logic. -
**
console.log(\`)->console.log()** (cli.ts:639) Empty template literal is equivalent toconsole.log(""). Usingconsole.log()` makes the intent (blank line separator) clearer.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the two linked review comments from PR #8, then inspect the named locations in configCleaner.ts, cli.ts, fileWriter.ts, yamlSerializer.ts, and buildConfigFile.ts. Group the work by the Must-fix, Should-fix, and Code quality sections, confirming existing behavior before changing it. Done means the listed feedback is addressed or explicitly documented, including the security warnings and serialization, path, environment, and duplication concerns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, documentation, security, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100