Skip to content

Commit

Permalink
fix(secrets): fix host-rules in repo config (#10459)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins authored Jun 16, 2021
1 parent 4a99883 commit 9184207
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/config/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,15 @@ function replaceSecretsinObject(
return config;
}

export function applySecretsToConfig(config: RenovateConfig): RenovateConfig {
export function applySecretsToConfig(
config: RenovateConfig,
secrets = config.secrets
): RenovateConfig {
// Add all secrets to be sanitized
if (is.plainObject(config.secrets)) {
for (const secret of Object.values(config.secrets)) {
if (is.plainObject(secrets)) {
for (const secret of Object.values(secrets)) {
add(String(secret));
}
}
return replaceSecretsinObject(config, config.secrets);
return replaceSecretsinObject(config, secrets);
}
5 changes: 5 additions & 0 deletions lib/workers/repository/init/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { decryptConfig } from '../../../config/decrypt';
import { migrateAndValidate } from '../../../config/migrate-validate';
import { migrateConfig } from '../../../config/migration';
import * as presets from '../../../config/presets';
import { applySecretsToConfig } from '../../../config/secrets';
import { RenovateConfig } from '../../../config/types';
import {
CONFIG_VALIDATION,
Expand Down Expand Up @@ -218,6 +219,10 @@ export async function mergeRenovateConfig(
);
npmApi.setNpmrc(resolvedConfig.npmrc);
}
resolvedConfig = applySecretsToConfig(
resolvedConfig,
mergeChildConfig(config.secrets || {}, resolvedConfig.secrets || {})
);
// istanbul ignore if
if (resolvedConfig.hostRules) {
logger.debug('Setting hostRules from config');
Expand Down

0 comments on commit 9184207

Please sign in to comment.