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

✨ add group_id to webhook events #684

Merged
merged 22 commits into from
Mar 11, 2024
Merged

Conversation

ff137
Copy link
Collaborator

@ff137 ff137 commented Mar 11, 2024

The acapy-wallet-groups and redis-events plugins were modified to be able to append the group_id to the webhook event metadata:

This PR updates to use those latest plugin releases, and updates the storage of transformed webhook events on redis to include the group_id in the redis key. This will allow us to query webhook events by group_id (in a follow-up PR).

Other amendments with this PR:

  • ✨ group_id is now validated to be <= 50 characters long, and not contain certain special characters (not necessary as we enforce group_id's, but makes sense because we previously use group_id's in HTML query params and now in redis keys)
  • ✨ ⚡ locked keys are now extended periodically in the AcaPyEventsProcessor + the EndorsementProcessor. This allows locks to exist as long as necessary.
  • 🐛 ✔️ locks are no longer manually deleted after processing is finished. We may as well let them expire, because deleting them early could open them up to a replica that got the key in a scan result and is now trying to process it despite it being deleted.
  • 📝 log levels updated in webhooks-service so no payloads are logged at info level -- only debug/trace + warning/error levels.
  • 🎨 renamed cloudapi webhooks prefix from "cloudapi_events:" to "cloudapi:"
  • ✨ added a match_keys method to the redis service, so we can match redis keys by wallet_id when the group_id is unkown. This is because group_id's are still optional in our ecosystem, and the SSE manager logic that is fetching events doesn't yet cater for fetching by group_id. Coming soon ™️

@ff137 ff137 requested a review from cl0ete March 11, 2024 11:02
@ff137 ff137 self-assigned this Mar 11, 2024
@ff137 ff137 added the enhancement New feature or request label Mar 11, 2024
webhooks/services/webhooks_redis_serivce.py Dismissed Show dismissed Hide dismissed
ff137 added 2 commits March 11, 2024 16:28
… can time out by themselves. This prevents a replica from trying to read a key that was included in their scan result, which has since been deleted with lock removed
@ff137 ff137 force-pushed the feat/add-group-id-to-webhooks branch from 2671cdc to a168315 Compare March 11, 2024 19:45
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
app
   main.py812668%74–77, 101, 103, 105, 109, 116, 142–147, 154–184
app/dependencies
   acapy_clients.py24292%36, 52
   auth.py561966%31, 37–38, 41, 52–55, 62–63, 68, 74–79, 83–86, 90–91, 96
   role.py34197%56
app/event_handling
   sse_listener.py41880%50–55, 79–84
   websocket_manager.py753257%32–38, 63–67, 86–89, 96–107, 114–124, 138
app/models
   issuer.py47296%34, 43
   tenants.py751580%93, 96, 105–115, 122, 125, 144–152
   verifier.py54885%30, 38–42, 79, 87–91
app/routes
   connections.py593934%25–39, 55–65, 79–93, 109–120, 139–146
   definitions.py2379759%82–139, 172–173, 223–225, 241–247, 277–278, 307–308, 318, 372–373, 384–385, 422–426, 438–439, 446–454, 486–534, 558–559, 598–668, 676–695
   issuer.py1733878%66, 97, 129–131, 164, 194–196, 204, 221, 320–330, 361–372, 405–436, 477, 490, 522
   jsonld.py624921%29–92, 103–141
   messaging.py21957%31–36, 56–63
   oob.py493235%26–65, 76–88, 112–122
   sse.py321553%37–43, 66–72, 99–107, 136–142, 173–184
   verifier.py1453278%58–60, 65, 103–105, 110, 152, 160–162, 167, 201–205, 214–216, 245–247, 253, 286–288, 293, 323–325, 359–361
   webhooks.py16475%30–34, 53–57
   websocket_endpoint.py18667%17–18, 27–28, 38–41
app/routes/admin
   tenants.py15012020%46–156, 165–189, 197–214, 224–234, 243–255, 265–305
app/routes/wallet
   credentials.py785431%31–40, 49–59, 68–78, 87–99, 110–122, 134–143, 152–162, 171–181
   dids.py752271%24–33, 50–51, 71–72, 84–91, 99–105
   jws.py392633%33–51, 67–85
   sd_jws.py392633%34–52, 69–87
app/services
   acapy_ledger.py691874%50–51, 77–79, 118–119, 132–151, 204–205
   acapy_wallet.py40490%61–62, 96–97
   revocation_registry.py1537650%211–212, 222–224, 275–280, 304–325, 345–372, 396–431, 483–487, 510–564
   sse.py715523%20–24, 36–49, 62–75, 91–108, 125–142, 160–183
   webhooks.py271833%14–24, 31–39
   websocket.py443423%19–22, 29–36, 45–79
app/services/issuer
   acapy_issuer_v1.py901386%32, 59–82, 163–164
   acapy_issuer_v2.py1022179%48–51, 71–105, 143, 189–190, 213
