Skip to content

fix: drop env reads and Object.is from dist to clear socket.dev alerts#3

Merged
SUP2Ak merged 2 commits into
mainfrom
fix/socket-supply-chain-v2
Apr 25, 2026
Merged

fix: drop env reads and Object.is from dist to clear socket.dev alerts#3
SUP2Ak merged 2 commits into
mainfrom
fix/socket-supply-chain-v2

Conversation

@SUP2Ak

@SUP2Ak SUP2Ak commented Apr 25, 2026

Copy link
Copy Markdown
Owner

What changed

Follow-up to #2 — both socket.dev alerts persisted on 1.0.1.
Root causes were different from what was assumed in the first pass.

Alert 1 — Environment variables (dist/dev.js)

socket.dev flags any process.env read, including NODE_ENV.
Removed env-based dev detection entirely. DEV is now a compile-time
true — warnings are on by default and fire at most once per process.
Users who want to suppress them call silenceWarnings() in their
production entry point. READMEs updated accordingly.

Behavior note: NODE_ENV=production no longer auto-disables
warnings. silenceWarnings() was always the documented opt-out;
this makes it the only one.

Alert 2 — URL strings (dist/p.d.ts, Package overview)

.is is a valid ccTLD (Iceland). socket.dev's URL scanner was treating
Object.is as a domain name in the compiled dist/p.d.ts (TypeScript
preserves JSDoc in declaration files). Replaced with "SameValue equality"
in the P.union JSDoc — same meaning, no false positive.

Why

Both alerts survived the 1.0.1 publish. Score stayed at 77.

Checklist

  • No engine files touched — no bench delta needed.
  • No new public API — no type tests needed.
  • silenceWarnings() behaviour unchanged.

SUP2Ak added 2 commits April 25, 2026 13:02
socket.dev flags any process.env read regardless of the var name.
Remove env-based detection entirely — DEV is a compile-time true.
Users call silenceWarnings() in their production entry point to opt out.
The warning still fires at most once per process, so the cost is minimal.

Closes socket.dev alert: Environment variables — dist/dev.js
socket.dev detects Object.is as a URL because .is is a valid ccTLD.
Replace with "SameValue equality" in the union JSDoc (which compiles
into dist/p.d.ts). Update READMEs to remove NODE_ENV mention and
document silenceWarnings() as the only opt-out mechanism.

Closes socket.dev alert: URL strings — Package overview
@SUP2Ak
SUP2Ak merged commit f8bfc50 into main Apr 25, 2026
1 check passed
@SUP2Ak
SUP2Ak deleted the fix/socket-supply-chain-v2 branch April 25, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant