MM-573: Sanitize tenant and auth headers to prevent header injection#2025
MM-573: Sanitize tenant and auth headers to prevent header injection#2025Divyateja2709 wants to merge 2 commits into
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
hi @therajanmaurya sir
This PR introduces a focused security hardening update in the network layer for MM-573 (Cipher 2026 remediation).
It sanitizes dynamic header values before request injection to reduce malformed-input and header-injection risk.
Changes included
Updated core/network/src/commonMain/kotlin/org/mifospay/core/network/config/InstanceConfigManager.kt
Sanitized platformTenantId in getPlatformTenantId()
Added normalization: trim, remove CR/LF, apply max length cap
Enforced tenant format: [A-Za-z0-9_-]+
Added safe fallback to default tenant when value is empty/invalid
Updated core/network/src/commonMain/kotlin/org/mifospay/core/network/utils/KtorInterceptor.kt
Added sanitizeHeaderValue() helper
Sanitized token before setting Authorization header in both interceptor paths
Skipped Authorization header when sanitized token becomes empty
Why this change
Prevents CR/LF-based header injection vectors in tenant/token values
Improves robustness when config or stored token data is malformed
Keeps scope intentionally small and low-risk for fast review
Validation
IDE lint checks on edited files passed (no new lint issues)
Full build/test execution was not run in this environment due to missing JAVA_HOME