Skip to content

Fixing Torq hostname identifying logic#194003

Closed
igorkheif wants to merge 13 commits intoelastic:mainfrom
igorkheif:fix-torq-url
Closed

Fixing Torq hostname identifying logic#194003
igorkheif wants to merge 13 commits intoelastic:mainfrom
igorkheif:fix-torq-url

Conversation

@igorkheif
Copy link
Copy Markdown

@igorkheif igorkheif commented Sep 25, 2024

Summary

This change allows the connector to validate all of the Torq subdomains such as hooks.eu.torq.io instead of just the default hooks.torq.io.
This need arises as Torq now has several environments in various locations, and they all use different subdomains.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@igorkheif igorkheif requested a review from a team as a code owner September 25, 2024 13:31
@cla-checker-service
Copy link
Copy Markdown

cla-checker-service bot commented Sep 25, 2024

💚 CLA has been signed

@pmuellr pmuellr added the Team:Detection Alerts Security Detection Alerts Area Team label Sep 25, 2024
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detection-engine (Team:Detection Alerts)

@pmuellr
Copy link
Copy Markdown
Contributor

pmuellr commented Sep 25, 2024

Is there an issue open for this? Not seeing one ...

@pmuellr pmuellr requested a review from a team September 25, 2024 17:44
@pmuellr
Copy link
Copy Markdown
Contributor

pmuellr commented Sep 25, 2024

I've added security-detections-response as a reviewer, as that team owns this code. After their review, response-ops will review ...

@cnasikas cnasikas added backport:skip This PR does not require backporting backport:prev-minor labels Oct 14, 2024
};
if (!isUrl(value)) return error;
const hostname = new URL(value).hostname;
const isTorqHostname = /^hooks(\.[a-z0-9]+)*\.torq\.io$/.test(hostname);
Copy link
Copy Markdown
Contributor

@michaelolo24 michaelolo24 Oct 30, 2024

Choose a reason for hiding this comment

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

Looks like this was the only functional change in this PR. It looks good and the tests look great, thank you for adding them. Will leave the final review and approval to the @elastic/response-ops team as I'm not familiar with the torq.io url naming patterns. Thanks for the improvement @igorkheif !

@cnasikas
Copy link
Copy Markdown
Member

cnasikas commented Nov 19, 2024

@michaelolo24 @igorkheif Before reviewing we need the security solution team to review, test, and approve the PR. After that, we will do a high-level review. Could you also please update the description so reviewers unfamiliar with Torq will better understand what this PR is about? Thanks!

@asnehalb
Copy link
Copy Markdown

asnehalb commented Dec 4, 2024

@igorkheif As Christos also mentioned above, could you please add more details to the description and also some steps/instructions for how to test the PR so reviewers unfamiliar with Torq will have a better understanding ?

@michaelolo24
Copy link
Copy Markdown
Contributor

@igorkheif - Thanks for making these changes. We were able to test it, and while the validation on the UI is working as expected, you'll also need to modify the server side validation as well:

if (configureUrlObj.hostname !== 'hooks.torq.io' && configureUrlObj.hostname !== 'localhost') {
and please update the tests as well

Copy link
Copy Markdown
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Please update the validation on the server as well:

if (configureUrlObj.hostname !== 'hooks.torq.io' && configureUrlObj.hostname !== 'localhost') {

@igorkheif
Copy link
Copy Markdown
Author

igorkheif commented Feb 3, 2025

@igorkheif - Thanks for making these changes. We were able to test it, and while the validation on the UI is working as expected, you'll also need to modify the server side validation as well:

if (configureUrlObj.hostname !== 'hooks.torq.io' && configureUrlObj.hostname !== 'localhost') {

and please update the tests as well

@michaelolo24 Thanks, good catch! Done!

@michaelolo24
Copy link
Copy Markdown
Contributor

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@Zacqary Zacqary left a comment

Choose a reason for hiding this comment

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

LGTM from Response Ops side, thanks @igorkheif

@Zacqary Zacqary enabled auto-merge (squash) March 3, 2025 17:10
@cnasikas cnasikas added backport:version Backport to applied version labels v9.1.0 v8.19.0 Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// Feature:Actions/ConnectorTypes Issues related to specific Connector Types on the Actions Framework and removed backport:skip This PR does not require backporting backport:prev-minor labels Mar 4, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@cnasikas
Copy link
Copy Markdown
Member

cnasikas commented Mar 4, 2025

@elasticmachine merge upstream

@semd
Copy link
Copy Markdown
Contributor

semd commented Mar 7, 2025

This has already been implemented in #212563. Closing this one.
Thanks!

@semd semd closed this Mar 7, 2025
auto-merge was automatically disabled March 7, 2025 18:04

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels 💝community Feature:Actions/ConnectorTypes Issues related to specific Connector Types on the Actions Framework release_note:enhancement Team:Detection Alerts Security Detection Alerts Area Team Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants