{"record":{"id":"d5c112a2f1a21e4d","repo":"beemdevelopment/Aegis","slug":"secret-is-empty","errorCode":null,"errorMessage":"Secret is empty","messagePattern":"Secret is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java","lineNumber":63,"sourceCode":"        String scheme = uri.getScheme();\n        if (scheme == null || !(scheme.equals(SCHEME) || scheme.equals(MotpInfo.SCHEME))) {\n            throw new GoogleAuthInfoException(uri, String.format(\"Unsupported protocol: %s\", scheme));\n        }\n\n        // 'secret' is a required parameter\n        String encodedSecret = uri.getQueryParameter(\"secret\");\n        if (encodedSecret == null) {\n            throw new GoogleAuthInfoException(uri, \"Parameter 'secret' is not present\");\n        }\n\n        byte[] secret;\n        try {\n            secret = (scheme.equals(MotpInfo.SCHEME)) ? Hex.decode(encodedSecret) : parseSecret(encodedSecret);\n        } catch (EncodingException e) {\n            throw new GoogleAuthInfoException(uri, \"Bad secret\", e);\n        }\n        if (secret.length == 0) {\n            throw new GoogleAuthInfoException(uri, \"Secret is empty\");\n        }\n\n        OtpInfo info;\n        String issuer = \"\";\n        try {\n            String type = (scheme.equals(MotpInfo.SCHEME)) ? MotpInfo.ID : uri.getHost();\n            if (type == null) {\n                throw new GoogleAuthInfoException(uri, String.format(\"Host not present in URI: %s\", uri.toString()));\n            }\n\n            switch (type) {\n                case \"totp\":\n                    TotpInfo totpInfo = new TotpInfo(secret);\n                    String period = uri.getQueryParameter(\"period\");\n                    if (period != null) {\n                        totpInfo.setPeriod(Integer.parseInt(period));\n                    }\n                    info = totpInfo;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java#L45-L81","documentation":"Thrown by GoogleAuthInfo.parseUri(Uri) after 'secret' decodes to a zero-length byte array. The URI passed the scheme and secret-presence checks, but the secret value itself (base32 or hex) decodes to nothing, e.g. an empty or all-whitespace secret parameter, so no valid OTP key can be constructed.","triggerScenarios":"parseUri(Uri) with secret= (empty string) or a value consisting only of Base32 padding '=' characters.","commonSituations":"URI templates left un-filled (secret=), scripts building URIs from an empty secret variable, or corrupt QR payloads.","solutions":["Provide the actual Base32 secret in the URI's secret parameter","Check the upstream configuration/variable feeding the URI for emptiness","Validate the secret is non-empty before constructing the URI"],"exampleFix":"// before\nString uri = \"otpauth://totp/x?secret=\";\n// after\nif (secret == null || secret.isEmpty()) throw new IllegalArgumentException(\"secret required\");\nString uri = \"otpauth://totp/x?secret=\" + secret;","handlingStrategy":"validation","validationCode":"String p = uri.getQueryParameter(\"secret\"); if (p == null || p.replaceAll(\"=\", \"\").isEmpty()) throw new IllegalArgumentException(\"secret empty\");","typeGuard":null,"tryCatchPattern":"try { return GoogleAuthInfo.parseUri(uri); } catch (GoogleAuthInfoException e) { reportIncompleteUri(uri); return null; }","preventionTips":["Check the secret source variable isn't empty before building URIs","Reject template URIs with unfilled placeholders","Validate decoded secret length > 0 before import"],"tags":["android","otp","empty-secret","validation"],"backgroundTag":"empty-required-field","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}