mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 09:06:25 +00:00
fix(manager/terraform): Guard against empty module
and provider
fields (#20394)
This commit is contained in:
parent
2235659b18
commit
3eb96c9647
3 changed files with 27 additions and 0 deletions
|
@ -34,6 +34,12 @@ export class ModuleExtractor extends DependencyExtractor {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// istanbul ignore if
|
||||||
|
if (!is.plainObject(modules)) {
|
||||||
|
logger.debug({ modules }, 'Terraform: unexpected `modules` value');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const dependencies = [];
|
const dependencies = [];
|
||||||
for (const moduleElement of Object.values(modules).flat()) {
|
for (const moduleElement of Object.values(modules).flat()) {
|
||||||
const dep = {
|
const dep = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import is from '@sindresorhus/is';
|
import is from '@sindresorhus/is';
|
||||||
|
import { logger } from '../../../../../logger';
|
||||||
import type { PackageDependency } from '../../../types';
|
import type { PackageDependency } from '../../../types';
|
||||||
import { TerraformProviderExtractor } from '../../base';
|
import { TerraformProviderExtractor } from '../../base';
|
||||||
import type { TerraformDefinitionFile } from '../../hcl/types';
|
import type { TerraformDefinitionFile } from '../../hcl/types';
|
||||||
|
@ -18,6 +19,15 @@ export class ProvidersExtractor extends TerraformProviderExtractor {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// istanbul ignore if
|
||||||
|
if (!is.plainObject(providerTypes)) {
|
||||||
|
logger.debug(
|
||||||
|
{ providerTypes },
|
||||||
|
'Terraform: unexpected `providerTypes` value'
|
||||||
|
);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const dependencies = [];
|
const dependencies = [];
|
||||||
for (const providerTypeName of Object.keys(providerTypes)) {
|
for (const providerTypeName of Object.keys(providerTypes)) {
|
||||||
for (const providerTypeElement of providerTypes[providerTypeName]) {
|
for (const providerTypeElement of providerTypes[providerTypeName]) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import is from '@sindresorhus/is';
|
import is from '@sindresorhus/is';
|
||||||
|
import { logger } from '../../../../../logger';
|
||||||
import { DockerDatasource } from '../../../../datasource/docker';
|
import { DockerDatasource } from '../../../../datasource/docker';
|
||||||
import { HelmDatasource } from '../../../../datasource/helm';
|
import { HelmDatasource } from '../../../../datasource/helm';
|
||||||
import { isOCIRegistry } from '../../../helmv3/utils';
|
import { isOCIRegistry } from '../../../helmv3/utils';
|
||||||
|
@ -19,6 +20,16 @@ export class HelmReleaseExtractor extends DependencyExtractor {
|
||||||
if (is.nullOrUndefined(helmReleases)) {
|
if (is.nullOrUndefined(helmReleases)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// istanbul ignore if
|
||||||
|
if (!is.plainObject(helmReleases)) {
|
||||||
|
logger.debug(
|
||||||
|
{ helmReleases },
|
||||||
|
'Terraform: unexpected `helmReleases` value'
|
||||||
|
);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
for (const helmRelease of Object.values(helmReleases).flat()) {
|
for (const helmRelease of Object.values(helmReleases).flat()) {
|
||||||
const dep: PackageDependency = {
|
const dep: PackageDependency = {
|
||||||
currentValue: helmRelease.version,
|
currentValue: helmRelease.version,
|
||||||
|
|
Loading…
Reference in a new issue