Skip to content
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

Add test for PathTraversal class #456

Merged
merged 3 commits into from
Dec 4, 2023
Merged

Conversation

richard66033
Copy link
Contributor

No description provided.

@richard66033
Copy link
Contributor Author

Can I ask you to check if the tests are done correctly? Thank you. :)

assertEquals(HttpStatus.OK, response.getStatusCode());
}
@Test
void testGetVulnerablePayloadLevel2WithNullFileName() throws URISyntaxException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richard66033 can you please use other conditions for test instead of just Null like ../ is there in level 1 and it passes the test but if ../ is there in second level, it will not allow it. Similarly .. and %2f are not there in level 4 and so on.

import static org.junit.jupiter.api.Assertions.*;


class PathTraversalVulnerabilityTest {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run ./gradlew spotlessApply this will fix the indentation and will pass the CI/CD pipeline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@richard66033
Copy link
Contributor Author

Hi @preetkaran20, I add more tests with conditions like ../ and other. Can I ask you to check if the tests are done correctly now? Thank you.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (master@cd5f33b). Click here to learn what that means.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #456   +/-   ##
=========================================
  Coverage          ?   23.15%           
  Complexity        ?      206           
=========================================
  Files             ?       55           
  Lines             ?     1831           
  Branches          ?      196           
=========================================
  Hits              ?      424           
  Misses            ?     1365           
  Partials          ?       42           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@preetkaran20 preetkaran20 merged commit f5045a4 into SasanLabs:master Dec 4, 2023
1 check passed
@preetkaran20
Copy link
Member

Hi @richard66033 ,

Thanks a lot for the PR ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants