SQL Clone Request failed anti-forgery validation
Trying to setup Azure Dev Ops with SQL Clone tasks to delete image. Getting the following.
- Task : SQL Clone - Delete imageDescription : Delete images created by SQL CloneVersion : 4.0.0Author : Redgate SoftwareHelp : [More Information](https://documentation.red-gate.com/clone3)==============================================================================Connected to SQL Clone serverFound imageDeleting image##[error]Request failed anti-forgery validation:Just had request with mismatched anti-forgery cookie and header to an anti-forgery protected URI [http://devapp01:14145/api/v1/images/2]Technical details: Forbidden received from server when performing DELETE /api/v1/images/2
Tagged:
Answers
This means that requests should have a header and a cookie set to matching values. The cmdlets and therefore extension that uses them sets these to constants. Is there any possibility that the headers or cookies are being transformed/stripped between the Azure DevOps agent and SQL Clone Server, perhaps by a proxy?
We could potentially explore this further with network tracing and/or a private build with some additional logging to see what headers/cookies we're receiving. Could you open a ticket with support@red-gate.com and mention this conversation?
When launching the SQL Clone interface (Web browser page) it does a redirect to http://<servername>:14145/dashboard. If you have the /dashboard in the Server URL box in Azure DevOps it causes the above CSRF error.
Once I removed the /dashboard it worked correctly. This must have been altering the cookie. Wanted to post an update, so this is documented and others don't have this issue.
I'll have a look what options we have to prevent others getting into this situation in the future.