Docs: AppSync identity docstring says OPENID_CONNECT returns None, but the dispatch has no such path
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
What were you searching in the docs?
The identity property docstring on AppSyncEventBase (aws_lambda_powertools/utilities/data_classes/appsync_resolver_event.py), which is the reference for what object you get back per AppSync authorization mode.
Is this related to an existing documentation section?
How can we improve?
Two of the listed cases cannot be true as written, and they are still marked as unverified in the source.
get_identity_object only returns None when the identity mapping is None:
if identity is None:
return None
if "sub" in identity:
return AppSyncIdentityCognito(identity)
return AppSyncIdentityIAM(identity)
There is no path that yields None for a non-null identity. Yet the docstring says:
- AWS_LAMBDA authorization - returns None - NEED TO TEST
- OPENID_CONNECT authorization - returns None - NEED TO TEST
So each line can only hold if AppSync sends no identity object at all for that mode — which the code itself does not model, and which the two "NEED TO TEST" notes admit was never checked.
For OPENID_CONNECT specifically, AppSyncIdentityCognito exposes claims, issuer, groups and default_auth_strategy — those are the OIDC identity fields, so that class is already intended to serve OIDC events. Any OIDC identity carries sub, so it lands on AppSyncIdentityCognito, not on None.
I am deliberately not asserting what AWS_LAMBDA resolves to: its identity mapping is whatever the authorizer returns, there is no fixture for it here, and I have not verified it.
Got a suggestion in mind?
Two parts, both small:
- Correct the
OPENID_CONNECTline to state that it resolves toAppSyncIdentityCognito, and drop itsNEED TO TESTnote now that it is settled. - Add a test that pins the dispatch down — a non-null identity containing
subreturnsAppSyncIdentityCognito, a non-null identity withoutsubreturnsAppSyncIdentityIAM, and onlyNonereturnsNone— so the docstring and the behaviour cannot drift apart again.
I would leave the AWS_LAMBDA line as an open question rather than guess at it. Happy to open a PR if this is welcome.
Acknowledgment
- I understand the final update might be different from my proposed suggestion, or refused.
- Vorherrschende Sprache
- Python
- Sterne
- 3.3k
- Forks
- 511
- Ø Merge
- 3 T. 8 Std.
- Gemergte PRs (30 T.)
- 92
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus aws-powertools/powertools-lambda-python
-
Bug: POWERTOOLS_IDEMPOTENCY_DISABLED set to an empty or non-boolean value crashes every invocationEvtl. vergeben @lechakrawarthy hat das vor 1 Tag übernommen. Offenbug good first issue help wanted idempotency
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
aws-powertools/powertools-lambda-python#8728 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Bug: Redis layer fails the invocation instead of retrying when a record expires between SET NX and GETEvtl. vergeben @coughlmao hat das vor 1 Tag übernommen. Offenbug good first issue help wanted idempotency
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
aws-powertools/powertools-lambda-python#8727 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Bug: Redis orphan lock timeout ignores expires_after_seconds and is always 10 secondsEvtl. vergeben @CJstate hat das vor 1 Tag übernommen. Offenbug good first issue help wanted idempotency
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
aws-powertools/powertools-lambda-python#8726 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Bug: idempotency payloads with set, frozenset or bytes fields cannot be hashedEvtl. vergeben @Neeraj111010 hat das vor 1 Tag übernommen. Offenbug good first issue help wanted idempotency
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
aws-powertools/powertools-lambda-python#8725 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Bug: with a DynamoDB composite key, DataRecord.idempotency_key is the static partition key valueEvtl. vergeben @sumedh-aerram hat das vor 1 Tag übernommen. Offenbug good first issue help wanted idempotency
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
aws-powertools/powertools-lambda-python#8724 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in aws-powertools/powertools-lambda-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
huggingface/smolagents#3106 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
area:scripts area:tests bug priority:later
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Ikalus1988/MisakaNet#4358 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Discovered ports from service discovery are never propagated to modules in Module.load()Evtl. vergeben @vishalmore90 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
OWASP/Nettacker#1828 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
aws-samples/sample-per-model-bedrock#708 ·
Maintainer antworten meist innerhalb von 1 Tag
-
maintenance
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100