-
Notifications
You must be signed in to change notification settings - Fork 113
fix: [IOPID-0000] apply fix on saml rquest decode #7397
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
base: master
Are you sure you want to change the base?
Conversation
Jira Pull Request LinkThis Pull Request refers to Jira issues: |
PR Title Validation for conventional commit type✅ All good! PR title follows the conventional commit type. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7397 +/- ##
=======================================
Coverage 59.38% 59.38%
=======================================
Files 1823 1823
Lines 39232 39232
Branches 9012 8949 -63
=======================================
Hits 23297 23297
- Misses 15853 15866 +13
+ Partials 82 69 -13
... and 13 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a compatibility issue in SAML request decoding by changing the data type passed to pako.inflateRaw from Buffer to Uint8Array.
Key Changes:
- Modified the
lollipopSamlVerifyfunction to wrap the Buffer inUint8Array.from()before passing topako.inflateRaw
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // Result is a base64 encoded string, so decode it to obtain the (server) original XML | ||
| const xmlSamlRequest = pako.inflateRaw( | ||
| Buffer.from(decodedSamlRequest, "base64"), | ||
| Uint8Array.from(Buffer.from(decodedSamlRequest, "base64")), |
Copilot
AI
Oct 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conversion Uint8Array.from(Buffer.from(...)) creates an unnecessary intermediate Buffer object. Since Buffer in Node.js is already a subclass of Uint8Array, you can directly pass the Buffer to pako.inflateRaw. If compatibility issues exist, consider using new Uint8Array(Buffer.from(decodedSamlRequest, "base64")) instead, which is more efficient as it creates a view over the same memory rather than copying the data.
| Uint8Array.from(Buffer.from(decodedSamlRequest, "base64")), | |
| new Uint8Array(Buffer.from(decodedSamlRequest, "base64")), |
| // SAMLRequest is URL encoded, so decode it | ||
| try { | ||
| const decodedSamlRequest = decodeURIComponent(urlEncodedSamlRequest); | ||
| // Result is a base64 encoded string, so decode it to obtain the (server) original XML |
Copilot
AI
Oct 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'rquest' to 'request' in the PR title.
Short description
This pull request introduces a small fix to the
lollipopSamlVerifyfunction ints/features/lollipop/utils/login.tsto improve compatibility when decoding SAML requests.pako.inflateRawfrom aBufferto aUint8Arrayto ensure correct handling of binary data when decoding base64-encoded SAML requests.How to test
Run the application and try to decode saml request on login flow