app/services/onboarding
   issuer.py38684%98–100, 117–119
   tenants.py624823%26–92, 102–132
   verifier.py36392%66, 82–86
app/services/onboarding/util
   register_issuer_did.py61789%85–87, 178–180, 195
   set_endorser_metadata.py693746%26–28, 46–48, 70–72, 103–120, 132–141, 153–164, 177–189
app/services/trust_registry
   actors.py107992%94–99, 109, 208–209, 211–216, 281–284
   schemas.py49492%56–61, 91–96
app/services/trust_registry/util
   actor.py31294%26–27
   issuer.py23483%39–40, 48–49
app/services/verifier
   acapy_verifier_v1.py1336849%36, 59–63, 74, 96–100, 105, 113, 137–141, 146, 159–169, 174–176, 182–196, 200–219, 223–235, 239–259
   acapy_verifier_v2.py1407447%40–45, 65–69, 81–86, 108–112, 117, 130–135, 149–153, 158, 171–183, 188–192, 198–212, 216–235, 239–253, 257–277
app/tests/admin
   test_onboarding.py86199%263
app/tests/e2e
   conftest.py21576%37–45
   test_credentials.py1201191%96–130
   test_jsonld.py641675%133–168
   test_tenants.py2801595%153, 197–198, 226, 558, 592–593, 602–603, 612–613, 625–626, 635–636
   test_trust_registry_integration.py63198%111
   test_verifier.py306199%37
   test_wallet_dids.py671085%92–107
app/tests/issuer
   test_issuer.py161299%293–296
app/tests/services
   test_revocation_registry.py87594%70, 116, 196, 240, 259
app/tests/util
   ecosystem_connections.py1352780%276–295, 312–332, 340–377
   ledger.py491080%34, 42, 54, 62–66, 76, 82
   member_acapy_clients.py36683%47–50, 65–66, 73–74
   trust_registry.py41393%26, 29–30
   webhooks.py25292%13, 57
app/tests/verifier
   utils.py1438938%174–188, 195–214, 226–263, 271–274, 280–291, 297–306, 311–364, 375–427, 440–466, 479–517, 531–569, 583–604, 615–631, 644–650, 664–680, 694–720
app/util
   acapy_issuer_utils.py18194%22
   acapy_verifier_utils.py1348239%40, 48–126, 157, 164–183, 187, 194–198, 206–210, 214–218, 225–255, 261–264
   credentials.py10460%8, 12–15
   retry_method.py32320%1–101
   tenants.py251348%12–19, 34–35, 42–49
endorser
   main.py33391%59–62
endorser/services
   endorsement_processor.py1381391%148–158, 191–195, 207, 219, 237–238, 247–251
endorser/services/dependency_injection
   container.py14193%54
endorser/util
   endorsement.py50884%55–56, 59–60, 63–67, 71–75
   transaction_record.py55689%51–52, 78–82, 95
   trust_registry.py34488%51–52, 63–67
trustregistry
   crud.py17615214%15–30, 34–46, 50–62, 66–78, 82–141, 145–161, 165–194, 200–214, 218–228, 232–252, 256–283, 287–302
   db.py29969%11–15, 19–23
   list_type.py10460%9–12, 15
   main.py411563%23–32, 54–59, 64
trustregistry/registry
   registry_actors.py825829%19–22, 27–38, 45–65, 72–82, 89–99, 106–116, 121–127
   registry_schemas.py654038%24–27, 34–51, 58–92, 97–108, 113–119
webhooks/models
   conversions.py63690%70, 83, 89, 110, 145, 163
webhooks/services
   acapy_events_processor.py1571392%151–161, 205, 233, 261–262, 286–290, 302–306
   sse_manager.py2263684%153, 155–168, 202–212, 241–242, 255–269, 324–328, 334–337, 339–342, 367–368, 411–413, 447, 458–459
   webhooks_redis_serivce.py991486%61–64, 67, 122–123, 206–207, 267, 273–274, 288–294
webhooks/services/dependency_injection
   container.py18194%61
webhooks/tests
   test_sse_manager.py161398%212–213, 219
webhooks/tests/e2e
   test_sse.py81495%121, 147–150
webhooks/web
   main.py42393%77–80
webhooks/web/routers
   sse.py16813718%34–38, 61–96, 121–154, 173–238, 260–301, 324–376
   webhooks.py301453%27–36, 50–63
TOTAL10068206380% 

Tests Skipped Failures Errors Time
321 2 💤 0 ❌ 0 🔥 11m 46s ⏱️

@ff137 ff137 merged commit 31fcab6 into development Mar 11, 2024
46 checks passed
@ff137 ff137 deleted the feat/add-group-id-to-webhooks branch March 11, 2024 20:14
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

Successfully merging this pull request may close these issues.

2 participants