feat: add support for SUCI in NAI format#46
Open
DomenicoVerde wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds proper parsing/formatting support for SUCI encoded in NAI format (NSI/NAI-based SUCI) so the module can produce the correct supiOrSuci string for UDM APIs per 3GPP specs.
Changes:
- Add SUPI format constants for GCI/GLI alongside IMSI/NAI.
- Update
SuciToStringWithError()to branch on SUPI format and parse NAI-formatted SUCI into the UDMsuci-...string form. - Replace the previous “nai-1-” behavior with a structured NAI parser and add multiple spec-derived unit tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| nasMessage/NAS_CommInfoIE.go | Adds missing SUPI format constants (GCI/GLI) used for format discrimination. |
| nasConvert/MobileIdentity5GS.go | Implements NAI username@realm parsing to construct UDM-facing suci-... strings and returns PLMN when derivable. |
| nasConvert/MobileIdentity5GS_test.go | Replaces legacy NAI-hex test with multiple 3GPP-derived NAI SUCI examples and negative cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
3GPP TS 24 501 defines four different SUPI Formats to be sent as SUCI in the NAS 5GS Mobile Identity IE [1]: IMSI (International Mobile Subscriber Identity), NSI (Network Specific Identifier), GCI (Global Cable Identifier), and GLI (Global Line Identifier). If the SUPI format is set to NSI, the SUCI is encoded as an NAI constructed as specified in Section 28.7.3 of 3GPP TS 23.003 [2]. This pull request updates the
free5gc/nasmodule to include the support of SUCI in NAI format.Motivation
Actually, Free5GC supports only the IMSI format for the SUPI. When the SUCI is encoded in NSI format, the naiToString() function only adds the prefix "nai-1-" and appends the SUCI NAI field. With this pull request, the SuciToStringWithError() function is updated to detect the SUPI format. If the SUPI format is of type NSI, the naiToString() function is called to parse the SUCI NAI field and construct the SUCI UTF-8 string to be sent to the UDM API (via the supiOrSuci parameter) as specified in TS 29 503 Annex C [3]. As a result, UEs can also authenticate using the SUCI in NAI format in the 5G NAS Registration Request.
Changes
Validation
Validation is performed through: (1) the test cases provided in MobileIdentity5GS_test.go, and (2) Free5GC (commit 69ba98ff8eba69a8092c56abb80a01fcd483e7b3). More specifically, registration_test.go has been extended with a new test case in which a UE completes the registration procedure using a SUCI in NAI format. If this is of interest, I can open a pull request in the
free5gc/free5gcmodule to share the additional test.Notes
References