-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: redact S3 URLs in tests #3421
Conversation
WalkthroughIn a spectacular display of digital transformation, this pull request revolutionizes file-related mock data and test configurations across multiple components. The primary focus is updating S3 storage URLs from specific bucket locations to more generic, placeholder URLs. These changes span mock data files, service tests, and page specifications, ensuring a consistent and anonymized approach to file URL handling. Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
Poem
Extra Rajinikanth SwaggerThalaiva style announcement: These URL changes? They're not just updates, they're a MASS TRANSFORMATION! 😎 One line of code can change the entire digital universe, and that's how we roll in the world of software! 💥🔥 Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
src/app/core/mock-data/file-object.data.ts
(1 hunks)src/app/core/services/file.service.spec.ts
(1 hunks)src/app/core/services/report.service.spec.ts
(1 hunks)src/app/fyle/add-edit-advance-request/add-edit-advance-request-2.page.spec.ts
(1 hunks)src/app/fyle/my-view-advance-request/my-view-advance-request.page.spec.ts
(1 hunks)
🔇 Additional comments (3)
src/app/fyle/add-edit-advance-request/add-edit-advance-request-2.page.spec.ts (1)
220-220
: Superstar level consistency in URL redaction!The test case uses the same redacted S3 URL format as the mock data, maintaining consistency across the codebase.
src/app/core/services/file.service.spec.ts (1)
154-154
: Style-ah style-ah! Perfect URL redaction in test cases!The test cases for
getReceiptExtension
use properly redacted S3 URLs while maintaining test coverage for both JPEG and PDF extensions.Also applies to: 161-161
src/app/core/services/report.service.spec.ts (1)
435-435
: Thalaiva level attention to detail in URL redaction!The test case for
downloadSummaryPdfUrl
uses properly redacted S3 URL while maintaining all necessary query parameters for testing PDF download functionality.
url: 'https://xyz.s3.amazonaws.com/2023-02-23/orexample/receipts/fiSSsy2Bf4Se.000.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230223T151537Z&X-Amz-SignedHeaders=host&X-Amz-Expires=604800&X-Amz-Credential=XXXX%2F20230223%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=d79c2711892e7cb3f072e223b7b416408c252da38e7df0995e3d256cd8509fee', | ||
type: 'image', | ||
thumbnail: | ||
'https://fyle-storage-mumbai-3.s3.amazonaws.com/2023-02-23/orrjqbDbeP9p/receipts/fiSSsy2Bf4Se.000.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230223T151537Z&X-Amz-SignedHeaders=host&X-Amz-Expires=604800&X-Amz-Credential=AKIA54Z3LIXTX6CFH4VG%2F20230223%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=d79c2711892e7cb3f072e223b7b416408c252da38e7df0995e3d256cd8509fee', | ||
'https://xyz.s3.amazonaws.com/2023-02-23/orexample/receipts/fiSSsy2Bf4Se.000.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230223T151537Z&X-Amz-SignedHeaders=host&X-Amz-Expires=604800&X-Amz-Credential=XXXX%2F20230223%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=d79c2711892e7cb3f072e223b7b416408c252da38e7df0995e3d256cd8509fee', |
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.
🧹 Nitpick (assertive)
Mind-blowing redaction, but let's maintain consistency across all mock data!
The S3 URLs have been properly redacted in fileObjectAdv
and fileObjectAdv1
, but I notice similar unredacted S3 URLs in other mock objects within this file.
For complete consistency, consider redacting S3 URLs in other mock objects like fileObjectData
, fileObjectData1
, etc. using the same pattern:
- s3url: '2023-02-01/orNVthTo2Zyo/receipts/fiHPZUiichAS.000.jpeg',
+ s3url: '2023-02-01/orexample/receipts/fiHPZUiichAS.000.jpeg',
Also applies to: 117-120
@@ -158,7 +158,7 @@ describe('MyViewAdvanceRequestPage', () => { | |||
expect(result).toEqual({ | |||
type: 'image', | |||
thumbnail: | |||
'https://fyle-storage-mumbai-3.s3.amazonaws.com/2023-02-23/orrjqbDbeP9p/receipts/fiSSsy2Bf4Se.000.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230223T151537Z&X-Amz-SignedHeaders=host&X-Amz-Expires=604800&X-Amz-Credential=AKIA54Z3LIXTX6CFH4VG%2F20230223%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=d79c2711892e7cb3f072e223b7b416408c252da38e7df0995e3d256cd8509fee', | |||
'https://xyz.s3.amazonaws.com/2023-02-23/orrjqbDbeP9p/receipts/fiSSsy2Bf4Se.000.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230223T151537Z&X-Amz-SignedHeaders=host&X-Amz-Expires=604800&X-Amz-Credential=XXXX%2F20230223%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=d79c2711892e7cb3f072e223b7b416408c252da38e7df0995e3d256cd8509fee', |
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.
Listen up, partner! Let's make this URL more stylish and secure! 😎
The URL still contains sensitive information like AWS credentials and internal paths. Mind-it! Even in test files, we should be extra careful.
Here's a power-packed solution that'll knock your socks off:
- 'https://xyz.s3.amazonaws.com/2023-02-23/orrjqbDbeP9p/receipts/fiSSsy2Bf4Se.000.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230223T151537Z&X-Amz-SignedHeaders=host&X-Amz-Expires=604800&X-Amz-Credential=XXXX%2F20230223%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=d79c2711892e7cb3f072e223b7b416408c252da38e7df0995e3d256cd8509fee',
+ 'https://dummy-s3.amazonaws.com/test-file.pdf',
And for extra style points, create a constant for these test URLs:
// Add this at the top with other test constants
export const TEST_FILE_URL = 'https://dummy-s3.amazonaws.com/test-file.pdf';
Because that's how we roll in the testing world! 🌟
PR description must contain a link to a ClickUp (case-insensitive) |
PR description must contain a link to a ClickUp (case-insensitive) |
|
Clickup
https://app.clickup.com/t/86cxnebry
Code Coverage
Please add code coverage here
UI Preview
Please add screenshots for UI changes
Summary by CodeRabbit
Chores
Security