You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 3, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 3, 2026. It is now read-only.
Shift NotBefore -1 day to avoid timing issues when system clocks are not perfectly in sync #96
Today I used patch-package to patch saml@3.0.1 for the project I'm working on.
When the generated SAML assertion is immediately sent to a SAML consumer, it can happen that the consumer refuses the assertion if the consumer's system clock has not reached the 'NotBefore' timestamp.
Here is the diff that solved my problem:
diff --git a/node_modules/saml/lib/saml20.js b/node_modules/saml/lib/saml20.js
index 9db8141..5ba6ec3 100644
--- a/node_modules/saml/lib/saml20.js+++ b/node_modules/saml/lib/saml20.js@@ -168,7 +168,7 @@ function createAssertion(options, strategies, callback) {
var confirmationData = doc.documentElement.getElementsByTagName('saml:SubjectConfirmationData');
if (options.lifetimeInSeconds) {
- conditions[0].setAttribute('NotBefore', now.format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));+ conditions[0].setAttribute('NotBefore', now.clone().subtract(1, "days").format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
conditions[0].setAttribute('NotOnOrAfter', now.clone().add(options.lifetimeInSeconds, 'seconds').format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
confirmationData[0].setAttribute('NotOnOrAfter', now.clone().add(options.lifetimeInSeconds, 'seconds').format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
Activity
fix: patch saml dependency for clock skew