The vulnerability lies in the sealed-env library's enterprise mode, where the Time-based One-Time Password (TOTP) secret was embedded in plaintext (base64 encoded) within the JWS payload of unseal tokens. This allows any party with access to a token (e.g., from CI logs, container environment dumps) to decode the payload and retrieve the TOTP secret. The analysis of the patch commit reveals the exact functions responsible for this behavior.
The primary vulnerable functions are io.github.davidalmeidac.sealedenv.totp.UnsealToken.build in the Java implementation and buildUnsealToken in the Node.js implementation. These functions were responsible for constructing the JWS token and directly inserting the totpSecret into the payload. The patch replaces this with a salt-bound HMAC derivative (enterprise_epoch), ensuring the actual secret never leaves the operator's machine.
Other functions like seal and verify in both Java and Node.js were also identified as part of the vulnerable process. The seal functions were involved in creating a verifier from the raw secret, and the verify functions were responsible for extracting the secret from the token, confirming its presence. The patch modifies these functions to work with the new epochCommit and epoch fields, removing any handling of the raw TOTP secret in the tokenization process.