Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validate env policy configs before proceeding with installation #6525

Merged
merged 11 commits into from
Oct 19, 2022

Conversation

zkochan
Copy link
Member

@zkochan zkochan commented Oct 6, 2022

Proposed Changes

@@ -957,6 +958,7 @@ export class DependencyResolverMain {
async getComponentEnvPolicyFromEnv(env: DependenciesEnv): Promise<EnvPolicy> {
if (env.getDependencies && typeof env.getDependencies === 'function') {
const policiesFromEnvConfig = await env.getDependencies();
validateEnvPolicy(policiesFromEnvConfig);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this validation to the EnvPolicyFactory().fromConfigObject function

export function validateEnvPolicy(envPolicy: EnvPolicyConfigObject) {
if (envPolicy.peers) {
for (const peer of envPolicy.peers) {
if (peer.supportedRange === '') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also validate that version exist

@zkochan zkochan enabled auto-merge (squash) October 19, 2022 16:18
@GiladShoham GiladShoham merged commit 174a724 into master Oct 19, 2022
@GiladShoham GiladShoham deleted the validate-env branch October 19, 2022 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants