Skip to content

fix(certinfo): read the fiscal code from a CIE certificate's CN - #10

Merged
lorenzocorallo merged 1 commit into
mainfrom
fix/cie-fiscal-code
Oct 17, 2026
Merged

lorenzocorallo merged 1 commit into
mainfrom
fix/cie-fiscal-code

Conversation

@lorenzocorallo

Copy link
Copy Markdown
Member

A real CIE authentication certificate has the codice fiscale in CN=<codice fiscale>/<NIS>. Its serialNumber is the document number IDCIT-…, not TINIT-<codice fiscale>. Because of this, the agent reported no fiscal code for real cards.

  • certinfo.Parse reads the CN form and still accepts TINIT-. A value only counts if it has the shape of a codice fiscale.
  • The card simulator and the soft token now issue certificates in the real layout.

The matching backend fix is PoliNetworkOrg/backend (fix/esign-cie-fiscal-code).

🤖 Generated with Claude Code

A CIE authentication certificate carries the codice fiscale in CN
"<codice fiscale>/<NIS>" and the document number in serialNumber
"IDCIT-…". The simulator and the soft token now issue certificates
shaped like a real CIE's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5d22f85-a1de-47e3-bb24-95ff695e57a8
📥 Commits

Reviewing files that changed from the base of the PR and between 37f7256 and 94453f2.

📒 Files selected for processing: 6
  • internal/certinfo/certinfo.go
  • internal/certinfo/certinfo_test.go
  • internal/token/cie/cardsim/identity.go
  • internal/token/cie/cie_test.go
  • internal/token/soft/soft.go
  • internal/token/worker/worker_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Certificate parsing now validates fiscal codes found in TINIT serial numbers and CIE-style common names. Simulator and software-token certificates use CIE-style common names and IDCIT serial attributes.

Changes

Fiscal code certificate handling

Layer / File(s) Summary
Validate and extract fiscal codes
internal/certinfo/certinfo.go, internal/certinfo/certinfo_test.go
Parse uppercases and validates fiscal-code candidates from TINIT- serial numbers. If none is valid, it checks the common name before /. Tests cover both formats, omocodia, missing codes, invalid subject values, and display names.
Update certificate subjects
internal/token/cie/cardsim/identity.go, internal/token/cie/cie_test.go, internal/token/soft/soft.go, internal/token/worker/worker_test.go
Simulator and software-token certificates use a fiscal code and NIS in the common name, and an IDCIT- serial attribute. Related tests expect the updated common names.

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 94453

The parser now recognizes validated fiscal codes in CIE certificate common names, while the signing flow continues to display the signer’s name. The inspected simulator certificates match the parser’s expected format, and no actionable merge risk remains.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: reading the fiscal code from the CIE certificate common name in certinfo.Parse.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lorenzocorallo
lorenzocorallo merged commit cdae239 into main Oct 17, 2026
15 checks passed
@lorenzocorallo
lorenzocorallo deleted the fix/cie-fiscal-code branch October 17, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant