Zum Hauptinhalt springen
LIVE
CVSS 6.5CVE-2026-111315 | The Smaily Connect plugin for WordPress is vulnerable to Insecure Direct Object Reference in versions up to, and including, 3.24.0 This is due to the smaily_get_edit_user_id() function reading an attacker-controlled $_GET['user_id'] parameter without performing any ownership or capability check, and then feeding that id into smaily_get_userdata() (which calls get_user_meta()) when rendering the WooCommerce My Account 'edit-account' form via the smaily_print_CVSS 6.4CVE-2026-137713 | Webmin through 2.670 before ae8feb1 allows XSS via an SVG attachment in a mail queue, relevant if an authenticated user uploads an SVG document and an administrator views it.CVSS 6.9CVE-2026-137678 | A security vulnerability has been detected in code-projects Online Job Portal 1.0. Affected by this issue is some unknown functionality of the file Admin/InsertUser.php. Such manipulation of the argument txtUserName/txtPassword leads to sql injection. The attack can be launched remotely. The exploit has been disclosed publicly and may be used.CVSS 5.3CVE-2026-137703 | Flask-AppBuilder before 5.3.1 contains a path traversal vulnerability in ImageManager.save_file that allows authenticated users to write image files outside IMG_UPLOAD_FOLDER via unsanitized multipart filenames. Attackers with add or edit permission on a ModelView with an ImageColumn can upload filenames containing ../ segments to create or overwrite image files like static assets.CVSS 6.1CVE-2026-130039 | The LiteSpeed Cache plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'REQUEST_URI' parameter in all versions up to, and including, 7.9.3 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page. Successful exploitation requires comments to be open, a comment author name containinCVSS 6.1CVE-2026-136206 | The Export Products, Orders & Customers for WooCommerce plugin for WordPress is vulnerable to Reflected Cross-Site Scripting via the 'start_date' parameter in all versions up to, and including, 2.4.3 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that execute if they can successfully trick a user into performing an action such as clicking on a link. SucCVSS 9.4CVE-2026-137706 | Smart Portal developed by Direk Tech has a Missing Authorization vulnerability. Authenticated remote attackers can add a specified account to the Active Directory Domain Admins group, thereby obtaining domain administrator privileges.CVSS 8.7CVE-2026-137705 | Smart Portal developed by Direk Tech has an Arbitrary File Read vulnerability.Unauthenticated remote attackers can exploit Relative Path Traversal to download arbitrary system files.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

Saga orchestrator in Python

Building a Saga orchestrator in Python: why existing tools weren't enough and what I learned designing one from scratch Distributed workflows break in a…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 8 Min. Lesezeit
Quelle: dev.to
Rubrik: Sichere Programmierung




Building a Saga orchestrator in Python: why existing tools weren't enough and what I learned designing one from scratch



Distributed workflows break in a specific, painful way. You charge a payment,

reserve inventory, then try to create a shipping label — and the shipping API

times out. The payment went through. The inventory is reserved. But the order

never completed.



Now what?



The naive fix is nested try/except blocks with manual cleanup calls. Every

developer has written this code. It works until the cleanup call fails, or the

process crashes between steps, or two workers process the same message

simultaneously. Then you have inconsistent state, angry customers, and no

clear path to recovery.




# The naive approach everyone writes first
async def process_order(order):
try:
payment = await charge_payment(order)
try:
reservation = await reserve_inventory(order)
try:
shipping = await ship_order(order)
except Exception:
await release_inventory(reservation) # what if THIS fails?
raise
except Exception:
await refund_payment(payment) # what if THIS fails?
raise
except Exception:
# now what?
raise






sagakit solves this with the Saga pattern: each step in a workflow declares an

explicit compensation handler. If a later step fails, sagakit automatically

runs the compensations in reverse order — releasing inventory, refunding the

payment — with retries, idempotency guarantees, and structured logging built

in. One docker run redis is all the infrastructure you need.







Why not existing tools?



Before building sagakit, I looked at the existing options.



Temporal is the gold standard for durable workflow orchestration. It

handles long-running workflows, versioning, and failure recovery with

