Conversation
…ilure Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
|
| Filename | Overview |
|---|---|
| cli/internal/publish/plugins.go | Correctly checks request-construction errors before accessing headers and simplifies schema loading without changing normal missing-file semantics. |
| cli/internal/publish/plugins_test.go | Adds focused coverage for malformed token-request URLs and both absent and present schema files. |
Reviews (1): Last reviewed commit: "fix: nil pointer dereference in getDocke..." | Re-trigger Greptile
|
Hey @SAY-5! First of all, thanks for the contribution, the change looks good. Might I ask what prompted it? |
|
It's from #23164. A malformed realm in the registry auth challenge makes the request URL parse fail, and getDockerToken was calling req.Header.Add before checking that error, so it panicked on the nil request instead of returning it. Noticed it reading through the publish path. |
Summary
getDockerTokencalledreq.Header.Addon the request returned byhttp.NewRequestWithContextbefore checking its error, so a failed URL parse (e.g. via a malformed realm in the auth challenge) panicked with a nil pointer dereference instead of returning an error. Moved the error check above the header calls. Also dropped a secondos.ReadFileinGetSpecJsonSchemethat could never hit itsIsNotExistbranch since the same read already succeeded above it.Fixes #23164.