Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add test for PathTraversal class#456

Merged
preetkaran20 merged 3 commits into
SasanLabs:masterfrom
richard66033:master
Dec 4, 2023
Merged

Add test for PathTraversal class#456
preetkaran20 merged 3 commits into
SasanLabs:masterfrom
richard66033:master

Conversation

@richard66033

Copy link
Copy Markdown
Contributor

No description provided.

@richard66033

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
@preetkaran20

Copy link
Copy Markdown
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