guarantees that sagakit doesn't offer. But it requires a dedicated cluster, a

separate worker process, and significant operational investment. For a Python

backend engineer who needs to coordinate 3-5 steps reliably, it's a freight

train for a commute.



Celery is designed for task queues — background jobs, periodic tasks,

fan-out processing. It doesn't have a native model for compensating

transactions. You can approximate it, but you end up building the compensation

logic yourself anyway, without the primitives to do it safely.



Manual try/except is what everyone writes first (see the code above). It

fails silently when the cleanup call itself fails, offers no protection against

duplicate processing when a message is redelivered, and becomes unmaintainable

past three steps.



I wanted something that required only Redis — which most Python backends

already run — made compensation logic explicit and co-located with the step it

undoes, and felt like idiomatic async Python. That's sagakit.







Three design decisions worth explaining





1. Orchestration over choreography



Sagas can be implemented two ways. In choreography, each service reacts

autonomously to events — payment-service publishes payment.charged,

inventory-service listens and reserves, and so on. No central coordinator

exists.



sagakit uses orchestration: a central executor drives each step explicitly, in

order. The entire workflow is defined in one place and readable top to bottom.



The tradeoff is real — orchestration introduces a coordinator that choreography

avoids. But for a library targeting clarity and testability, having the

workflow in one file is worth it. You can read a saga definition and

immediately understand what it does, what it compensates, and in what order.

With choreography, that understanding is reconstructed from events scattered

across services.





2. Idempotency keys don't include the attempt number



The original design used saga_id:step_name:attempt_number as the idempotency

key. It seemed logical — each attempt is a distinct event, so each gets a

distinct key.



The problem: if charge_payment fails on attempt 1 and retries as attempt 2,

the key changes. When the step passes ctx.idempotency_key to Stripe, Stripe

sees two different keys and treats them as two separate charges. The customer

gets billed twice.



The fix was simple but required changing the design mid-project: drop

attempt_number from the key. All retries of the same step share

saga_id:step_name. Stripe — and any other external system that accepts an

idempotency key — sees the same identifier across all attempts and returns the

same result without re-executing the side effect.



attempt_number still exists in SagaContext for logging and observability.

It just doesn't affect the key.





3. reject() uses XACK + XADD instead of XCLAIM



When a step fails and needs to be retried, the message must be returned to the

stream for reprocessing. The obvious Redis primitive is XCLAIM — reassign the

message to a consumer so it can retry.



The problem: XCLAIM keeps the message tied to the original consumer. If that

consumer is down, the message sits in the Pending Entries List indefinitely.

No other worker can claim it. The saga is silently stuck.



sagakit uses XACK + XADD instead. The original message is acknowledged

(removed from the PEL), and a new message with the same payload is published

to the stream. Any available consumer in the group can pick it up — the retry

is not tied to the worker that originally failed.



The re-published message carries a requeue_count attribute incremented on

each rejection, so the executor can detect pathological retry loops and route

to the DLQ after a threshold.







Seeing it in action



The happy path — all three steps complete successfully:




[info] payment.charged     amount=99.99 payment_id=pay_718836cb
[info] inventory.reserved reservation_id=res_718836cb
[info] order.shipped tracking_id=trk_718836cb

Status : completed
Results :
charge_payment → pay_718836cb
reserve_inventory → res_718836cb
ship_order → trk_718836cb






The failure path — ship_order fails, sagakit retries with exponential

backoff, exhausts attempts, then compensates in reverse order:




[info]    payment.charged     amount=99.99 payment_id=pay_6856bd2b
[info] inventory.reserved reservation_id=res_6856bd2b
[warning] step.retrying attempt=1 delay=0.052s error='Shipping API down'
[warning] step.retrying attempt=2 delay=0.170s error='Shipping API down'
[error] step.exhausted_retries attempts=3 error='Shipping API down'
[info] inventory.released ← compensation
[info] payment.refunded ← compensation

Status : compensated
Failed at : ship_order
Rolled back: reserve_inventory, charge_payment






Two things worth noticing in the failure output. First, the backoff is visible

