Bug #22747
Validation on Puppet Class ID When using API
Pull request:
Fixed in Releases:
Found in Releases:
Description
When posting data to;
/api/v2/hosts/:host/puppetclass_ids
The Puppetclass ID is not validated and a successful response is return. While this doesn't cause any issues (it isn't evaluated against the hosts puppetclasses) it means that errant data can be inserted into the database which can then only be cleaned manually. It also can be misleading - particuarly when interfacing with external systems which get a positive response.
e.g
# curl -X POST http://localhost:5000/api/v2/hosts/testhost/puppetclass_ids -d '{"puppetclass_id":"THISISINVALID"}' -H 'Content-Type: application/json' {"host_id":1,"puppetclass_id":0}
# curl -X POST http://localhost:5000/api/v2/hosts/testhost/puppetclass_ids -d '{"puppetclass_id":"999999999"}' -H 'Content-Type: application/json' {"host_id":1,"puppetclass_id":999999999}
Submitting patch to add validation on create action and adding test.
Associated revisions
History
#1
Updated by The Foreman Bot over 4 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/5284 added
#2
Updated by Iain Walmsley over 4 years ago
- % Done changed from 0 to 100
- Status changed from Ready For Testing to Closed
Applied in changeset a8c113c0d3675144caf51a2c34029c2a276f3907.
#3
Updated by Daniel Lobato Garcia over 4 years ago
- Legacy Backlogs Release (now unused) set to 330
Fixes #22747 - vet puppetclass_id on addition