Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/schematics/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,14 @@ export function featureToRules(
const config = dataConnectConfig;
let angularConfig: undefined | string;
if (config) {
if (config.package) {
// config.package and the connectorConfig values below come from the project's own
// dataconnect.yaml/connector.yaml, not from a trusted schema — reject anything that
// isn't a plausible package specifier before using it as a module name.
if (config.package && /^[^'"\\\n\r]+$/.test(config.package)) {
configAsStr = external("connectorConfig", config.package);
} else {
} else if (config.connectorConfig) {
configAsStr = `{${Object.keys(config.connectorConfig as ConnectorConfig).map(
(key) => `${key}: "${(config.connectorConfig as ConnectorConfig)[key]}"`
(key) => `${key}: ${JSON.stringify((config.connectorConfig as ConnectorConfig)[key])}`
).join(',')}}`;
}
if (config.angular) {
Expand Down