voc/srtrelay

Auth POST request adds random null characters

probablybenallen opened this issue · 4 comments

When using http auth, the POST request adds random numbers (I've got between 0 and 2) of URL encoded ("\0" aka "%00") null characters to the end of the password field

Hi, do you have a specific example where that occurs? Generally the code should just split the streamid on slashes and everything after the 2nd slash would be treated as password

Heya sorry it's been a while, so I've set up a basic node server to handle http. Basically if I just console.log(request.body.pwd) on the request it looks fine, the issue is that behind the scenes it's adding in null characters randomly that a normal log can't display - but I can see it if I console.log(JSON.stringify(request.body.pwd)) and that's obviously completely breaking string comparisons for passwords etc.

So "...:1337?streamid=publish/test/testy" gives my server the output publish DECLINED key:"test", pwd:"testy\u0000\u0000"

I can provide more examples/demo node code if something specific would be helpful

Sorry but I can't reproduce this, even in node. Are you sure that this is not related to some framework you might be using?

My bare example looks like this:

#!/usr/bin/env node
const http = require('http');

const requestListener = function (req, res) {
  req.on("data", (chunk) => {console.log(chunk, "\n", chunk.toString())})
  res.writeHead(200);
  res.end()
}

const server = http.createServer(requestListener);
server.listen(8088);

Pushing ffmpeg -i rtmp://... -c copy -f mpegts srt://127.0.0.1:1337?streamid=publish/test/testy

Results in:

<Buffer 61 70 70 3d 73 74 72 65 61 6d 26 61 75 74 68 3d 74 65 73 74 79 26 63 61 6c 6c 3d 70 75 62 6c 69 73 68 26 6e 61 6d 65 3d 74 65 73 74>
 app=stream&auth=testy&call=publish&name=test

So no zero bytes in there.

Sorry it's taken me so long to get back to this, only just got back to looking into this again. Not sure anything has changed about my application's codebase, but it appears to be solved in the latest builds of srtrelay using the dockerfile build!

Not too sure what happened, but will close this issue as it seems to be resolved, many thanks, love the project!!