| Type |
Bug
|
| Priority |
Normal
|
| Assignee | |
| Affected Versions |
17.2.3, 17.2.7
|
| Labels |
No labels
|
Issue Votes (0)
| Type |
Bug
|
| Priority |
Normal
|
| Assignee | |
| Affected Versions |
17.2.3, 17.2.7
|
| Labels |
No labels
|
Environment
Reproduced on stock OneDev 17.2.3 with
tod4.5.0 and on the official1dev/server:17.2.7image withtod4.6.0. The validator method is unchanged across 17.2.3 through 17.2.7 and upstreammainas checked on December 5, 2026.Steps to reproduce
Create a private OneDev project named
fixture-templates. Commit this.onedev-buildspec.ymltomain:Create
fixture-app. Add a job secret namedtemplates_tokenonfixture-appcontaining a OneDev access token with code-read access tofixture-templates. Use OneDev’s default all-branches authorization rule for the secret.In a local clone of
fixture-app, add this.onedev-buildspec.yml:Configure
todwith a caller that has code-write permission onfixture-appand no direct access tofixture-templates. Runtod build check-specfrom the clone.Expected
The validator resolves the import using the authorized job secret and accepts the build spec.
Actual
POST /~api/tod/check-build-spec?project=fixture-appreturns HTTP 406 atimports[0], andtodexits with status 1. The error indicates thatJobAuthorizationContext.get()returned null while resolving the import token. A build spec without imports returns HTTP 200 on the same instance.Root cause and suggested fix
TodResource.checkBuildSpec()pushes the project context and calls the build-spec validator without setting aJobAuthorizationContext.Import.getBuildSpec()expects that context when resolving the access-token secret. Normal job submission sets it before validating the spec.A local test patch supplied a context for uncommitted YAML and changed the result from HTTP 406 to HTTP 200. It required code-write permission to resolve job secrets and kept branch-specific secrets unavailable without a trusted Git revision. The same test also confirmed that read-only callers could still validate specs without secret-backed imports.