ericholguin opened a new issue, #6779: URL: https://github.com/apache/trafficcontrol/issues/6779
<!-- ************ STOP!! ************ If this issue identifies a security vulnerability, DO NOT submit it! Instead, contact the Apache Traffic Control Security Team at [email protected] and follow the guidelines at https://apache.org/security regarding vulnerability disclosure. - For *SUPPORT QUESTIONS*, use the #traffic-control channel on the ASF slack (https://s.apache.org/tc-slack-request) or the Traffic Control Users mailing list (send an email to [email protected] to subscribe). - Before submitting, please **SEARCH GITHUB** for a similar issue or PR * https://github.com/apache/trafficcontrol/issues * https://github.com/apache/trafficcontrol/pulls --> <!-- Do not submit security vulnerabilities or support requests here - see above --> ## This Bug Report affects these Traffic Control components: <!-- delete all those that don't apply --> - Traffic Ops ## Current behavior: <!-- Describe how the bug happens --> Making a `POST` request to `/api/3.0/servers` with no profile key in the request returns: ```http HTTP/1.1 500 Internal Server Error { "alerts": [ { "text": "Internal Server Error", "level": "error" } ] } ``` ## Expected behavior: <!-- Describe what the behavior would be without the bug --> I don't believe the `profile` key was required previously, however `profileId` has always been required. There should be no error when the `profile` key is missing. ## Steps to reproduce: <!-- If the current behavior is a bug, please provide the *STEPS TO REPRODUCE* and include the applicable TC version. --> Using the latest code from master spin up CiaB or CiaBDev and make a `POST` request to `https://localhost:443/api/3.0/servers` making sure the `profile` key is omitted (and all other Ids are valid): e.g: ```json { "cachegroupId": 8, "cdnId": 2, "domainName": "test.domain.net", "hostName": "test-01", "interfaces": [ { "ipAddresses": [ { "address": "0.0.0.1", "gateway": "0.0.0.1", "serviceAddress": true } ], "name": "eth0" } ], "physLocationId": 2, "profileId": 13, "statusId": 3, "typeId": 11 } ``` ## Notes: Traffic Ops error.log will show: ``` ERROR: api.go:263: 2022-04-25T20:53:03.2405179Z: 172.24.0.12:44922 panic: (err: runtime error: invalid memory address or nil pointer dereference) stacktrace: goroutine 54669 [running]: github.com/apache/trafficcontrol/lib/go-util.Stacktrace() /tmp/go/src/github.com/apache/trafficcontrol/lib/go-util/util.go:32 +0x66 github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapPanicRecover.func1.1() /tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:173 +0x66 panic({0xd134c0, 0x1500310}) /usr/local/go/src/runtime/panic.go:838 +0x207 github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/server.createV3(0xc001f370e0, {0xf9fef0, 0xc001ba7200}, 0xc000f3e800) /tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/server/servers.go:1981 +0x2cc ``` There should probably be a check here or maybe this should be moved elsewhere: https://github.com/apache/trafficcontrol/blob/1aa8a5ae205bd885c6181133f8d45ce1dbb077fe/traffic_ops/traffic_ops_golang/server/servers.go#L1981 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
