File tree Expand file tree Collapse file tree
javascript/ql/src/Security/CWE-312 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "-//Semmle//qhelp//EN"
33 "qhelp.dtd">
44<qhelp >
5- <include src =" CleartextStorage.qhelp" /></qhelp >
5+ <overview >
6+ <p >
7+ Sensitive information included in a build artifact can allow an attacker to access
8+ the sensitive information if the artifact is published.
9+ </p >
10+ </overview >
11+
12+ <recommendation >
13+ <p >
14+ Only store information that is meant to be publicly available in a build artifact.
15+ </p >
16+ </recommendation >
17+
18+ <example >
19+ <p >
20+ The following example creates a <code >webpack</code > configuration that inserts all environment
21+ variables from the host into the build artifact:
22+ </p >
23+ <sample src =" examples/build-leak.js" />
24+ <p >
25+ The environment variables might include API keys or other sensitive information, and the build-system
26+ should instead insert only the environment variables that are supposed to be public.
27+ </p >
28+ <p >
29+ The issue has been fixed in the below, where only the <code >DEBUG</code > environment variable is inserted into the artifact.
30+ </p >
31+ <sample src =" examples/build-leak-fixed.js" />
32+ </example >
33+ <references >
34+ <li >webpack: <a href =" https://webpack.js.org/plugins/define-plugin/" >DefinePlugin API</a ></li >
35+ </references >
36+ </qhelp >
Original file line number Diff line number Diff line change 1+ const webpack = require ( "webpack" ) ;
2+
3+ module . exports = [ {
4+ plugins : [
5+ new webpack . DefinePlugin ( {
6+ 'process.env' : JSON . stringify ( { DEBUG : process . env . DEBUG } )
7+ } )
8+ ]
9+ } ] ;
Original file line number Diff line number Diff line change 1+ const webpack = require ( "webpack" ) ;
2+
3+ module . exports = [ {
4+ plugins : [
5+ new webpack . DefinePlugin ( {
6+ "process.env" : JSON . stringify ( process . env )
7+ } )
8+ ]
9+ } ] ;
You can’t perform that action at this time.
0 commit comments