{"record":{"id":"3b8cf4f826562b50","repo":"quarkusio/quarkus","slug":"spiffe-id-path-must-not-have-a-trailing-slash","errorCode":null,"errorMessage":"SPIFFE ID path must not have a trailing slash: ","messagePattern":"SPIFFE ID path must not have a trailing slash: ","errorType":"exception","errorClass":"SpiffeConnectionException","httpStatus":null,"severity":"error","filePath":"extensions/spiffe-client/runtime/src/main/java/io/quarkus/spiffe/client/runtime/internal/SpiffeValidator.java","lineNumber":123,"sourceCode":"        }\n        if (trustDomain.length() > MAX_TRUST_DOMAIN_LENGTH) {\n            throw new SpiffeConnectionException(\"SPIFFE ID trust domain exceeds maximum length of \"\n                    + MAX_TRUST_DOMAIN_LENGTH + \" bytes: \" + spiffeId);\n        }\n        for (int i = 0; i < trustDomain.length(); i++) {\n            char c = trustDomain.charAt(i);\n            if (!isValidTrustDomainChar(c)) {\n                throw new SpiffeConnectionException(\n                        \"SPIFFE ID trust domain contains invalid character '\" + c + \"': \" + spiffeId);\n            }\n        }\n\n        String path = uri.getPath();\n        if (path == null || path.isEmpty() || \"/\".equals(path)) {\n            throw new SpiffeConnectionException(\"SPIFFE ID must have a non-root path: \" + spiffeId);\n        }\n        if (path.endsWith(\"/\")) {\n            throw new SpiffeConnectionException(\"SPIFFE ID path must not have a trailing slash: \" + spiffeId);\n        }\n        String[] segments = path.split(\"/\", -1);\n        for (int i = 1; i < segments.length; i++) {\n            String segment = segments[i];\n            if (segment.isEmpty()) {\n                throw new SpiffeConnectionException(\n                        \"SPIFFE ID path must not contain empty segments: \" + spiffeId);\n            }\n            if (\".\".equals(segment) || \"..\".equals(segment)) {\n                throw new SpiffeConnectionException(\n                        \"SPIFFE ID path must not contain dot segments: \" + spiffeId);\n            }\n            for (int j = 0; j < segment.length(); j++) {\n                char c = segment.charAt(j);\n                if (!isValidPathChar(c)) {\n                    throw new SpiffeConnectionException(\n                            \"SPIFFE ID path contains invalid character '\" + c + \"': \" + spiffeId);\n                }","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spiffe-client/runtime/src/main/java/io/quarkus/spiffe/client/runtime/internal/SpiffeValidator.java#L105-L141","documentation":"SPIFFE ID paths must not end with a trailing '/'. SpiffeValidator.validateSpiffeId throws SpiffeConnectionException when URI.getPath() ends with '/', since path segments must each name a workload identifier component.","triggerScenarios":"validateSpiffeId called with IDs like 'spiffe://example.org/ns/default/sa/app/' or paths built by joining segments with a trailing separator.","commonSituations":"String-joining path segments with a loop that appends a final '/'; directory-style config values copied with a trailing slash; templating bugs that leave a dangling separator.","solutions":["Remove the trailing slash from the path","Normalize the ID in code: strip trailing '/' before building/validating","Fix the segment-join logic so no separator is appended after the last segment"],"exampleFix":"// before\nString spiffeId = base + \"/ns/default/sa/app/\";\n// after\nString normalized = base + \"/ns/default/sa/app\";","handlingStrategy":"validation","validationCode":"static String stripTrailingSlash(String id) {\n    return id.endsWith(\"/\") ? id.substring(0, id.length() - 1) : id;\n}","typeGuard":null,"tryCatchPattern":"try { validator.validateSpiffeId(id); } catch (SpiffeConnectionException e) { log.warnf(\"Trailing slash in SPIFFE ID: %s\", id); }","preventionTips":["Normalize IDs (trim trailing '/') at the config-loading boundary","Fix join loops so separators are only inserted between segments"],"tags":["spiffe","validation","path","spiffe-id"],"backgroundTag":"spiffe-id-validation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}