Skip to content

Commit 937b412

Browse files
fix: validate runtime config parsing
1 parent 3040a38 commit 937b412

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

runtime/initialize.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,13 @@ async function runtimeConfig() {
181181
}
182182

183183
const { data } = await apiService.get(runtimeConfigUrl.toString(), apiConfig);
184+
if (!data || typeof data !== 'object' || Array.isArray(data)) {
185+
throw new TypeError('Runtime config must be a valid JSON object.');
186+
}
184187
mergeSiteConfig(data, { limitAppMergeToConfig: true });
185188
}
186189
} catch (error) {
187-
console.error('Error with config API', error.message);
190+
console.error('Error with config API:', error.message);
188191
}
189192
}
190193

0 commit comments

Comments
 (0)