Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cmd/baton-linear/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@
var version = "dev"

func main() {
ctx := context.Background()
/*logger, _ := zap.NewProduction()
// logger, _ := zap.NewDevelopment()
defer logger.Sync()
_, cmd, err := configschema.DefineConfiguration(ctx, "baton-linear", getConnector, cfg.Config)
ctx := ctxzap.ToContext(context.Background(), logger)
*/
_, cmd, err := configschema.DefineConfiguration(context.Background(), "baton-linear", getConnector, cfg.Config)
Copy link

Choose a reason for hiding this comment

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

Bug: Debug Code Leak Causes Logging Failures

Commented-out temporary debugging code for logger initialization and context setup was accidentally committed. This prevents proper zap logging, as context.Background() is used instead of the intended ctxzap.ToContext() setup, leading to logging issues in production.

Locations (1)
Fix in Cursor Fix in Web

if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}

cmd.Version = version

err = cmd.Execute()
//err = cmd.ExecuteContext(ctx)

Check failure on line 34 in cmd/baton-linear/main.go

View workflow job for this annotation

GitHub Actions / go-lint

commentFormatting: put a space between `//` and comment text (gocritic)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.23.4
toolchain go1.24.0

require (
github.com/conductorone/baton-sdk v0.3.13
github.com/conductorone/baton-sdk v0.3.22
github.com/ennyjfrick/ruleguard-logfatal v0.0.2
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/quasilyte/go-ruleguard/dsl v0.3.22
Expand Down Expand Up @@ -111,6 +111,7 @@ require (
golang.org/x/oauth2 v0.26.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/term v0.29.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250219182151-9fdb1cabc7b2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/conductorone/baton-sdk v0.3.13 h1:CeLd7LkYxuohH2xFGVlkZZLQNYThdG9F4NlBjN9F+mc=
github.com/conductorone/baton-sdk v0.3.13/go.mod h1:lWZHgu025Rsgs5jvBrhilGti0zWF2+YfaFY/bWOS/g0=
github.com/conductorone/baton-sdk v0.3.22 h1:o5q/I869sfa99kKnnHG4NjDY5g/Pf0nXQb7SgHTzEx4=
github.com/conductorone/baton-sdk v0.3.22/go.mod h1:L55WO3ERMx1mfpjDgwK3jWNRGRF2E76WrQHmW6ev8VY=
github.com/conductorone/dpop v0.2.3 h1:s91U3845GHQ6P6FWrdNr2SEOy1ES/jcFs1JtKSl2S+o=
github.com/conductorone/dpop v0.2.3/go.mod h1:gyo8TtzB9SCFCsjsICH4IaLZ7y64CcrDXMOPBwfq/3s=
github.com/conductorone/dpop/integrations/dpop_grpc v0.2.3 h1:kLMCNIh0Mo2vbvvkCmJ3ixsPbXEJ6HPcW53Ku9yje3s=
Expand Down
7 changes: 7 additions & 0 deletions pkg/connector/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
ent "github.com/conductorone/baton-sdk/pkg/types/entitlement"
grant "github.com/conductorone/baton-sdk/pkg/types/grant"
rs "github.com/conductorone/baton-sdk/pkg/types/resource"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap"
"go.uber.org/zap"
)

const (
Expand Down Expand Up @@ -52,6 +54,11 @@ func projectResource(project *linear.Project, parentId *v2.ResourceId) (*v2.Reso
}

func (o *projectResourceType) List(ctx context.Context, parentId *v2.ResourceId, token *pagination.Token) ([]*v2.Resource, string, annotations.Annotations, error) {
l := ctxzap.Extract(ctx)
l.Debug("********** List debug project")
Copy link

Choose a reason for hiding this comment

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

Bug: Unintended Debug Logging in Production

Accidentally committed temporary debug logging code. The lines l := ctxzap.Extract(ctx) and l.Debug("********** List debug project") (with its distinctive '**********' pattern) are not intended for production.

Locations (1)
Fix in Cursor Fix in Web

l.Info("********** List info project")
zap.L().Debug("******List zap project debug")
zap.L().Info("******List zap project info")
Copy link

Choose a reason for hiding this comment

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

Bug: Debug Logging Statements Left In Code

Temporary debug logging statements with hardcoded messages (e.g., "********** List debug project", "******List zap project debug") and calls to both ctxzap.Extract() and zap.L() were accidentally committed and should be removed.

Locations (2)
Fix in Cursor Fix in Web

var annotations annotations.Annotations
bag, err := parsePageToken(token.Token, &v2.ResourceId{ResourceType: resourceTypeProject.Id})
if err != nil {
Expand Down
12 changes: 10 additions & 2 deletions pkg/linear/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ type Client struct {
}

func NewClient(ctx context.Context, apiKey string) (*Client, error) {
options := []uhttp.Option{uhttp.WithLogger(true, ctxzap.Extract(ctx))}
l := ctxzap.Extract(ctx)
options := []uhttp.Option{uhttp.WithLogger(true, l)}
ctx = ctxzap.ToContext(ctx, l)

httpClient, err := uhttp.NewClient(ctx, options...)
if err != nil {
return nil, fmt.Errorf("creating HTTP client failed: %w", err)
}
wrapper := uhttp.NewBaseHttpClient(httpClient)
wrapper, err := uhttp.NewBaseHttpClientWithContext(ctx, httpClient)
if err != nil {
return nil, err
}

l.Info("************* Linear New client debug")
l.Debug("************* Linear New client debug")
Copy link

Choose a reason for hiding this comment

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

Bug: Debug Logs Committed to Codebase

Temporary debug logging statements, characterized by asterisk patterns such as ********** List debug project and ************* Linear New client debug, were accidentally committed to the codebase. These logs are not production-ready and must be removed.

Locations (2)
Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

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

Bug: Compilation Error and Debug Logging

The NewClient function introduces a compilation error by attempting to call the non-existent uhttp.NewBaseHttpClientWithContext function. Additionally, temporary debug logging statements (l.Info("************* Linear New client debug") and l.Debug("************* Linear New client debug")) were accidentally committed and should be removed.

Locations (1)
Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

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

Bug: Debug Logging Overriding User Settings

The log level is hardcoded to "debug" in multiple initLogger calls (e.g., for lambda, grpc, and generic commands), overriding user configuration and forcing all logging to debug. This appears to be accidentally committed debug code. Additionally, explicit debug Info and Debug log statements were committed in pkg/linear/client.go.

Locations (5)
Fix in Cursor Fix in Web


apiUrl, err := url.Parse(APIEndpoint)
if err != nil {
Expand Down
25 changes: 18 additions & 7 deletions vendor/github.com/conductorone/baton-sdk/pkg/cli/commands.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion vendor/github.com/conductorone/baton-sdk/pkg/field/defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading