fix: serial number stored in DB now matches certificate serial number#212
fix: serial number stored in DB now matches certificate serial number#212devangpratap wants to merge 1 commit intoopenwisp:masterfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR fixes a serial number mismatch by assigning the generated certificate's serial number to the model instance ( Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…isp#121 The _generate() method never read the serial number back after signing. In the pyOpenSSL path, set_serial_number() silently truncated 128-bit UUID integers, causing the DB and certificate to store different values. Fixed by syncing the field from the signed cert after builder.sign(). Fixes openwisp#121
|
Hey @devangpratap, can you reproduce and check the existence of this issue as this was fixed in #194 while migrating from PyOpenSSL to cryptography. |
Checklist
Reference to Existing Issue
Closes #121
Description of Changes
_generate()built the certificate usingint(self.serial_number)but never readthe serial number back after signing. The DB value came from
_generate_serial_number()while the certificate value came from what the signing library actually embedded. In the
pyOpenSSL path set_serial_number() silently truncated 128-bit UUID integers during
signing, producing two genuinely different integers — exactly what was reported in #121.
Fix: after
cert = builder.sign(...), sync the field back:`self.serial_number = str(cert.serial_number)
Added
test_serial_number_db_matches_certificateto verify DB and certificate serialalways match. All 74 existing tests continue to pass.
Screenshot
N/A