amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

Check IAM policies for new access

Open sobolk opened this issue 1 year ago • 1 comments

Problem

Currently, we rely on PR reviews and unit tests to manage IAM policies.

This PR introduces a new mechanism that detects and flags elevation of privilege. The new check's intention is to drew reviewers and maintainers attention when IAM policies get more permissive. This is to increase a chance that accidental policy change is caught in review process.

Issue number, if available:

Changes

This check is adding new e2e test type.

The algorithm is:

  1. Find the baseline version of repository
    1. Which is base branch for PRs for pull request events
    2. Previous commit for push events
  2. Checkout, build and stash somewhere in filesystem the baseline version of repo
  3. Vend packages from baseline version
  4. Execute create amplify and deploy flow with baseline version
  5. Read all policies from deployed stacks
  6. Vend packages from current version
  7. Reinstall dependencies for sample app created in previous steps
  8. Redeploy the app
  9. Read all policies from deployed stacks
  10. Match and compare policies
  11. Report any access elevation and if present fail the check.

Corresponding docs PR, if applicable:

Validation

Checklist

  • [ ] If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change.
  • [ ] If this PR requires a change to the Project Architecture README, I have included that update in this PR.
  • [ ] If this PR requires a docs update, I have linked to that docs PR above.
  • [ ] If this PR modifies E2E tests, makes changes to resource provisioning, or makes SDK calls, I have run the PR checks with the run-e2e label set.

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

sobolk avatar Apr 30 '24 18:04 sobolk

🦋 Changeset detected

Latest commit: 2caca9cba6a98c550b5ad8a46f1f72caeeb9761a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Apr 30 '24 18:04 changeset-bot[bot]