-
Notifications
You must be signed in to change notification settings - Fork 18
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
[PHEE-296A] Email Api Tc #293
base: master
Are you sure you want to change the base?
Conversation
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
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.
None of the test cases are verifying the callback.
|
||
@Value("${messageGateway.endpoint.email}") | ||
private String mgMail; | ||
@Value("${spring.mail.host}") |
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.
why do we need to use 'spring' here
@@ -256,7 +256,7 @@ jobs: | |||
uses: jitsecurity-controls/[email protected] | |||
with: | |||
security_control: registry.jit.io/control-semgrep-alpine:latest | |||
|
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.
looks like there are lots of formatting changes, you can remove this from this PR
@@ -0,0 +1 @@ | |||
|
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.
is this empty file?
endpoint: | ||
email: "/emails" | ||
|
||
spring: |
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.
you can ignore this level: spring. we don't need unless we cant avoid it
smtp: | ||
auth: false | ||
starttls: | ||
enable: false |
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.
google smtp requies TLS. can we test this with TLS for more compatibility?
Scenario: Sending an email to the recipient with failure in callback | ||
Given I can inject MockServer | ||
And I can start mock server | ||
And I can register the stub with "/sendMail" endpoint for "POST" request with status of 200 |
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.
All tests with same callback URL may cause issues like it use to cause before. use unique strings and add a check based on URL
And I have tenant as "paymentBB2" | ||
And I generate clientCorrelationId | ||
When I send an email to the following recipients with subject "Test Email" and body "This is a test email" with callbackurl as "/sendMail" and get 202 | ||
| [email protected] | |
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.
move subject and body to this datatable
rootNode = request.getRequest().getBodyAsString(); | ||
logger.info("Rootnode value:" + rootNode); | ||
assertThat(rootNode | ||
.contains("Email could not be sent to [[email protected]] because of Mail server connection failed")) |
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.
already mentioned in other PR, The error request body is not proper.
the message should be in sentence case
if (!(request.getRequest().getBodyAsString()).isEmpty() && request.getRequest().getUrl().equals("/sendMail")) { | ||
String rootNode = null; | ||
rootNode = request.getRequest().getBodyAsString(); | ||
logger.info("Rootnode value:" + rootNode); |
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.
donot use + for concatenating log statements
And the email service is running | ||
And I have tenant as "paymentBB2" | ||
And I generate clientCorrelationId | ||
When I send an email to the following recipients with subject "Test Email" and body "This is a test email" with callbackurl as "/sendMail" and get 202 |
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.
None of the test cases are verifying the callback.
Description
The Tc design is done based on greenmail mock
[]
.Format:
[jira_ticket] description
ex: [phee-123] PR title.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Followed the PR title naming convention mentioned above.
Acknowledge that we will not merge PRs that are not passing the checks ("green") - it is your (author's) responsibility to get a proposed PR to pass all the checks, not primarily the project's maintainers.
The PR title should include a JIRA ticket
Design-related bullet points or design document links related to this PR added in the description above.
Updated corresponding Postman Collection or API documentation for the changes in this PR.
Create/update unit or integration tests for verifying the changes made.
Add required Swagger annotation and update API documentation with details of any API changes if applicable
Followed the naming conventions as given in https://docs.google.com/document/d/1Q4vaMSzrTxxh9TS0RILuNkSkYCxotuYk1Xe0CMIkkCU/edit?usp=sharing
Followed coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
FYI our guidelines for code reviews same as https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.