in the logs — 52ms, then 170ms, with ±50% jitter applied. Second,

compensations run in strict reverse order: inventory before payment, because

that's the reverse of how they were acquired. sagakit guarantees this order

regardless of which step fails.



To reproduce: FAIL_AT_STEP=ship_order python run.py









Three things I learned building this






Compensation is not rollback



Coming from a relational database background, my first mental model of

compensation was "undo" — run the saga backwards and erase what happened.

That's not what compensation is.



A database rollback destroys state retroactively. It's as if the transaction

never happened — no trace, no intermediate state, no customer-visible effect.



Compensation is new forward-moving business logic that repairs the damage.

Refunding a payment is not the same as never charging it. The customer sees

two transactions on their bank statement. The inventory system received a

reservation and then a cancellation — it may have allocated physical space in

the interim. Other systems may have reacted to the original action before the

compensation ran.



This distinction has real consequences for how you write compensation handlers.

They cannot assume the system is in the same state it was when the forward step

ran. They must be written defensively, assuming that time has passed and other

things have happened.






Design decisions reveal their flaws during implementation



The idempotency key started as saga_id:step_name:attempt_number. It seemed

correct on paper — each attempt is a distinct event, so each gets a distinct

identifier.



The flaw only became visible when I thought through the implementation

concretely: if the key changes between retries, external systems like Stripe

see different keys and treat each attempt as a new transaction. A payment gets

charged twice.



The fix was one line of code. But it required updating the ADR, the

implementation, and the tests — and more importantly, it required catching the

assumption before it shipped.



This is why I wrote Architecture Decision Records before writing code. The ADR

for idempotency forced me to think through the key construction explicitly,

which is when the flaw surfaced. Without that document, the bug would have

lived in the code until a real payment was doubled.






Writing the decision before writing the code



I had never written an Architecture Decision Record before this project. My

previous approach was the common one: make a decision, write the code, maybe

add a comment explaining why.



The difference with ADRs is that you document not just what you decided, but

what you considered and rejected — and why. That forces a level of rigor that

commenting doesn't. You can't write "rejected because operationally heavy"

without first asking yourself: heavy compared to what? Heavy for whom?



Four ADRs later, the project has a paper trail of every major architectural

choice: why Sagas over 2PC, why Redis Streams over Kafka, how idempotency

works, what compensation guarantees are provided and which aren't. A new

contributor — or a future version of me — can read those documents and

understand not just what the system does, but why it exists in this shape.



I won't build a non-trivial system without them again.









Try it yourself



sagakit is pre-alpha — the API may change, and it hasn't been benchmarked in

production. But it works, it's tested, and the order-processing example runs

in under five minutes with a single docker compose up -d.



If you're building event-driven workflows in Python and the naive try/except

approach is starting to hurt, give it a try and let me know what breaks.



→ github.com/diegogue88/sagakit



What patterns do you use for distributed transactions in Python? I'd love to

hear what's working — and what isn't — in the comments.

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Communitydiscussie & reacties

🌐 Naar de hoofdchat

Start de discussie in de Social Chat broadcaststream of dien hierboven een vakbijdrage in via het aanvulformulier.

Community Rating & Social Proof
⭐ Lezersbeoordeling
–
Ø / 5.0
Nog geen recensies van lezers
Was dit artikel nuttig?
0
Geef uw beoordeling
Detailbeoordeling (optioneel)
Inhoud & Kwaliteit
Bron & Geloofwaardigheid
Actualiteit
Security Briefing Gratis · 1-klik uitschrijven

Intelligence Digest gratis

Dagelijks het belangrijkste beveiligingsnieuws · kan op elk moment worden opgehaald

Verwant Story Cluster & Sources (vector AI)

