Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/crypto: add special handling to help diagnose #1212 #1329

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Dec 5, 2024

Help diagnose #1212 by logging more details when the error occurs in CI.

@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 5, 2024

It looks like errors will bubble as required (https://app.circleci.com/pipelines/github/alxndrsn/odk-central-backend/2154/workflows/983ec96f-ce7f-48c5-bef3-4018454754a4/jobs/2082):

    end-to-end @slow
::ffff:127.0.0.1 - - [05/Dec/2024:09:56:27 +0000] "POST /v1/sessions HTTP/1.1" 200 228
::ffff:127.0.0.1 - - [05/Dec/2024:09:56:28 +0000] "POST /v1/projects/1/key HTTP/1.1" 200 16
::ffff:127.0.0.1 - - [05/Dec/2024:09:56:28 +0000] "GET /v1/projects/1/forms/simple.xml HTTP/1.1" 200 1285
::ffff:127.0.0.1 - - [05/Dec/2024:09:56:28 +0000] "POST /v1/projects/1/forms/simple/submissions HTTP/1.1" 200 322
::ffff:127.0.0.1 - - [05/Dec/2024:09:56:28 +0000] "POST /v1/projects/1/forms/simple/submissions/one/attachments/submission.xml.enc HTTP/1.1" 200 16
::ffff:127.0.0.1 - - [05/Dec/2024:09:56:28 +0000] "GET /v1/projects/1/forms/simple/submissions/keys HTTP/1.1" 200 492
Error: #1212 Error thrown for {"keys":{"iv":"x2v9ZJz14hJy4/G9ma0yAg==","salt":"oXL2+4aFtutlKoBwTBDa8w==","pubkey":"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFzL0ljdWlaMmpOSU9QK3J4cU1kaApjUzM4aUZwc1Q2ZVBYc2RPK1FHR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gQt8KZ0ryn+2oYvN/rizqK4yLb9YcXccOk5gBxp2CKG3HW8zcYwOKS96c+yLPdMT9yBdFxyC5QFgp3diNaPSnfdq44AdfFT4cGBKDF8OedDOT0iXDLXGjjNzisOruaxNuVteqjtxvUdm37da6JjohUVUb54lpnLJyNLfYtALism4UZMnQukmNXIfesJRrZ9Jkc5raxPK8HyLZ8PXcRMo0lVOrfuQwuUPrSvCGB/zxh0q+Sjkk4Xm21mrTdUW4F/Ej1Nr6xl4W9e2wfb7jlD/NewIJrAHYkZoK4T+CoGHdA8p5JR0Zg7ejbU+PZO8M1PwuoxVBm3yE+d66IBFVigpO52628PdDrGBvQap+T6L/NUSqX0EaO0bfItpiRcGLfvJQeJD/w9EXhoPDEeQZeeDguSScwozDTVOeMsJo9MXAWezpVor9W0y3yDqCUN4NmsjU8lmCm/WQC4IK1AXIDept4blOnos3EH/Lrp/55vwxNGMWBBDegU2r3e8WU4IlNSbT65tWUVQJtjuNEKA/TA3eJ+0a033awGNLov37yUKz0+hmzZXndDcX5AFPBzABuanmIvQ="},"passphrase":"wrong"}
          This error is thrown for debugging https://github.com/getodk/central-backend/issues/1212.
          NOTE this is logging secret material so MUST NOT run outside of test environments.
        
    at /home/circleci/repo/lib/util/crypto.js:161:15
    at async Promise.all (index 0) {
  [cause]: Error: error:1C800064:Provider routines::bad decrypt
      at Decipheriv.final (node:internal/crypto/cipher:193:29)
      at /home/circleci/repo/lib/util/crypto.js:157:93
      at async Promise.all (index 0) {
    library: 'Provider routines',
    reason: 'bad decrypt',
    code: 'ERR_OSSL_BAD_DECRYPT'
  }
}Error: #1212 Error thrown for {"keys":{"iv":"x2v9ZJz14hJy4/G9ma0yAg==","salt":"oXL2+4aFtutlKoBwTBDa8w==","pubkey":"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFzL0ljdWlaMmpOSU9QK3J4cU1kaAp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4MTXUXvfP9k5xHh9EqBF5kzb05YmdgQt8KZ0ryn+2oYvN/rizqK4yLb9YcXccOk5gBxp2CKG3HW8zcYwOKS96c+yLPdMT9yBdFxyC5QFgp3diNaPSnfdq44AdfFT4cGBKDF8OedDOT0iXDLXGjjNzisOruaxNuVteqjtxvUdm37da6JjohUVUb54lpnLJyNLfYtALism4UZMnQukmNXIfesJRrZ9Jkc5raxPK8HyLZ8PXcRMo0lVOrfuQwuUPrSvCGB/zxh0q+Sjkk4Xm21mrTdUW4F/Ej1Nr6xl4W9e2wfb7jlD/NewIJrAHYkZoK4T+CoGHdA8p5JR0Zg7ejbU+PZO8M1PwuoxVBm3yE+d66IBFVigpO52628PdDrGBvQap+T6L/NUSqX0EaO0bfItpiRcGLfvJQeJD/w9EXhoPDEeQZeeDguSScwozDTVOeMsJo9MXAWezpVor9W0y3yDqCUN4NmsjU8lmCm/WQC4IK1AXIDept4blOnos3EH/Lrp/55vwxNGMWBBDegU2r3e8WU4IlNSbT65tWUVQJtjuNEKA/TA3eJ+0a033awGNLov37yUKz0+hmzZXndDcX5AFPBzABuanmIvQ="},"passphrase":"wrong"}
          This error is thrown for debugging https://github.com/getodk/central-backend/issues/1212.
          NOTE this is logging secret material so MUST NOT run outside of test environments.
        
    at /home/circleci/repo/lib/util/crypto.js:161:15
    at async Promise.all (index 0) {
  [cause]: Error: error:1C800064:Provider routines::bad decrypt
      at Decipheriv.final (node:internal/crypto/cipher:193:29)
      at /home/circleci/repo/lib/util/crypto.js:157:93
      at async Promise.all (index 0) {
    library: 'Provider routines',
    reason: 'bad decrypt',
    code: 'ERR_OSSL_BAD_DECRYPT'
  }
}::ffff:127.0.0.1 - - [05/Dec/2024:09:56:28 +0000] "GET /v1/projects/1/forms/simple/submissions.csv.zip?4=wrong HTTP/1.1" 500 35
      1) should reject with a reasonable message given incorrect passphrase

This test case has now been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant