stir_shaken: strip RFC 4904 user parameters from telephone numbers#3906
Open
NormB wants to merge 1 commit into
Open
stir_shaken: strip RFC 4904 user parameters from telephone numbers#3906NormB wants to merge 1 commit into
NormB wants to merge 1 commit into
Conversation
get_orig_tn_from_msg() and get_dest_tn_from_msg() take the originating and destination telephone numbers directly from parse_uri()'s .user field. When a From/To/PAI URI carries RFC 4904 parameters in the userinfo part (e.g. "+33123456789;tgrp=...;trunk-context=..."), parse_uri() folds the whole userinfo into .user, so the trailing parameters end up glued to the number and the E.164 check in check_passport_phonenum() fails -- forcing the script to pre-clean orig_tn/dest_tn before calling stir_shaken_verify(). Trim the number at the first ';' so any embedded parameters are dropped before validation. Based on the patch proposed by @StellaTeam in OpenSIPS#3904. Closes OpenSIPS#3904
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.
Problem
get_orig_tn_from_msg()andget_dest_tn_from_msg()take the originating and destination telephone numbers straight fromparse_uri()'s.userfield. When aFrom/To/P-Asserted-IdentityURI carries RFC 4904 parameters in the userinfo part, e.g.parse_uri()resolves theuser;params@hostambiguity by folding the entire userinfo into.user(thestill_at_userbacktrack path inparser/parse_uri.c), and.user_paramis cleared. The trailing parameters therefore stay glued to the number, the E.164 check incheck_passport_phonenum()fails, andstir_shaken_verify()errors out unlessorig_tn/dest_tnare pre-cleaned from script.Fix
Trim the extracted number at the first
;, dropping any embedded user parameters before validation. The two call sites share a small helper (trim_tn_params()) using the existingq_memchr()core util.Notes
master(make -C modules/stir_shaken); no new warnings.q_memchr()returnsNULLand the number is left untouched.Closes #3904