Skip to content

Conversation

@shahzadhaider1
Copy link
Contributor

Add configuration option to override Jira installation type autodetection (Cloud vs Data Center).

Problem

Currently, we autodetect whether a Jira instance is Cloud or Data Center by making a HEAD request to a cloud-only endpoint. If the endpoint returns 404, it's assumed to be Data Center; otherwise, it's Cloud.

This autodetection could fail if:

  • Atlassian changes their API endpoints
  • Network/firewall rules block the detection request
  • Custom Jira configurations behave unexpectedly

Solution

Added installation_type field to the Jira source configuration.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@shahzadhaider1 shahzadhaider1 requested a review from a team November 20, 2025 16:27
@shahzadhaider1 shahzadhaider1 requested review from a team as code owners November 20, 2025 16:27
@shahzadhaider1 shahzadhaider1 changed the title Addition of Installation Type field in Jira Source Proto Addition of Installation Type field in Jira Source Proto [INS-79] Nov 20, 2025
@shahzadhaider1 shahzadhaider1 force-pushed the INS-79-jira-cloud-on-prem-autodetection branch from 1d9983d to 141b4e6 Compare November 21, 2025 06:35
Comment on lines +341 to +345
enum JiraInstallationType {
JIRA_INSTALLATION_TYPE_AUTODETECT = 0;
JIRA_INSTALLATION_TYPE_CLOUD = 1;
JIRA_INSTALLATION_TYPE_DATA_CENTER = 2;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a good practice (mentioned in the protobuf guide) to have the first value of the enum be ENUM_TYPE_NAME_UNSPECIFIED or ENUM_TYPE_NAME_UNKNOWN

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I was just following convention. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, it's a matter of what we've been doing and what's the right way of doing it....... I'm not sure about this.

Personally I agree with the guide. Having the default value of the enum be an UNKNOWN value makes sense because then your downstream application can know that the caller did not explicitly specify a value. In our case, we would probably map this UNKNOWN to AUTODETECT, but still there will be a way to differentiate if the user actually wanted AUTODETECT or if they just didn't specify a value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great callout! :) But in this particular case, we (well, I) consciously chose for AUTODETECT to be the "unknown" option. No user is ever going to explicitly configure AUTODETECT because it's documented as the default, so there is a nice congruence between "default behavior" and "unspecified behavior."

And while maybe the choice I made was not the best one, I believe that it's important to make the same choice here so we get the benefits of consistency. If either of you feel more strongly the other way though, let's have a broader conversation about it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense; consistency is a solid point.
I'm fine with keeping it as AUTODETECT or following the best practice.

I requested a review from @camgunz just for visibility / another perspective since you mentioned a broader discussion could make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going ahead with the initial implementation (as suggested by Cody as well).

@shahzadhaider1 shahzadhaider1 force-pushed the INS-79-jira-cloud-on-prem-autodetection branch from f01eeec to 141b4e6 Compare November 27, 2025 10:18
@shahzadhaider1 shahzadhaider1 merged commit 71caba8 into trufflesecurity:main Nov 27, 2025
13 checks passed
@shahzadhaider1 shahzadhaider1 deleted the INS-79-jira-cloud-on-prem-autodetection branch November 27, 2025 10:49
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.

4 participants