{"record":{"id":"ea8e02451037e63b","repo":"iflytek/astron-agent","slug":"api-secret-must-not-been-empty","errorCode":null,"errorMessage":"api_secret must not been empty","messagePattern":"api_secret must not been empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/tenant/internal/handler/req.go","lineNumber":215,"sourceCode":"\treturn req, nil\n}\n\ntype VerifyAppAuthReq struct {\n\tApiKey    string `json:\"api_key\"`\n\tApiSecret string `json:\"api_secret\"`\n}\n\nfunc newVerifyAppAuthReq(c *gin.Context) (*VerifyAppAuthReq, error) {\n\treq := &VerifyAppAuthReq{}\n\terr := c.BindJSON(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(req.ApiKey) == 0 {\n\t\treturn nil, errors.New(\"api_key must not been empty\")\n\t}\n\tif len(req.ApiSecret) == 0 {\n\t\treturn nil, errors.New(\"api_secret must not been empty\")\n\t}\n\treturn req, nil\n}\n","sourceCodeStart":197,"sourceCodeEnd":219,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/tenant/internal/handler/req.go#L197-L219","documentation":"newVerifyAppAuthReq rejects the VerifyAppAuth request when req.ApiSecret is empty. Both api_key and api_secret are mandatory to verify app credentials, so a missing secret aborts parsing with this error.","triggerScenarios":"VerifyAppAuth called with JSON body lacking api_secret or api_secret:\"\"; tests hitting TestNewVerifyAppAuthReq_EmptySecret path.","commonSituations":"Secret not provisioned on the client side, env var for secret empty, secret field omitted after copying an api_key-only payload template.","solutions":["Include api_secret in the request JSON","Confirm the secret is loaded from config/env before the call","Provision the app credential pair (key+secret) first via the tenant bootstrap flow"],"exampleFix":"// before\nreq := &VerifyAppAuthReq{ApiKey: \"ak-123\"}\n// after\nreq := &VerifyAppAuthReq{ApiKey: \"ak-123\", ApiSecret: \"s3cret\"}","handlingStrategy":"validation","validationCode":"if body.APIKey == \"\" || body.APISecret == \"\" { return errors.New(\"api_key and api_secret are both required\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat api_key/api_secret as an inseparable credential pair","Source both from one secret/config object so one cannot be empty","Test the verify endpoint with empty-secret payloads in CI"],"tags":["go","validation","authentication"],"backgroundTag":"empty-required-field","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}