Skip to content

Commit f114bd7

Browse files
committed
feat: allowOutsideReadDir configuration
1 parent 045ceaf commit f114bd7

File tree

1 file changed

+13
-9
lines changed
  • packages/@angular/cli/models/webpack-configs

1 file changed

+13
-9
lines changed

packages/@angular/cli/models/webpack-configs/common.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -107,23 +107,26 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
107107

108108
if (!asset.allowOutsideOutDir) {
109109
const message = 'An asset cannot be written to a location outside of the output path. '
110-
+ 'You can override this message by setting the `allowOutsideOutDir` '
111-
+ 'property on the asset to true in the CLI configuration.';
110+
+ 'You can override this message by setting the `allowOutsideOutDir` '
111+
+ 'property on the asset to true in the CLI configuration.';
112112
throw new SilentError(message);
113113
}
114114
}
115115

116116
// Prevent asset configurations from reading files outside of the project.
117117
const projectRelativeInput = path.relative(projectRoot, asset.input);
118-
if ((projectRelativeInput.startsWith('..') || path.isAbsolute(projectRelativeInput)) && !asset.allowOutsideReadDir) {
118+
if ((projectRelativeInput.startsWith('..') || path.isAbsolute(projectRelativeInput))
119+
&& !asset.allowOutsideReadDir) {
120+
119121
const message = `${asset.input} cannot be read from a location outside the project.`
120-
+ 'You can override this message by setting the `allowOutsideReadDir` '
121-
+ 'property on the asset to true in the CLI configuration.';
122-
throw new SilentError(message);
122+
+ 'You can override this message by setting the `allowOutsideReadDir` '
123+
+ 'property on the asset to true in the CLI configuration.';
124+
throw new SilentError(message);
123125
}
124126

125-
if (asset.allowOutsideOutDir) {
126-
console.log(chalk.yellow('The allowOutsideOutDir option is on that could be a security risk'));
127+
if (asset.allowOutsideReadDir) {
128+
console.log(chalk.yellow('The allowOutsideReadDir option'
129+
+ ' is on that could be a security risk'));
127130
}
128131

129132
// Ensure trailing slash.
@@ -197,7 +200,8 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
197200
: 'rxjs/_esm5/path-mapping';
198201
const rxPaths = requireProjectModule(projectRoot, rxjsPathMappingImport);
199202
alias = rxPaths(nodeModules);
200-
} catch (e) { }
203+
} catch (e) {
204+
}
201205

202206
// Allow loaders to be in a node_modules nested inside the CLI package
203207
const loaderNodeModules = ['node_modules'];

0 commit comments

Comments
 (0)