@digilogiclabs/platform-core 1.28.0 → 1.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auth.mjs CHANGED
@@ -698,11 +698,24 @@ async function checkRateLimit(operation, identifier, rule, options = {}) {
698
698
  retryAfterSeconds: 0
699
699
  };
700
700
  } catch (error) {
701
- options.logger?.error("Rate limit check failed, allowing request", {
702
- error: error instanceof Error ? error.message : String(error),
703
- operation,
704
- identifier
705
- });
701
+ options.logger?.error(
702
+ rule.failClosed ? "Rate limit check failed, denying request (fail-closed rule)" : "Rate limit check failed, allowing request",
703
+ {
704
+ error: error instanceof Error ? error.message : String(error),
705
+ operation,
706
+ identifier
707
+ }
708
+ );
709
+ if (rule.failClosed) {
710
+ return {
711
+ allowed: false,
712
+ remaining: 0,
713
+ resetAt,
714
+ current: 0,
715
+ limit,
716
+ retryAfterSeconds: 30
717
+ };
718
+ }
706
719
  return {
707
720
  allowed: true,
708
721
  remaining: limit,