Skip to content

Commit d2716c5

Browse files
committed
qhelp
1 parent dc09a68 commit d2716c5

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

javascript/ql/src/Security/CWE-312/BuildArtifactLeak.qhelp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,35 @@
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>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
}];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
}];

0 commit comments

Comments
 (0)