Author SHA1 Message Date
renovate-bot 39fa08e1c4 Update dependency lxml to v6.1.3 2026-11-18 06:10:36 +00:00
julienfastre bac18a832a Merge pull request 'Configure Renovate' (#4) from renovate/configure into main
Build image and push it to registry / build (push) Successful in 40s
Reviewed-on: #4
2026-11-17 19:37:38 +00:00
renovate-bot 9afef46888 Add renovate.json 2026-09-29 11:06:01 +00:00
julienfastre adba75fd24 Add byUserId to message payload in worker for enhanced metadata
Build image and push it to registry / build (push) Successful in 1m25s
2026-05-20 22:41:46 +02:00
julienfastre 7c1d645447 Update dependencies in requirements.txt to latest versions
Build image and push it to registry / build (push) Successful in 1m23s
2026-05-20 16:00:48 +02:00
julienfastreandClaude Sonnet 4.6 dadf3d72e3 Fix infinite retry loop on signing errors in worker
Catch SigningError separately (logged at ERROR level) and fix the ack/nack
logic so failed messages are requeued once then discarded, instead of being
requeued indefinitely or lost. Remove the bare `raise e` that crashed the
worker after each error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 15:36:54 +02:00
julienfastre 083bf20be7 update deps, switching pyhanko to version 0.29
Build image and push it to registry / build (push) Successful in 2m0s
2025-06-05 13:33:38 +02:00
julienfastre 6626b33c6a upgrade idea settings 2025-06-05 13:33:38 +02:00
julienfastre 8a3c44c517 test signature with return line 2025-06-05 13:33:38 +02:00
julienfastre c7a6283e00 Add timezone configuration to Dockerfile
Build image and push it to registry / build (push) Successful in 1m11s
Included tzdata package and set the timezone to Europe/Paris by creating a symbolic link in /etc/localtime. This ensures the container runs with the correct timezone settings.
2024-11-06 14:46:45 +01:00
julienfastre 0e7d01f0fd Fix environment password encoding in SignOrchestrator init
Build image and push it to registry / build (push) Successful in 6m47s
Previously, the `PKCS12_PASSWORD` environment variable was used directly, which could lead to issues when it was not set. This change ensures the password is properly encoded when provided and defaults to `None` if not set.
2024-10-22 16:37:49 +02:00
julienfastre 39b9f7455c Update README section title for clarity
Changed the title "Préparation pour Vendée" to "Préparation à partir d'un certificat d'horodatage au format pkcs12" for better clarity and specificity. This update helps users understand the section's purpose more easily.
2024-10-22 16:37:31 +02:00
8 changed files with 52 additions and 32 deletions

No files matched your search

+1 -1
View File
@@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.10 (pythonProject)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (pythonProject)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 virtualenv at ~/dev/chill/sign-pdf-worker/pythonProject/.venv" project-jdk-type="Python SDK" />
</project>
+1 -1
View File
@@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/pythonProject/.venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.10 virtualenv at ~/dev/chill/sign-pdf-worker/pythonProject/.venv" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+4 -1
View File
@@ -5,7 +5,10 @@ FROM python:3.10-alpine
WORKDIR /app
# add required clis
RUN apk add --no-cache openssl
RUN apk add --no-cache openssl tzdata
# set timezone
RUN ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
# Copy requirements.txt to the Docker container
COPY requirements.txt .
+19 -17
View File
@@ -1,20 +1,22 @@
asn1crypto==1.5.1
certifi==2024.6.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cryptography==42.0.8
idna==3.7
certifi==2026.5.20
cffi==2.0.0
charset-normalizer==3.4.7
click==8.4.0
cryptography==48.0.0
idna==3.15
lxml==6.1.3
oscrypto==1.3.0
pika==1.3.2
pycparser==2.22
pyHanko==0.25.0
pyhanko-certvalidator==0.26.3
pika==1.4.0
pika-stubs==0.1.3
pycparser==3.0
pyHanko==0.35.1
pyhanko-certvalidator==0.31.1
pypng==0.20220715.0
PyYAML==6.0.1
qrcode==7.4.2
requests==2.32.3
typing_extensions==4.12.2
tzlocal==5.2
uritools==4.0.3
urllib3==2.2.2
PyYAML==6.0.3
qrcode==8.2
requests==2.34.2
typing_extensions==4.15.0
tzlocal==5.3.1
uritools==6.1.1
urllib3==2.7.0
+6 -2
View File
@@ -13,9 +13,13 @@ orchestrator = SignOrchestrator('./assets/dummy.p12',
pkcs12_password=None)
with open('./assets/test.pdf', 'rb') as input:
signed_content = orchestrator.sign(reason="first signer", signature_index=None,
signed_content = orchestrator.sign(reason="first\nsigner\nreturn\ntext", signature_index=None,
input_content=input.read(), box_place=(300, 600, 500, 660), on_page=0,
signer_text="Mme Caroline Diallo")
signer_text="""Mme Caroline Diallo
with
return
text
""")
with open('./assets/test_signed_0.pdf', 'wb') as output:
output.write(signed_content.read())
+17 -9
View File
@@ -5,6 +5,7 @@ import os
import pika
import sign
from pyhanko.sign.general import SigningError
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
@@ -26,7 +27,7 @@ TSA_CONFIG_PATH = os.environ.get('TSA_CONFIG_PATH')
TSA_CERT_CHAIN = os.environ.get('TSA_CERT_CHAIN')
TSA_KEY_PASSWORD = os.environ.get('TSA_KEY_PASSWORD')
orchestrator = sign.SignOrchestrator(PKCS12_PATH, TSA_CONFIG_PATH, TSA_KEY_PASSWORD, TSA_CERT_CHAIN, pkcs12_password=os.environ.get('PKCS12_PASSWORD', None))
orchestrator = sign.SignOrchestrator(PKCS12_PATH, TSA_CONFIG_PATH, TSA_KEY_PASSWORD, TSA_CERT_CHAIN, pkcs12_password=None if os.environ.get('PKCS12_PASSWORD', None) is None else os.environ.get('PKCS12_PASSWORD').encode())
parameters = pika.URLParameters(DSN)
connection = pika.BlockingConnection(parameters)
@@ -60,6 +61,7 @@ def on_message(channel, method_frame, header_frame, body):
channel.basic_publish(exchange=EXCHANGE_OUT,
body=json.dumps({'signatureId': body_content['signatureId'],
'signatureZoneIndex': body_content['signatureZoneIndex'],
'byUserId': body_content['byUserId'] if 'byUserId' in body_content else None,
'content': base64.b64encode(signed.read()).decode('utf-8')}),
properties=pika.BasicProperties(content_type='application/json',
delivery_mode=pika.DeliveryMode.Transient),
@@ -67,16 +69,22 @@ def on_message(channel, method_frame, header_frame, body):
LOGGER.debug("signed file resend to amqp")
channel.basic_ack(delivery_tag=method_frame.delivery_tag)
except Exception as e:
LOGGER.warning(f"error encountered while signing: {e}")
except SigningError as e:
LOGGER.error(f"signing error for signatureId {body_content['signatureId']}: {e}", exc_info=True)
if method_frame.redelivered:
LOGGER.warning(
f"stopping handling this message, because the message is already redelivered, signatureId: {body_content['signatureId']}")
channel.basic_reject(delivery_tag=method_frame.delivery_tag, requeue=True)
LOGGER.error(f"message already redelivered, discarding signatureId: {body_content['signatureId']}")
channel.basic_reject(delivery_tag=method_frame.delivery_tag, requeue=False)
else:
LOGGER.warning(f"first try failed, signatureId: {body_content['signatureId']}")
channel.basic_ack(delivery_tag=method_frame.delivery_tag)
raise e
LOGGER.warning(f"first try failed, requeueing for one retry, signatureId: {body_content['signatureId']}")
channel.basic_nack(delivery_tag=method_frame.delivery_tag, requeue=True)
except Exception as e:
LOGGER.warning(f"error encountered while signing, signatureId: {body_content['signatureId']}: {e}", exc_info=True)
if method_frame.redelivered:
LOGGER.warning(f"message already redelivered, discarding signatureId: {body_content['signatureId']}")
channel.basic_reject(delivery_tag=method_frame.delivery_tag, requeue=False)
else:
LOGGER.warning(f"first try failed, requeueing for one retry, signatureId: {body_content['signatureId']}")
channel.basic_nack(delivery_tag=method_frame.delivery_tag, requeue=True)
if __name__ == '__main__':
+3
View File
@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}
+1 -1
View File
@@ -152,7 +152,7 @@ openssl ts -verify -data /etc/hosts -in /tmp/response.tsr -CAfile ca/root-ca.pem
```
# Préparation pour Vendée
# Préparation à partir d'un certificat d'horodatage au format pkcs12
## Extraire les infos