JSer.info #747 - Zod 4.1.0가 출시되어, 새로운 Codecs API가 추가되었다.
스키마 정의에 더해, 데이터의 encode/decode 정의 가능한 Codecs API가 새로히 추가되었다. 또한, .safeExtend() 메소드, z.has()나 z.hex() 새로운 밸리데이션 함수도 추가.
debug나 chalk 같은 저명한 npm 패키지가 공격 당해, 멀웨어를 포함한 버전이 공개되는 문제가 발생했다.
현재는 npm registry에서 해당 버전은 삭제.
- npm debug and chalk packages compromised
- 패키지 오너의 말: https://github.com/debug-js/debug/issues/1005#issuecomment-3266868187
영향 받은 패키지에는 [email protected], [email protected], [email protected]가 포함되어 있어, 해당 버전에는 브라우저에서 동작하는 멀웨어가 포함 삽입되어 있음. 현재 해당 버전 자체가 npm registry에서 삭제되었다.
멀웨어가 포함된 버전에 의존하는지는, 다음 명령어로 확인 가능.
# npm - 결과가 공란이면 영향 없음
npm list "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]"
# pnpm - 결과가 공란이면 영향 없음
pnpm list --depth=Infinity "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]"
# yarn은 list 명령어 없음
멀웨어가 node_modules나 빌드파일에 없는지 확인하려면, 다음 명령어로 확인 가능.
# ripgrep가 필요
rg -uu --max-columns=80 --glob '*.js' _0x112fa8
이번에는, 패키지 오너가 npm의 2중 인증을 켜두고 있었지만, 공격자는 피싱(피싱사이트 상에 TOTP도 입력 받기)을 이용해서 유효한 npm token를 취탈하고, 악의있는 버전을 공개했다.
다음 글에는, npm의 Trusted Publishing와 OIDC 사용해, CI에서 npm token 사용하지 않고 패키지 공개하는 방법에 대해 소개되어 있다.
npm Trusted Publishing 설정 방법, GitHub Actions으로 OIDC 설정, 단일/monorepo 패키지 운용 방법, GitHub의 Protection 설정에 대해서도 해설.
또한, npm의 Require two-factor authentication and disallow tokens 설정에 대해서도 작성되어 있다.
"Require two-factor authentication and disallow tokens"가 켜져있는 패키지는, 패키지 공개에도 2중 인증 필요하기에, npm 계정이 취탈되어도 여러번 MFA 인증해야 하므로, 피해를 적게할 가능성이 있다.
Node.js와 TypeScript으로 작성된 monorepo 애플리케이션을 node --experimental-strip-types으로 이행한 사례에 대해 소개한다.
monorepo와 node_modules 내의 코드에 --experimental-strip-types가 되지 않는 문제를, --conditions 플러그로 경로 조절해 해결. ESM으로 이행, stub 작성, CommonJS 대응, erasableSyntaxOnly 설정에 의한 미대응 구문 처리도 한다. TypeScript 코드를 직접 실행할 수 있게 하는 구체적 순서는 이하에 자세히 설명되어 있음.
Node.js v22.18.0 (LTS)에서 --experimental-strip-types는 플래그 없이, 기본적으로 Node.js가 TypeScript 파일 실행할 수 있음.
To support JSer.info
- 😘 Recommend JSer.info to your friends!
- ❤️ Support @azu on GitHub Sponsors/JSer.info Sponsors
- 🐦 Follow @jser_info on X(Twitter)
헤드라인
Release v4.1.0 · colinhacks/zod
github.com/colinhacks/zod/releases/tag/v4.1.0
zod 4.1.0 출시.
encode/decode 정의하는 Codecs API 추가, .safeExtend() 추가, z.has()/z.hex() 추가
Fresh 2.0 Graduates to Beta, Adds Vite Support | Deno
Fresh 2.0 Beta 출시.
Vite 사용한 HMR 대응, react의 alias 대응, <Head> 추가
Nuxt 4.1 · Nuxt Blog
Nuxt v4.1 출시.
Import Map를 사용한 chunk 캐시 개선, 실험적인 Rolldown 지원, getLayerDirectories 추가
읽을거리
fetch() 에는 Host 헤더를 설정하지도 못하는데 간단한 이야기가 아님 - Object.create(null)
susisu.hatenablog.com/entry/2025/08/31/190757
Fetch API와 Host 헤더에 대하여.
서버 사이드 실행 환경인 Node.js/Deno/Claudflare Workers 동작에 대하여
tsx와 Node.js Type Stripping 차이 - mizdra's blog
www.mizdra.net/entry/2025/08/28/122040
tsx 패키지와 Node.js의 Type Stripping 동작 차이에 대하여
Why I Won’t Use JSDOM | Epic Web Dev
www.epicweb.dev/why-i-won-t-use-jsdom
JSDOM 한계와 브라우저에서 컴포넌트 테스트에 대하여
npm Trusted Publishing에서 OIDC를 사용해 토큰없이 CI에서 npm 패키지 공개하기 | Web Scratch
efcl.info/2025/09/07/npm-oidc/
npm Trusted Publishing와 OIDC에 의해 토큰없이 CI/CD에서 npm 패키지 공개.
설정 순서, 브라우저 완결하는 출시 흐름,
신규/기존/monorepo 패키지 운용 방법, GitHub의 Protection 설정에 대하여
npm debug and chalk packages compromised
www.aikido.dev/blog/npm-debug-and-chalk-packages-compromised
debug와 chalk 저명한 npm 패키지에 브라우저에서 동작하는 멀웨어 포함 버전이 공개된 문제.
현재 npm registry에서 해당 버전은 삭제됨.
다음 패키지 버전에 영향을 줌.
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
- (RESOLVED) Version 4.4.2 published to npm is compromised · Issue #1005 · debug-js/debug
- npm debug, color-convert, backslash, error-ex, simple-swizzle, is-arrayish, color-name, color-string have incorrect wildcard version in their malware advisory (2025-09-08) · Issue #6099 · github/advisory-database
Bringing Node.js HTTP servers to Cloudflare Workers
blog.cloudflare.com/bringing-node-js-http-servers-to-cloudflare-workers/
Cloudflare Workers의 Node.js http server 대응에 대하여.
How we migrated our Rush.js monorepo to Node type stripping — Calm Blog
blog.calm.com/engineering/how-we-migrated-our-rushjs-monorepo-to-node-type-stripping
TypeScript로 작성된 Node.js 애플리케이션 코드 기반을 어떻게 type stripping으로 이행하였는가에 대하여.
monorepo와 node_modules에 코드가 있기에, node --experimental-strip-types가 적용되지 않지만, --conditions로 참조하는 경로 해결.
ESM으로 이행, stub, CJS 대응, erasableSyntaxOnly 미대응 구문 처리, node --experimental-strip-types로 실행한 이야기.
슬라이드, 영상
1부터 이해하는 Web Push - Speaker Deck
speakerdeck.com/dora1998/1karali-jie-suruweb-push
Web Push와 Push Service 관련하여.
Web Push가 어떤 식으로 동작하는지, 브라우저 벤더의 Push Server 구현에 대하여
도서
JavaScript/TypeScript 실력 강화서 | 기술평가사
gihyo.jp/book/2025/978-4-297-15194-2
2025년 9월 29일 발매
JavaScript/TypeScript 곤련한 책
