🇰🇷 한글 설명
angular-server-side-configuration 라이브러리가 모노레포 환경에서 프로젝트 전체를 탐색하면서 백엔드용 환경 변수까지 감지하여 ngssc.json에 기록하고 index.html을 통해 노출시키는 취약점입니다. 버전 15.0.0에서 탐색 범위가 확장되어 발생하며, 민감한 정보가 클라이언트 측에 노출될 위험이 있습니다.
💡 쉬운 설명
서버에서만 사용해야 할 비밀번호 같은 중요한 정보가 실수로 웹사이트 화면 소스코드에 포함되어 누구나 볼 수 있게 되는 문제입니다. 모노레포 구조를 사용할 때 프로젝트 전체를 뒤지다가 엉뚱한 정보를 가져오는 것이 원인입니다.
🇺🇸 원문 (English)
angular-server-side-configuration helps configure an angular application at runtime on the server or in a docker container via environment variables. angular-server-side-configuration detects used environment variables in TypeScript (.ts) files during build time of an Angular CLI project. The detected environment variables are written to a ngssc.json file in the output directory.
During deployment of an Angular based app, the environment variables based on the variables from ngssc.json are inserted into the apps index.html (or defined index file). With version 15.0.0 the environment variable detection was widened to the entire project, relative to the angular.json file from the Angular CLI. In a monorepo setup, this could lead to environment variables intended for a backend/service to be detected and written to the ngssc.json, which would then be populated and exposed via index.html. This has NO IMPACT, in a plain Angular project that has no backend component. This vulnerability has been mitigated in version 15.1.0, by adding an option `searchPattern` which restricts the detection file range by default. As a workaround, manually edit or create ngssc.json or run script after ngssc.json generation.
📍 영향받는 시스템
angular-server-side-configuration version 15.0.0
⚔️ 공격 벡터
모노레포 구조 내 백엔드 환경 변수가 ngssc.json을 통해 index.html에 삽입되어 클라이언트에 노출됨
🛡️ 대응 방법
angular-server-side-configuration를 15.1.0 이상 버전으로 업데이트하거나 searchPattern 옵션을 사용하여 탐색 범위를 제한함