Bug 50119 - [UDM HTTP API] PATCH and POST always fail with HTTP 412: Precondition Failed (If-Match "..." does not match entity tag(s) .
[UDM HTTP API] PATCH and POST always fail with HTTP 412: Precondition Failed ...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - REST API
UCS 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: Florian Best
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-09-06 04:59 CEST by Daniel Tröder
Modified: 2019-10-02 16:06 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2019-09-06 04:59:32 CEST
It's currently not possible to change any object!

Both PATCH and POST always fail with HTTP 412: Precondition Failed (If-Match "..." does not match entity tag(s) .

Reproduce with:

$ curl -i -X PATCH -u Administrator:univention -H "Accept:application/json" -H "Content-Type:application/json" -d '{
  "properties": {                                                   
    "title": "Mr."
}
}' 'http://m66.uni.dtr/univention/udm/users/user/uid=demo_admin,cn=mitarbeiter,cn=users,ou=DEMOSCHOOL,dc=uni,dc=dtr'

--------------------------------------------------------------------------
HTTP/1.1 412 Precondition Failed
Date: Fri, 06 Sep 2019 02:56:02 GMT
Server: Univention/1.0
X-Permitted-Cross-Domain-Policies: master-only
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Length: 320
Content-Language: en-US
Vary: Accept,Accept-Language,Accept-Encoding,Authorization
Content-Type: application/json
Via: 1.1 m66.uni.dtr

{"_links": {"curies": [{"href": "http://m66.uni.dtr/univention/udm/relation/{rel}", "name": "udm", "templated": true}]}, "error": {"message": "HTTP 412: Precondition Failed (If-Match \"e58d30bee63ef03629e9b0ed5b2cd0103f2e663f\" does not match entity tag(s) .)", "code": 412, "traceback": null, "error": {}, "title": ""}}
--------------------------------------------------------------------------

$ curl -X GET -H "Accept:application/json" -u Administrator:univention 'http://m66.uni.dtr/univention/udm/users/user/uid=demo_admin,cn=mitarbeiter,cn=users,ou=DEMOSCHOOL,dc=uni,dc=dtr' | python -m json.tool | sed 's/"mailUserQuota": 0,/"mailUserQuota": 5,/g' > /tmp/demo_admin.json

$ curl -i -X PUT -H "Accept:application/json" -H "Content-Type:application/json" -d "$(cat /tmp/demo_admin.json)" -u Administrator:univention 'http://m66.uni.dtr/univention/udm/users/user/uid=demo_admin,cn=mitarbeiter,cn=users,ou=DEMOSCHOOL,dc=uni,dc=dtr'

--------------------------------------------------------------------------
HTTP/1.1 412 Precondition Failed
Date: Fri, 06 Sep 2019 02:56:02 GMT
Server: Univention/1.0
X-Permitted-Cross-Domain-Policies: master-only
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Length: 320
Content-Language: en-US
Vary: Accept,Accept-Language,Accept-Encoding,Authorization
Content-Type: application/json
Via: 1.1 m66.uni.dtr

{"_links": {"curies": [{"href": "http://m66.uni.dtr/univention/udm/relation/{rel}", "name": "udm", "templated": true}]}, "error": {"message": "HTTP 412: Precondition Failed (If-Match \"e58d30bee63ef03629e9b0ed5b2cd0103f2e663f\" does not match entity tag(s) .)", "code": 412, "traceback": null, "error": {}, "title": ""}}
--------------------------------------------------------------------------
Comment 1 Daniel Tröder univentionstaff 2019-09-09 15:43:26 CEST
This is a blocker for performance oriented code.

Usage of Etag→If-Match is an important security oriented feature, but it has to be an *optional* one.
Comment 2 Florian Best univentionstaff 2019-09-10 09:50:48 CEST
Fixed in:

univention-management-console-module-udm (9.0.12-35)
7803a2c1a9ff | Bug #27816: Bug #50119: fix enforced If-Match header
Comment 3 Daniel Tröder univentionstaff 2019-09-12 10:35:17 CEST
OK: works for me (functional test as in opening text)
Comment 4 Florian Best univentionstaff 2019-10-02 16:06:33 CEST
UCS 4.4-2 has been released:
 https://docs.software-univention.de/release-notes-4.4-2-en.html
 https://docs.software-univention.de/release-notes-4.4-2-de.html

If this error occurs again, please use "Clone This Bug".