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

Use MaxResults/pagination for list_secrets in AWS Secrets Manager - or switch to describe_secret instead #107

Open
lancenz opened this issue Dec 14, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@lancenz
Copy link

lancenz commented Dec 14, 2022

In services/aws.py:list_secret_names() there is no MaxResults nor any pagination code - so in any account with a lot of secrets, it may not return the secret being used - which will then cause create_or_update_secret() to fail creating a new secret instead of updating the existing one.

Alternatively, could refactor the code to call describe_secret instead of list_secrets as this would reduce the IAM policy requirements and also fix pagination issues at the same time.

Thanks, this tool is really helpful :)

@KiraLT KiraLT added the enhancement New feature or request label Dec 27, 2022
@KiraLT KiraLT closed this as completed in b16cc62 Dec 28, 2022
@lancenz
Copy link
Author

lancenz commented Jan 9, 2023

@KiraLT - Thanks for the update - but... the v0.4.0 build zip file seems to be a bit broken. After upgrading I get this error in AWS Lambda.

{
  "errorMessage": "Failed to resolve requirements from PEX environment @ /var/task.\nNeeded cp39-cp39-manylinux_2_26_x86_64 compatible dependencies for:\n 1: cryptography>=2.5.0\n    Required by:\n      acme 2.1.0\n      certbot 2.1.0\n    But this pex had no ProjectName(raw='cryptography', normalized='cryptography') distributions.\n 2: cryptography>=1.5\n    Required by:\n      josepy 1.13.0\n    But this pex had no ProjectName(raw='cryptography', normalized='cryptography') distributions.\n 3: cryptography<39,>=38.0.0\n    Required by:\n      pyOpenSSL 22.1.0\n    But this pex had no ProjectName(raw='cryptography', normalized='cryptography') distributions.\n 4: cryptography>=2\n    Required by:\n      dns-lexicon 3.11.7\n    But this pex had no ProjectName(raw='cryptography', normalized='cryptography') distributions.",
  "errorType": "ResolveError",
  "requestId": "",
  "stackTrace": [
    "  File \"/var/lang/lib/python3.9/importlib/__init__.py\", line 127, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n",
    "  File \"<frozen importlib._bootstrap>\", line 1030, in _gcd_import\n",
    "  File \"<frozen importlib._bootstrap>\", line 1007, in _find_and_load\n",
    "  File \"<frozen importlib._bootstrap>\", line 986, in _find_and_load_unlocked\n",
    "  File \"<frozen importlib._bootstrap>\", line 680, in _load_unlocked\n",
    "  File \"<frozen importlib._bootstrap_external>\", line 850, in exec_module\n",
    "  File \"<frozen importlib._bootstrap>\", line 228, in _call_with_frames_removed\n",
    "  File \"/var/task/main.py\", line 34, in <module>\n    bootstrap_pex_env(__entry_point__)\n",
    "  File \"/var/task/.bootstrap/pex/pex_bootstrapper.py\", line 684, in bootstrap_pex_env\n    PEXEnvironment.mount(entry_point, pex_info).activate()\n",
    "  File \"/var/task/.bootstrap/pex/environment.py\", line 321, in activate\n    self._activated_dists = self._activate()\n",
    "  File \"/var/task/.bootstrap/pex/environment.py\", line 671, in _activate\n    resolved = self.resolve()\n",
    "  File \"/var/task/.bootstrap/pex/environment.py\", line 502, in resolve\n    for fingerprinted_distribution in self.resolve_dists(all_reqs)\n",
    "  File \"/var/task/.bootstrap/pex/environment.py\", line 589, in resolve_dists\n    raise ResolveError(\n"
  ]
}

@KiraLT KiraLT reopened this Jan 9, 2023
@Foovanadil
Copy link

FYI I am also getting this Failed to resolve PEX error with the .40 zip. I downgraded to the .30 zip and still get the problem? Hopefully this is helpful.

Thanks for the work, this saved me a bunch of time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants