mirror of
https://github.com/jambonz/sbc-sip-sidecar.git
synced 2025-12-19 04:27:46 +00:00
fix register with invalid from and to header (#84)
This commit is contained in:
@@ -24,6 +24,12 @@ const checkCache = async(req, res, next) => {
|
||||
const {logger} = req.locals;
|
||||
const registration = req.registration;
|
||||
const uri = parseUri(registration.aor);
|
||||
// if cannot parse uri, then we cannot proceed
|
||||
if (!uri) {
|
||||
return res.send(403, {headers: {
|
||||
'X-Reason': 'Invalid address of record'
|
||||
}});
|
||||
}
|
||||
const aor = `${uri.user}@${uri.host}`;
|
||||
req.locals.realm = uri.host;
|
||||
|
||||
|
||||
48
test/scenarios/uac-register-gh-83.xml
Normal file
48
test/scenarios/uac-register-gh-83.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
<!-- This program is free software; you can redistribute it and/or -->
|
||||
<!-- modify it under the terms of the GNU General Public License as -->
|
||||
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU General Public License -->
|
||||
<!-- along with this program; if not, write to the -->
|
||||
<!-- Free Software Foundation, Inc., -->
|
||||
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||
<!-- -->
|
||||
<!-- Sipp default 'uac' scenario. -->
|
||||
<!-- -->
|
||||
|
||||
<scenario name="Basic Sipstone UAC">
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
REGISTER sip:[field1] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
Max-Forwards: 70
|
||||
From: "sipp" <sip:[field0]@[field1]@[field1]>;tag=[call_number]
|
||||
To: "sipp" <sip:[field0]@[field1]@[field1]>
|
||||
Call-ID: reg///[call_id]
|
||||
CSeq: 8 REGISTER
|
||||
Contact: <sip:sipp@[local_ip]:[local_port]>
|
||||
Expires: 3600
|
||||
Content-Length: 0
|
||||
User-Agent: SIPp
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100" optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="403">
|
||||
</recv>
|
||||
|
||||
<ResponseTimeRepartition value="10, 20"/>
|
||||
<CallLengthRepartition value="10"/>
|
||||
</scenario>
|
||||
|
||||
@@ -56,7 +56,11 @@ test('register tests', (t) => {
|
||||
return sippUac('uac-register-auth-success-jane.xml', sippRegObj);
|
||||
})
|
||||
.then(() => {
|
||||
t.pass('successfully re-registered against short registration with re-auth');
|
||||
t.pass('successfully registered for jane');
|
||||
return sippUac('uac-register-gh-83.xml', sippRegObj);
|
||||
})
|
||||
.then(() => {
|
||||
t.pass('unsuccessfully registered for invalid From and To headers');
|
||||
if (srf.locals.lb) srf.locals.lb.disconnect();
|
||||
srf.disconnect();
|
||||
t.end();
|
||||
|
||||
Reference in New Issue
Block a user