{"record":{"id":"f497dad370c202f0","repo":"t8y2/dbx","slug":"invalid-usekeytab-in-cassandra-jaas-config-w","errorCode":null,"errorMessage":"invalid useKeyTab in Cassandra JAAS config: %w","messagePattern":"invalid useKeyTab in Cassandra JAAS config: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/kerberos.go","lineNumber":487,"sourceCode":"\t}\n\toptions := map[string]string{}\n\tfor _, match := range jaasOptionPattern.FindAllSubmatch(module[1], -1) {\n\t\tvalue := firstNonEmpty(string(match[2]), string(match[3]), string(match[4]))\n\t\toptions[strings.ToLower(string(match[1]))] = value\n\t}\n\tif config.principal == \"\" {\n\t\tconfig.principal = options[\"principal\"]\n\t}\n\tif config.keytabPath == \"\" {\n\t\tconfig.keytabPath = options[\"keytab\"]\n\t}\n\tif config.ccachePath == \"\" {\n\t\tconfig.ccachePath = options[\"ticketcache\"]\n\t}\n\tif value, ok := options[\"usekeytab\"]; ok {\n\t\tconfig.useKeytab, err = strconv.ParseBool(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid useKeyTab in Cassandra JAAS config: %w\", err)\n\t\t}\n\t\tconfig.useKeytabSet = true\n\t}\n\tif value, ok := options[\"useticketcache\"]; ok {\n\t\tconfig.useTicketCache, err = strconv.ParseBool(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid useTicketCache in Cassandra JAAS config: %w\", err)\n\t\t}\n\t\tconfig.useTicketCacheSet = true\n\t}\n\treturn nil\n}\n\nfunc javaSystemProperty(name string) string {\n\tpattern := regexp.MustCompile(`(?:^|\\s)-D` + regexp.QuoteMeta(name) + `=(?:\"([^\"]*)\"|'([^']*)'|(\\S+))`)\n\tfor _, environmentName := range []string{\"JAVA_TOOL_OPTIONS\", \"_JAVA_OPTIONS\", \"JDK_JAVA_OPTIONS\"} {\n\t\tmatch := pattern.FindStringSubmatch(os.Getenv(environmentName))\n\t\tif len(match) == 4 {","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/kerberos.go#L469-L505","documentation":"The JAAS config's `useKeyTab` option could not be parsed as a Go boolean via strconv.ParseBool. JAAS options are free-form strings, so values like `yes`/`on`/`1 ` (with quotes or whitespace artifacts) fail parsing. The library aborts rather than silently ignoring a malformed credential flag.","triggerScenarios":"applyJAASConfig finds a `useKeyTab=<value>` option in the Krb5LoginModule entry whose value is not one of 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False.","commonSituations":"Java-style values such as `yes` or `no`; values with surrounding quotes, trailing semicolons, or whitespace captured by the option parser; typos like `ture`; mixing shell-style `true ` into the JAAS file.","solutions":["Set useKeyTab to a boolean strconv accepts: true, false, 1, 0, T, F, TRUE, FALSE (case variants).","Remove stray quotes, trailing semicolons, or whitespace around the value in the JAAS file.","Remove the useKeyTab option entirely and rely on the default, or control keytab use via the library's own config options instead.","Validate the JAAS file with a quick `strconv.ParseBool` check before deployment."],"exampleFix":"// before (jaas.conf)\nCassandraJavaClient {\n    com.sun.security.auth.module.Krb5LoginModule required useKeyTab=yes;\n};\n// after\nCassandraJavaClient {\n    com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true;\n};","handlingStrategy":"validation","validationCode":"func validBoolOption(v string) bool {\n\t_, err := strconv.ParseBool(strings.TrimSpace(strings.Trim(v, \"\\\"'\")))\n\treturn err == nil\n}","typeGuard":null,"tryCatchPattern":"if err := client.Finalize(); err != nil {\n\tvar pe *strconv.NumError\n\tif strings.Contains(err.Error(), \"invalid useKeyTab\") {\n\t\tlog.Fatalf(\"fix useKeyTab in %s: must be true/false/1/0\", jaasPath)\n\t}\n\treturn err\n}","preventionTips":["Only use true/false/1/0 for useKeyTab in JAAS files.","Avoid quoting values inside the JAAS option line.","Add a pre-deploy grep/regex check for `useKeyTab=(true|false|1|0)` (case-insensitive).","Control keytab use via driver config when possible, keeping JAAS minimal."],"tags":["kerberos","cassandra","config","parsing"],"backgroundTag":"jaas-config-invalid","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}