6 Cluster
41 Bronnen
Best Black Friday MacBook Air deals: biggest discounts on Apple's thin and light laptop range
Latest from TechRadar 42 min. geleden
40 andere bronnen
Latest from TechRadar32 min. geledenProton VPN vs ExpressVPN – which secure VPN should you pick this Black Friday? WIRED9 uur geledenThe 108 Best Black Friday Deals Are Now Live: Our Expert Picks for 2026 WIRED39 min. geleden20 Best Black Friday Tech Deals (2026) WIRED37 min. geledenThe 10 Best Black Friday TV Deals (2026): Save Up to 53% Off Giga.de29 min. geledenBlack Friday 2026 bei Back Market: Dyson, Ninja und GoPro jetzt deutlich günstiger Cyber Security News1 uur geledenBlack Friday or Black Fraud Day? 7 Cyber Traps to Watch Out for Before You Click ‘Buy’ CNET2 dagen geledenLive: Black Friday Is Here. Shop Our Favorite Deals and Save Up to 60% Apple, Anker, Bose and More WIRED52 min. geleden22 Best Black Friday Deals Under $100 (2026) WIRED50 min. geledenBest Black Friday Phone Deals (2026): iPhone, Pixel, and More The Verge57 min. geledenThe absolute best Black Friday deals we’ve found (so far) Giga.de49 min. geledenAirPods Pro 3 im Black-Friday-Sturzflug: So günstig waren Apples Top-In-Ears noch nie PC-WELT47 min. geledenBlack Friday bei Amazon Haul: 20 Prozent Rabatt auf Powerbanks, Batterieprüfer, Speichersticks und mehr PC-WELT47 min. geledenBlack Friday bei Amazon Haul: 20 Prozent Rabatt auf Powerbanks, Batterieprüfer, Speichersticks und mehr t3n.de1 uur geledenKindle, Echo Dot, Fire TV: Diese neuen Amazon-Geräte sind zum Black Friday stark reduziert Macerkopf.de1 uur geledenAmazon Black Friday Woche: iPad Air, iPhone 18 Cases, AirTag 2, Fire TV Sticks, Echo Dot und mehr appgefahren.de1 uur geledenJMGO mit Black Friday-Deals: Heimkino-Bundles bis zu 60 Prozent günstiger PC-WELT1 uur geledenGoogle Pixel 11 jetzt unglaubliche 430 Euro günstiger im Black-Friday-Deal: Tiefstpreis bei Amazon PC-WELT1 uur geledenNorton 360 Premium-Security an Black Friday nur 19,99 Euro statt 100 Euro Latest from TechRadar1 uur geledenThe best Black Friday headphone deals: Sony, AirPods and more Latest from TechRadar1 uur geledenBest Black Friday mini PC deals 2026 live: Save on desktops from Apple, Geekom, GMKtec, Minisforum, and more Golem.de1 uur geledenAnzeige: Amazon startet mit Glücksrad-Gewinnspiel in den Black Friday Latest from TechRadar1 uur geledenThese smart and polished backpacks have accompanied me to events all over the world — and they're now 30% for Black Friday PC-WELT1 uur geledenRiesiger 75 Zoll 4K-QLED-Fernseher fällt bei Amazon auf nur 469 Eur im Black-Friday-Angebot PC-WELT1 uur geledenBlack Friday: Beliebte Mähroboter von Mammotion jetzt ab 599 Euro Latest from TechRadar1 uur geledenSave up to around £200 on these top mini PCs for Black Friday — with multiple options and configurations available for your exact needs or preferences Caschys Blog3 uur geledenFlexiSpot Black Friday 2026: Bis zu 40 % Rabatt auf Bestseller bei Amazon Golem.de1 uur geledenBlack Friday: Verdi mobilisiert bei Amazon in Gera nur wenige PC-WELT1 uur geledenNotebooksbilliger Black Friday: 150 Euro Extra-Rabatt – Laptops unter 300 Euro appgefahren.de1 uur geledentink.de bietet bis zu 50 Euro Extra-Rabatt auf Black-Friday-Angebote PC-WELT1 uur geledenNotebooksbilliger Black Friday: 150 Euro Extra-Rabatt – Laptops unter 300 Euro Latest from TechRadar2 uur geledenWhich all-in-one Black Friday VPN bundle is really worth it? I compared NordVPN Prime, ExpressVPN Pro, and Proton Unlimited — all under $7 a month — to decide PC-WELT2 uur geledenAmazon verlost an Black Friday Einkaufsgutscheine im Wert von 2.000 Euro PC-WELT2 uur geledenAmazon verlost an Black Friday Einkaufsgutscheine im Wert von 2.000 Euro t3n.de2 uur geledenZum Black Friday bei Ecoflow den Heimspeicher fürs Frühjahr sichern PC-WELT2 uur geledenBlack Friday ist da! Die besten Technik-Deals bei Amazon am 27.11. GamingOnLinux Latest Articl…2 uur geledenValve update the Discounts & Events page for Black Friday sales Latest from TechRadar2 uur geledenI'm an Audio Editor and these are the only cheap hi-fi and headphone deals I want you to see this Black Friday t3n.de2 uur geledenFritzbox am Black Friday: 9 gute Angebote rund um Router und Repeater PC-WELT2 uur geledenBlack Friday bei Amazon Haul: Bis zu 20 Prozent Rabatt auf Powerbanks, Bosch-Produkte und mehr PC-WELT2 uur geledenBlack Friday bei Amazon Haul: Bis zu 20 Prozent Rabatt auf Powerbanks, Bosch-Produkte und mehr
17 Bronnen
Google will soon share Android developers' addresses publicly
Engadget - Technology News & Expert Reviews 54 min. geleden
16 andere bronnen
VulDB Updates1 uur geledenCVE-2026-95429 | Google Android BrEdrDynamicChannel bredr_dynamic_channel.cc resource consumption VulDB Updates1 uur geledenCVE-2026-95434 | Google Android LowEnergyScanner low_energy_scanner.cc NotifyPeerFound resource consumption VulDB Updates1 uur geledenCVE-2026-95441 | Google Android Bluetooth connection.cc OnDisconnectionComplete denial of service VulDB Updates1 uur geledenCVE-2026-95422 | Google Android periodic_advertising_synchronizer.cc OnSyncEstablished assertion VulDB Updates1 uur geledenCVE-2026-95423 | Google Android local_service_manager.cc OnWriteCCC null pointer dereference VulDB Updates1 uur geledenCVE-2026-95447 | Google Android SDP Client client.cc OnRxFrame memory corruption VulDB Updates1 uur geledenCVE-2026-95421 | Google Android Command Processing bredr_signaling_channel.cc DecodeRxUnit use after free VulDB Updates1 uur geledenCVE-2026-95435 | Google Android advertising_data.cc FromBytes out-of-bounds VulDB Updates1 uur geledenCVE-2026-95446 | Google Android credit_based_flow_control_rx_engine.cc ProcessPdu input validation VulDB Updates1 uur geledenCVE-2026-95420 | Google Android Pairing security_manager.cc OnEncryptionChange privileges management VulDB Updates1 uur geledenCVE-2026-95419 | Google Android Bluetooth Security Manager security_manager.cc OnPairingRequest unusual condition VulDB Updates1 uur geledenCVE-2026-95416 | Google Android Link Encryption Key security_manager.cc OnPairingFailed denial of service VulDB Updates1 uur geledenCVE-2026-95415 | Google Android RemoteCharacteristic remote_characteristic.cc denial of service VulDB Updates1 uur geledenCVE-2026-95417 | Google Android remote_characteristic.cc ResolvePendingNotifyRequests use after free VulDB Updates1 uur geledenCVE-2026-95414 | Google Android http_file_request_handler.cc GetFilePath path traversal VulDB Updates1 uur geledenCVE-2026-95418 | Google Android logical_link.cc LogicalLink::SignalError use after free
Soortgelijke bijdragen
🔍 Verwandte News

Auch interessante Nachrichten Saga orchestrator in Python

Thematisch verwandte Begriffe: Saga, orchestrator, Python · 6 Treffer

Laden...

Video's zijn geladen...

Laden...

Bijdragen zijn geladen ...

Laden...

Video's zijn geladen...

Laden...

Bijdragen zijn geladen ...

Laden...

Video's zijn geladen...

Laden...

Bijdragen zijn geladen ...

Laden...

Video's zijn geladen...

💬 Reacties worden geladen…
Trek om te vernieuwen
Widgets & Topics
Loading widgets…
Nächster Beitrag