🧹 Update go-atlassian to v2.11.0 and add nil safety guards#6404
🧹 Update go-atlassian to v2.11.0 and add nil safety guards#6404
Conversation
c77a0a3 to
201aa8c
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the Atlassian provider to use the latest go-atlassian v2 module and adapts the provider implementation to breaking API changes, primarily around import paths, field names, and Jira date handling.
Changes:
- Bumped
github.com/ctreminiom/go-atlassiandependency togithub.com/ctreminiom/go-atlassian/v2 v2.9.0and updated all Atlassian connection packages to use the new v2 import paths. - Adjusted Jira resource code to use the new
AvatarURLsfield and the new typedCreatedfield (no longer parsing a string timestamp, but converting from the library’s time type), removing the now-unusedJIRA_TIME_FORMATconstant. - Cleaned up the Atlassian LR manifest by removing empty
fields: {}entries and refreshedgo.sumfor updated transitive dependencies (e.g.,gjson,go-containerregistry,go-querystring).
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
providers/atlassian/resources/atlassian_jira.go |
Updates Jira resource logic to match the v2 client: switches to AvatarURLs fields and converts the new typed Created value to time.Time, removing the obsolete time format constant. |
providers/atlassian/resources/atlassian.lr.manifest.yaml |
Removes redundant empty fields: {} entries for the root atlassian resource and atlassian.admin.user.products, leaving the rest of the manifest unchanged. |
providers/atlassian/go.mod |
Switches to github.com/ctreminiom/go-atlassian/v2 v2.9.0 and adds/updates indirect dependencies required by the new version. |
providers/atlassian/go.sum |
Regenerates dependency checksums to reflect the new go-atlassian v2 module and updated transitive libraries (e.g., gjson, go-containerregistry, go-querystring). |
providers/atlassian/connection/scim/connection.go |
Updates SCIM connection to use github.com/ctreminiom/go-atlassian/v2/admin while keeping authentication and validation logic the same. |
providers/atlassian/connection/jira/connection.go |
Updates Jira connection to use github.com/ctreminiom/go-atlassian/v2/jira/v2 while preserving host/user/token handling and the auth check. |
providers/atlassian/connection/confluence/connection.go |
Updates Confluence connection to import github.com/ctreminiom/go-atlassian/v2/confluence with unchanged client setup. |
providers/atlassian/connection/admin/connection.go |
Updates Admin connection to import github.com/ctreminiom/go-atlassian/v2/admin with existing token-based auth and validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
201aa8c to
b9843da
Compare
There was a problem hiding this comment.
Atlassian provider library upgrade from v1 to v2 with adapted field access patterns.
Additional findings (file/line not in diff):
- 🟡
providers/atlassian/resources/atlassian_jira.go:243—issue.Fields.Project,issue.Fields.Status, andissue.Fields.IssueTypeare accessed without nil checks (lines 243-249). If the v2 library changed these to pointer types (as it did withCreatedand potentiallyCreator), these will panic on nil dereference. Verify whether these are value types or pointers in the v2 API.
- Changed github.com/ctreminiom/go-atlassian v1.6.1 → github.com/ctreminiom/go-atlassian/v2 v2.9.0
- Update breaking changes in the new library:
- AvatarUrls → AvatarURLs: Field was renamed for Go naming conventions (lines 50, 235)
- issue.Fields.Created type change: Changed from string to *models.DateTimeScheme (which is a type alias for time.Time). Updated the parsing logic from:
created, err := time.Parse(JIRA_TIME_FORMAT, issue.Fields.Created)
to
var created time.Time
if issue.Fields.Created != nil {
created = time.Time(*issue.Fields.Created)
}
Signed-off-by: Tim Smith <tsmith84@gmail.com>
| "name": llx.StringData(user.DisplayName), | ||
| "type": llx.StringData(user.AccountType), | ||
| "picture": llx.StringData(user.AvatarUrls.One6X16), | ||
| "picture": llx.StringData(user.AvatarURLs.One6X16), |
There was a problem hiding this comment.
🔴 critical — user.AvatarURLs is accessed without a nil check here, but the same struct's field is nil-checked in the issues path (line 234). If the v2 library made AvatarURLs a pointer (which the nil check in the issues code suggests), this will panic on users without an avatar.
var picture string
if user.AvatarURLs != nil {
picture = user.AvatarURLs.One6X16
}Then use llx.StringData(picture).
Summary
go-atlassianfrom v1 to v2.11.0 (latest)Creator,AvatarURLs,Project,Status,IssueType,Created) to prevent nil pointer panicsTest plan
make providers/build/atlassian