fix: Fix 2 template properties deserialization WPB-28090 - #138
fix: Fix 2 template properties deserialization WPB-28090#138spoonman01 wants to merge 4 commits into
Conversation
- Add 2 new templates for PR ready for review and reopened
| - WIRE_SDK_ENVIRONMENT=${WIRE_SDK_ENVIRONMENT} | ||
| ports: | ||
| - "${GHAPP_SERVER_PORT}:${GHAPP_SERVER_PORT}" | ||
| - "${GHAPP_SERVER_PORT:-8083}:${GHAPP_SERVER_PORT:-8083}" |
There was a problem hiding this comment.
Semgrep identified an issue in your code:
The app service maps GHAPP_SERVER_PORT without a host-IP restriction, exposing the GitHub app on all host interfaces. Any network-reachable attacker can scan the host and send requests to the application port.
More details about this
The app service publishes ${GHAPP_SERVER_PORT:-8083} as a host port without a host IP, so Docker binds it to all host interfaces (0.0.0.0). If GHAPP_SERVER_PORT is unset, the application listens at http://<host>:8083; if it is set, the same value controls the externally reachable host port. This makes the GitHub app endpoint accessible from any network that can reach the Docker host, rather than only from the local machine or an explicitly trusted interface.
A plausible attack is:
- An attacker scans the host, for example with
nmap -p 8083 <host-ip>, and finds the port open because the Compose mapping exposes it on every interface. - The attacker sends requests such as
curl http://<host-ip>:8083/or probes application API routes served by theappcontainer. - The app processes those requests as external traffic; any unauthenticated route, exposed debugging endpoint, or request-handling flaw can then be used remotely to access application data or invoke GitHub integration behavior.
- Because
GHAPP_SERVER_PORTalso comes from the environment, changing that variable can unintentionally move the same service to another publicly reachable port without changing the Compose file.
To resolve this comment:
✨ Commit fix suggestion
| - "${GHAPP_SERVER_PORT:-8083}:${GHAPP_SERVER_PORT:-8083}" | |
| - "127.0.0.1:${GHAPP_SERVER_PORT:-8083}:${GHAPP_SERVER_PORT:-8083}" |
View step-by-step instructions
- Bind the published application port to localhost by changing the mapping to
127.0.0.1:${GHAPP_SERVER_PORT:-8083}:${GHAPP_SERVER_PORT:-8083}. - Alternatively, if the application does not need host access, remove the
portsentry and let other Compose services access it through the internal network. - Remove Redis’s
portsentry unless Redis must be accessed from the host. Theappservice can reach Redis usingredis:6379without publishing Redis externally. - Alternatively, if external access is required, replace
127.0.0.1with the specific trusted host interface address and restrict access with firewall rules. Binding without a host address exposes the port on all host interfaces.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by port-all-interfaces.
You can view more details about this finding in the Semgrep AppSec Platform.
Code Review —
|
bbaarriiss
left a comment
There was a problem hiding this comment.
From the description we don't see what actually is fixed. It could be nice to write better description shortly.
Other than that I added a comment about one test-case. If you want we can test together since that case should be tested with two different users.
- Claude comments, making all the body fields nullable in all objects
|
Luca's comment on PR |
|
Comment 2 |
| @Serializable | ||
| data class Comment( | ||
| val body: String, | ||
| val body: String? = null, |
There was a problem hiding this comment.
TEST 1 - inline comment
There was a problem hiding this comment.
New inline comment
There was a problem hiding this comment.
New inline comment, pleeeeease
There was a problem hiding this comment.
Inline comment, see if it triggers both events or not
spoonman01
left a comment
There was a problem hiding this comment.
Comment review
…ull review but just a comment
spoonman01
left a comment
There was a problem hiding this comment.
Comment on review
|
👉🏼 This is a multi line comment from Conversation page. line 5 (line 4 was empty line) |
| [pull request]({{pullRequest.htmlUrl}}) | ||
| —{{/review.body}} | ||
| {{#review.body}} | ||
| 📝 **Pull request review {{pullRequest.title}}** has been **{{review.state}}** by **{{review.user.login}}** |
There was a problem hiding this comment.
We better remove {pullRequest.title} here. Because it is already shown in the PR line at the end like it is in other templates.
Also, the title lenght will always change and it will make the first line less readable.
| —{{/review.body}} | ||
| {{#review.body}} | ||
| 📝 **Pull request review {{pullRequest.title}}** has been **{{review.state}}** by **{{review.user.login}}** | ||
| **Text:** {{{review.body}}} |
There was a problem hiding this comment.
It will be better to have this line as the last line.
Becasue the length of this one can change. So it is better to have it at the end. So we will see Repository and PR lines always in the same place. But the dynamic length text content will be at the end.
| [pull request]({{pullRequest.htmlUrl}}) | ||
| —{{/review.body}} | ||
| {{#review.body}} | ||
| 📝 **Pull request review {{pullRequest.title}}** has been **{{review.state}}** by **{{review.user.login}}** |
There was a problem hiding this comment.
👉🏼 This is a multi line comment from Files changed page.
line 2 lalala
line 3 lelele
line 5 (line 4 was empty line)
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764The PR Description
What's new in this PR?
Issues
Add new template for PR re-opened
Add new template for PR ready for review
Fix for “pull_request_review_comment.created fails even though there's a template for it“
Fix for review.body field not always being present
Fix for "merged" field not always being present
"template not found" logged as INFO instead of ERROR
Health checks are logged, polluting the logs
Causes (Optional)
Template not to work for such events
Solutions
Make fields nullable, also add 2 more events, log correctly ignoring health
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.