Archived from the Transloadit support forum. Originally posted on August 13, 2013; details may be outdated, see our docs for current behavior. Original thread
Hello,
We are having some trouble debugging a signature error with an assembly notification. However, the json link on the assembly page does not show this field. It would help us to debug if it were included!
sorry for the long delay here. This was mainly because the problem turned out to be much harder, and then I was on vacation until September 1st. Sorry for not getting back to your earlier.
The problem here is that we cannot simply add it to the assembly status JSON. That would open a big security hole, as 3rd parties could just submit an assembly on your site, then check the status JSON of that failed assembly, read out the expected_signature field and resubmit the same assemblies with the same params and the proper signature. That would make the signature authentication useless.
What we could do is we add a new field to our assemblies table that saves the expected_signature. Then we can display it on assembly detail pages on our website. Via that we can assure that only people knowing your account (and thus they know your secret anyway) can see expected signatures. This would unfortunately mean a database migration with downtime, since adding new fields blocks table writes (we need to upgrade MySQL to prevent that).
Another option that I see is that we just calculate the signature on-the-fly in the website code and display it there. However, there are differences between NodeJS and PHP signature calculations as you and Kevin found out. Also, this would mean that the calculation logic is both in the website code and in the API code.
The last option I see is that we could make a secret API endpoint that allows you to calculate signatures for assemblies. It requires an admin account id (for example my account), and the request must be signed (with the admin account’s secret). That should work fine in theory, but feels a little bad as well.
Not saying we don’t want to solve this - we totally do. Just letting you know why this has taken so long and asking if you still need help here. We are still figuring what the best move here would be.
I think a much better solution here would be to add a new page on the page where you enable signature authentication that provides you with a form to enter your params, and then calculates the signature on-the-fly for you for testing. It is not ideal as it would require copy/pasting your parameters from your template and your custom parameters into that form field, but it’s a secure solution to test signature, unlike adding the signature to the assembly status.
Please let me know what you think. We have figured out the signature trouble in the meantime so you might not even need this anymore. It seems to be a good idea to me regardless for new users.
I hope we don’t have any more difficulties with signatures in the future, but it is possible that there will be some. Some way to get the expected signature will help with debugging. Probably the best option from a user perspective is displaying the expected signature on the assembly page. But if that is difficult to do, then something else would also be useful.