Skip to content

fix: prevent init if local files belong to other app #13954

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

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

sobolk
Copy link
Member

@sobolk sobolk commented Oct 4, 2024

Description of changes

This PR adds validation to make sure that AppId passed via command line parameters match with appid stored in metadata files.

This is similar to existing validation that pull does here

if (inputAppId && appId && inputAppId !== appId) {
throw new AmplifyError('InvalidAmplifyAppIdError', {
message: `Amplify appId mismatch.`,
resolution: `You are currently working in the amplify project with Id ${appId}`,
});

Issue #, if available

Description of how you validated changes

I did the following manually:

  1. Created an app. Appid d2qe95s9uhn10w
  2. Attempted to run init flow with different app id , i.e. amplify init --amplify "{\"envName\":\"dev\",\"appId\":\"d3jmsv5lpeg234\"}" --yes --forcePush

image

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sobolk sobolk requested a review from a team as a code owner October 4, 2024 00:15
@sobolk sobolk merged commit d79627c into aws-amplify:dev Oct 4, 2024
5 of 6 checks passed
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.

3 participants