Class: Wurk::Encryption::ServerMiddleware
- Inherits:
-
Object
- Object
- Wurk::Encryption::ServerMiddleware
- Includes:
- Middleware::ServerMiddleware
- Defined in:
- lib/wurk/encryption.rb
Overview
Server middleware — peels the envelope before perform runs and puts it
back once the chain unwinds, success or failure. The job hash is shared
with every outer middleware and the processor; leaving plaintext in it
let any of them write the secret back to Redis (InterruptHandler's
re-push, limiter dead-routing) or hand it to an error reporter. A decrypt
failure (missing/rotated key, bad tag, a last argument that is no envelope)
is terminal and non-retryable, so rather than let it bubble into the 25× retry pipeline we route the
job straight to the dead set tagged encryption_error and ACK it via
JobRetry::Skip — see Wurk::Encryption.route_to_dead. Plaintext args
remain visible for triage per §4.6.
Constant Summary collapse
- NOT_SEALED_MESSAGE =
Never quotes the argument: it may be a secret in the clear.
'job has encrypt: true but its last argument is not a Wurk envelope, so it was not run. ' \ 'A producer without crypto enabled pushed it, or another implementation encrypted it. ' \ 'A retry re-seals the argument as it stands: retry only a job known to hold plaintext'
Instance Attribute Summary collapse
-
#config ⇒ Object
included
from Middleware::ServerMiddleware
Returns the value of attribute config.
Instance Method Summary collapse
- #call(_worker, job, _queue) ⇒ Object
- #logger ⇒ Object included from Middleware::ServerMiddleware
- #redis(idempotent: false) ⇒ Object included from Middleware::ServerMiddleware
- #redis_pool ⇒ Object included from Middleware::ServerMiddleware
Instance Attribute Details
#config ⇒ Object Originally defined in module Middleware::ServerMiddleware
Returns the value of attribute config.
Instance Method Details
#call(_worker, job, _queue) ⇒ Object
343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/wurk/encryption.rb', line 343 def call(_worker, job, _queue) return yield unless Wurk::Encryption.enabled? && job['encrypt'] sealed = job['args'] decrypt_last_arg!(job) begin yield ensure job['args'] = sealed end end |