[Home]

Summary:ASTERISK-30407: res_stir_shaken: Ordering of JSON fields incorrect, and tn lacks canonicalization
Reporter:Luke Escude (lukeescude)Labels:
Date Opened:2023-01-26 17:20:36.000-0600Date Closed:2023-04-10 14:35:40
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_stir_shaken
Versions:16.30.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:So a number of carriers have starting complaining about how we're signing STIR/SHAKEN stuff, and it turns out the stir_shaken module is indeed not doing it according to the RFC.

They're complaining about 2 issues:

1. The order of the fields is incorrect
2. The '+' sign in the phone numbers needs to be removed (they're calling it "canonicalization")

Here's an example output from stir_shaken.conf:

{noformat}
{
 "dest": {
   "tn": [
     "+1NPANXXXXXX"
   ]
 },
 "orig": {
   "tn": "1NPANXXXXXX"
 },
 "attest": "A",
 "origid": "e391c481-510b-46ff-a7d0-4c8fcff2436b",
 "iat": 167458XXXX
}
{noformat}

The field order is definitely non-compliant with the RFC, and I do see the + sign they're referring to, in the dest.tn field.

Reference: https://www.rfc-editor.org/rfc/rfc8225.html#section-9
Comments:By: Asterisk Team (asteriskteam) 2023-01-26 17:20:40.110-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Luke Escude (lukeescude) 2023-01-26 17:28:00.853-0600

The RFC is a bit lacking, so I'll include the following field order as presented to me by one of the carriers' SIP engineers:

"attest":
 "dest":"tn"
 "iat":
 "orig":"tn":
 "origid":


Apparently that is the correct order - But you wouldn't know it by the RFC's definition....

EDIT: Ah, here is the definition: https://www.rfc-editor.org/rfc/rfc8588.html#section-6


By: Sean Bright (seanbright) 2023-01-27 12:23:38.870-0600

bq. Apparently that is the correct order - But you wouldn't know it by the RFC's definition

[Section 9|https://www.rfc-editor.org/rfc/rfc8225.html#section-9] says:

bq. JSON objects MUST have the keys ordered lexicographically by the Unicode \[UNICODE] code points of the member names.


By: Friendly Automation (friendly-automation) 2023-04-10 14:35:41.540-0500

Change 20054 merged by Friendly Automation:
res_pjsip_stir_shaken: Fix JSON field ordering and disallowed TN characters.

[https://gerrit.asterisk.org/c/asterisk/+/20054|https://gerrit.asterisk.org/c/asterisk/+/20054]

By: Friendly Automation (friendly-automation) 2023-04-10 14:41:16.807-0500

Change 20055 merged by Friendly Automation:
res_pjsip_stir_shaken: Fix JSON field ordering and disallowed TN characters.

[https://gerrit.asterisk.org/c/asterisk/+/20055|https://gerrit.asterisk.org/c/asterisk/+/20055]

By: Friendly Automation (friendly-automation) 2023-04-10 17:31:13.638-0500

Change 19897 merged by Friendly Automation:
res_pjsip_stir_shaken: Fix JSON field ordering and disallowed TN characters.

[https://gerrit.asterisk.org/c/asterisk/+/19897|https://gerrit.asterisk.org/c/asterisk/+/19897]