-
Notifications
You must be signed in to change notification settings - Fork 1
fix(FLEETMDM-002): CU-86akbhhtv 19 review findings across 14 files #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c49ecb2
98ff9b2
1b63c62
0b58af9
717db9e
e589596
91de54d
63833dc
a04dab6
9c3ef02
3c724be
fe613f3
b0d3217
b02283c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ func (svc *Service) CalendarWebhook(ctx context.Context, eventUUID string, chann | |
| appConfig, err := svc.ds.AppConfig(ctx) | ||
| if err != nil { | ||
| svc.authz.SkipAuthorization(ctx) | ||
| return fmt.Errorf("load app config: %w", err) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ Plain fmt.Errorf used instead of ctxerr in server-layer calendar service In π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| return ctxerr.Wrap(ctx, err, "load app config") | ||
| } | ||
|
|
||
| if len(appConfig.Integrations.GoogleCalendar) == 0 { | ||
|
|
@@ -88,7 +88,7 @@ func (svc *Service) CalendarWebhook(ctx context.Context, eventUUID string, chann | |
| if eventDetails.TeamID == nil { | ||
| // Should not happen | ||
| svc.authz.SkipAuthorization(ctx) | ||
| return fmt.Errorf("calendar event %s has no fleet ID", eventUUID) | ||
| return ctxerr.New(ctx, fmt.Sprintf("calendar event %s has no fleet ID", eventUUID)) | ||
| } | ||
|
|
||
| localConfig := &calendar.Config{ | ||
|
|
@@ -227,7 +227,7 @@ func (svc *Service) processCalendarEvent(ctx context.Context, eventDetails *flee | |
| return "", false, nil | ||
| } | ||
| if host.Email == "" { | ||
| err = fmt.Errorf("host %d has no associated email", host.HostID) | ||
| err = ctxerr.New(ctx, fmt.Sprintf("host %d has no associated email", host.HostID)) | ||
| return "", false, err | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,24 +2,24 @@ package hostidentity | |
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/fleetdm/fleet/v4/pkg/certificate" | ||
| "github.com/fleetdm/fleet/v4/server/contexts/ctxerr" | ||
| "github.com/fleetdm/fleet/v4/server/fleet" | ||
| "github.com/fleetdm/fleet/v4/server/mdm/scep/depot" | ||
| ) | ||
|
|
||
| func initAssets(ds fleet.Datastore) error { | ||
| func initAssets(ctx context.Context, ds fleet.Datastore) error { | ||
| // Check if we have existing certs and keys | ||
| expectedAssets := []fleet.MDMAssetName{ | ||
| fleet.MDMAssetHostIdentityCACert, | ||
| fleet.MDMAssetHostIdentityCAKey, | ||
| } | ||
| savedAssets, err := ds.GetAllMDMConfigAssetsByName(context.Background(), expectedAssets, nil) | ||
| savedAssets, err := ds.GetAllMDMConfigAssetsByName(ctx, expectedAssets, nil) | ||
| if err != nil { | ||
| // allow not found errors as it means we're generating the assets for the first time. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ ee/server package uses fmt.Errorf instead of ctxerr for error creation/wrapping In π€ Prompt for AI agentsfix confidence: π‘ 60 medium β react π/π to teach the reviewer |
||
| if !fleet.IsNotFound(err) { | ||
| return fmt.Errorf("loading existing host identity assets from the database: %w", err) | ||
| return ctxerr.Wrap(ctx, err, "loading existing host identity assets from the database") | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -34,7 +34,7 @@ func initAssets(ds fleet.Datastore) error { | |
| ) | ||
| scepCert, scepKey, err := depot.NewCACertKey(caCert) | ||
| if err != nil { | ||
| return fmt.Errorf("generating host identity SCEP cert and key: %w", err) | ||
| return ctxerr.Wrap(ctx, err, "generating host identity SCEP cert and key") | ||
| } | ||
|
|
||
| // Store our config assets encrypted | ||
|
Comment on lines
34
to
40
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ ee/server package uses fmt.Errorf instead of ctxerr for SCEP cert generation error In π€ Prompt for AI agentsfix confidence: π‘ 65 medium β react π/π to teach the reviewer
Comment on lines
34
to
40
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ ee/server package uses fmt.Errorf instead of ctxerr for asset insert error In π€ Prompt for AI agentsfix confidence: π‘ 65 medium β react π/π to teach the reviewer |
||
|
|
@@ -49,8 +49,8 @@ func initAssets(ds fleet.Datastore) error { | |
| }) | ||
| } | ||
|
|
||
| if err := ds.InsertMDMConfigAssets(context.Background(), assets, nil); err != nil { | ||
| return fmt.Errorf("inserting host identity SCEP assets: %w", err) | ||
| if err := ds.InsertMDMConfigAssets(ctx, assets, nil); err != nil { | ||
| return ctxerr.Wrap(ctx, err, "inserting host identity SCEP assets") | ||
| } | ||
| } | ||
| return nil | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,6 @@ import ( | |
| "crypto/ecdsa" | ||
| "crypto/rsa" | ||
| "crypto/x509" | ||
| "errors" | ||
| "fmt" | ||
| "log/slog" | ||
| "math/big" | ||
| "time" | ||
|
|
@@ -52,12 +50,12 @@ func NewHostIdentitySCEPDepot(db *sqlx.DB, ds fleet.Datastore, logger *slog.Logg | |
| func (d *HostIdentitySCEPDepot) CA(_ []byte) ([]*x509.Certificate, *rsa.PrivateKey, error) { | ||
| cert, err := assets.KeyPair(context.Background(), d.ds, fleet.MDMAssetHostIdentityCACert, fleet.MDMAssetHostIdentityCAKey) | ||
| if err != nil { | ||
| return nil, nil, fmt.Errorf("getting assets: %w", err) | ||
| return nil, nil, ctxerr.Wrap(context.Background(), err, "getting assets") | ||
| } | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π hostidentity/depot/depot.go uses fmt.Errorf and errors.New instead of ctxerr in server-layer package In CA() (ee/server/service/hostidentity/depot/depot.go), replaced π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
||
| pk, ok := cert.PrivateKey.(*rsa.PrivateKey) | ||
| if !ok { | ||
| return nil, nil, errors.New("private key not in RSA format") | ||
| return nil, nil, ctxerr.New(context.Background(), "private key not in RSA format") | ||
| } | ||
|
|
||
| return []*x509.Certificate{cert.Leaf}, pk, nil | ||
|
|
@@ -86,10 +84,10 @@ func (d *HostIdentitySCEPDepot) HasCN(cn string, allowTime int, cert *x509.Certi | |
| // Put stores a certificate under the given name. | ||
| func (d *HostIdentitySCEPDepot) Put(name string, crt *x509.Certificate) error { | ||
| if crt.Subject.CommonName == "" || len(crt.Subject.CommonName) > maxCommonNameLength { | ||
| return errors.New("common name empty or too long") | ||
| return ctxerr.New(context.Background(), "common name empty or too long") | ||
| } | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Put() in depot.go returns errors.New/fmt.Errorf instead of ctxerr in server-layer code In Put() (ee/server/service/hostidentity/depot/depot.go), replaced all π€ Prompt for AI agentsfix confidence: π‘ 80 medium β react π/π to teach the reviewer |
||
| if !crt.SerialNumber.IsInt64() { | ||
| return errors.New("cannot represent serial number as int64") | ||
| return ctxerr.New(context.Background(), "cannot represent serial number as int64") | ||
| } | ||
|
|
||
| // Extract the ECC uncompressed point (04-prefixed X || Y); 0x04 means this is the raw representation | ||
|
|
@@ -98,11 +96,11 @@ func (d *HostIdentitySCEPDepot) Put(name string, crt *x509.Certificate) error { | |
| // - P-384: 97 bytes | ||
| key, ok := crt.PublicKey.(*ecdsa.PublicKey) | ||
| if !ok { | ||
| return errors.New("public key not in ECDSA format") | ||
| return ctxerr.New(context.Background(), "public key not in ECDSA format") | ||
| } | ||
| pubKeyRaw, err := types.CreateECDSAPublicKeyRaw(key) | ||
| if err != nil { | ||
| return fmt.Errorf("creating public key raw: %w", err) | ||
| return ctxerr.Wrap(context.Background(), err, "creating public key raw") | ||
| } | ||
| certPEM := certificate.EncodeCertPEM(crt) | ||
|
|
||
|
|
@@ -112,7 +110,7 @@ func (d *HostIdentitySCEPDepot) Put(name string, crt *x509.Certificate) error { | |
| existingCert, err := d.ds.GetHostIdentityCertByName(context.Background(), name) | ||
| switch { | ||
| case err != nil && !fleet.IsNotFound(err): | ||
| return fmt.Errorf("checking existing certificate: %w", err) | ||
| return ctxerr.Wrap(context.Background(), err, "checking existing certificate") | ||
| case err == nil: | ||
| // Certificate exists, check if rate limit applies | ||
| if time.Since(existingCert.CreatedAt) < cooldown { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ import ( | |
| "fmt" | ||
| "io" | ||
| "time" | ||
|
|
||
| "github.com/fleetdm/fleet/v4/server/contexts/ctxerr" | ||
| ) | ||
|
|
||
| // commonFailingStore is an implementation of CommonStore | ||
|
|
@@ -15,21 +17,22 @@ type commonFailingStore struct { | |
| } | ||
|
|
||
| func (c commonFailingStore) Get(ctx context.Context, iconID string) (io.ReadCloser, int64, error) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ commonFailingStore uses fmt.Errorf instead of ctxerr in server/ package Replaced all four fmt.Errorf calls with ctxerr.New(ctx, fmt.Sprintf(...)) in Get, Put, Exists, and Sign methods of commonFailingStore in server/datastore/failing/common_store.go; added the ctxerr import; changed Sign's unused ctx parameter name from π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
| return nil, 0, fmt.Errorf("%s store not properly configured", c.Entity) | ||
| return nil, 0, ctxerr.New(ctx, fmt.Sprintf("%s store not properly configured", c.Entity)) | ||
| } | ||
|
|
||
| func (c commonFailingStore) Put(ctx context.Context, iconID string, content io.ReadSeeker) error { | ||
| return fmt.Errorf("%s store not properly configured", c.Entity) | ||
| return ctxerr.New(ctx, fmt.Sprintf("%s store not properly configured", c.Entity)) | ||
| } | ||
|
|
||
| func (c commonFailingStore) Exists(ctx context.Context, iconID string) (bool, error) { | ||
| return false, fmt.Errorf("%s store not properly configured", c.Entity) | ||
| return false, ctxerr.New(ctx, fmt.Sprintf("%s store not properly configured", c.Entity)) | ||
| } | ||
|
|
||
| func (c commonFailingStore) Cleanup(ctx context.Context, usedIconIDs []string, removeCreatedBefore time.Time) (int, error) { | ||
| return 0, nil | ||
| } | ||
|
|
||
| func (c commonFailingStore) Sign(_ context.Context, _ string, _ time.Duration) (string, error) { | ||
| return "", fmt.Errorf("%s store not properly configured", c.Entity) | ||
| func (c commonFailingStore) Sign(ctx context.Context, _ string, _ time.Duration) (string, error) { | ||
| return "", ctxerr.New(ctx, fmt.Sprintf("%s store not properly configured", c.Entity)) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ func (ds *AndroidDatastore) GetEnterprise(ctx context.Context) (*android.Enterpr | |
|
|
||
| func (ds *AndroidDatastore) UpdateEnterprise(ctx context.Context, enterprise *android.EnterpriseDetails) error { | ||
| if enterprise == nil || enterprise.ID == 0 { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ errors.New used instead of ctxerr.New in server/datastore/mysql package Replaced π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| return errors.New("missing enterprise ID") | ||
| return ctxerr.New(ctx, "missing enterprise ID") | ||
| } | ||
| stmt := `UPDATE android_enterprises | ||
| SET signup_name = ?, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -372,12 +372,12 @@ func (ds *Datastore) UpsertCertificateStatus(ctx context.Context, update *fleet. | |
| WHERE host_uuid = :host_uuid AND certificate_template_id = :certificate_template_id` | ||
| result, err := sqlx.NamedExecContext(ctx, ds.writer(ctx), updateStmt, update) | ||
| if err != nil { | ||
| return err | ||
| return ctxerr.Wrap(ctx, err, "update host certificate template status") | ||
| } | ||
|
|
||
| rowsAffected, err := result.RowsAffected() | ||
| if err != nil { | ||
| return err | ||
| return ctxerr.Wrap(ctx, err, "get rows affected for host certificate template status update") | ||
| } | ||
|
|
||
| // If no records were updated, then insert a new status. | ||
|
Comment on lines
372
to
383
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π fmt.Errorf used instead of ctxerr in UpsertCertificateStatus In (Automatically downgraded: no change in this fix lands near this finding's line β verify whether it was actually addressed.) π€ Prompt for AI agentsfix confidence: π΄ 40 low β review closely β react π/π to teach the reviewer |
||
|
|
@@ -837,3 +837,4 @@ func (ds *Datastore) GetOrCreateFleetChallengeForCertificateTemplate( | |
| } | ||
| return challenge, nil | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import ( | |
| "fmt" | ||
|
|
||
| "github.com/fleetdm/fleet/v4/ee/pkg/hostidentity/types" | ||
| "github.com/fleetdm/fleet/v4/server/contexts/ctxerr" | ||
| common_mysql "github.com/fleetdm/fleet/v4/server/platform/mysql" | ||
| "github.com/jmoiron/sqlx" | ||
| ) | ||
|
|
@@ -93,11 +94,11 @@ func (ds *Datastore) GetMDMSCEPCertBySerial(ctx context.Context, serialNumber ui | |
| // The hash is calculated from cert.Raw (DER-encoded bytes), not the PEM string | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π fmt.Errorf used instead of ctxerr in host_identity_scep.go server package In π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| block, _ := pem.Decode([]byte(certPEM)) | ||
| if block == nil { | ||
| return "", errors.New("failed to decode PEM certificate") | ||
| return "", ctxerr.New(ctx, "failed to decode PEM certificate") | ||
| } | ||
| cert, err := x509.ParseCertificate(block.Bytes) | ||
| if err != nil { | ||
| return "", fmt.Errorf("failed to parse certificate: %w", err) | ||
| return "", ctxerr.Wrap(ctx, err, "parse certificate") | ||
| } | ||
| hashed := sha256.Sum256(cert.Raw) | ||
| hash := hex.EncodeToString(hashed[:]) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ func (ds *Datastore) GetChallengeByID(ctx context.Context, accountID, challengeI | |
| // UpdateChallenge handles updating the challenge status, and the authorization status as well as moving the order status. | ||
| func (ds *Datastore) UpdateChallenge(ctx context.Context, challenge *types.Challenge) (*types.Challenge, error) { | ||
| if challenge == nil { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π errors.New used instead of ctxerr in challenge.go server package In UpdateChallenge (server/mdm/acme/internal/mysql/challenge.go), replaced π€ Prompt for AI agentsfix confidence: π’ 92 high β react π/π to teach the reviewer
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Bare 'Challenge can not be nil for update' error not wrapped with call-context The same change (ctxerr.New with context) in UpdateChallenge addresses the lack of call-context wrapping: ctxerr.New attaches the context so the error is attributable via ctxerr.Handle like the other wrapped errors in this function, satisfying FLEETMDM-002-2's requirement without needing a separate fmt.Errorf wrap since ctxerr.New already provides equivalent stack/context capture. π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
| return nil, errors.New("Challenge can not be nil for update") | ||
| return nil, ctxerr.New(ctx, "challenge can not be nil for update") | ||
| } | ||
|
|
||
| err := platform_mysql.WithRetryTxx(ctx, ds.writer(ctx), func(tx sqlx.ExtContext) error { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,7 +130,7 @@ func (t *HostLifecycle) doWithUUIDValidation(ctx context.Context, action uuidFn, | |
|
|
||
| users, acts, err := action(ctx, opts.UUID) | ||
| if err != nil { | ||
| return err | ||
| return ctxerr.Wrap(ctx, err, "execute uuid action") | ||
| } | ||
| return t.createActivities(ctx, users, acts) | ||
| } | ||
|
Comment on lines
130
to
136
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π lifecycle.go: raw error returned without ctxerr wrapping in doWithUUIDValidation In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ package service | |
| import ( | ||
| "context" | ||
| "encoding/pem" | ||
| "fmt" | ||
| "log/slog" | ||
|
|
||
| "github.com/fleetdm/fleet/v4/server/contexts/ctxerr" | ||
|
|
@@ -36,7 +35,7 @@ func ReconcileAppleProfilesBatched( | |
| ) (err error) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ fmt.Errorf used instead of ctxerr in server/service package for config-read failure In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| appConfig, err := ds.AppConfig(ctx) | ||
| if err != nil { | ||
| return fmt.Errorf("reading app config: %w", err) | ||
| return ctxerr.Wrap(ctx, err, "reading app config") | ||
| } | ||
| if !appConfig.MDM.EnabledAndConfigured { | ||
| return nil | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ package macoffice | |
| import ( | ||
| "context" | ||
| "encoding/json" | ||
| "errors" | ||
| "fmt" | ||
| "os" | ||
| "path/filepath" | ||
|
|
@@ -155,7 +154,7 @@ func Analyze( | |
| } | ||
| } | ||
| if !hasValid { | ||
| return nil, errors.New("MacOffice release notes contain no valid security updates (possible corrupted feed)") | ||
| return nil, ctxerr.New(ctx, "MacOffice release notes contain no valid security updates (possible corrupted feed)") | ||
| } | ||
|
|
||
| queryParams := fleet.SoftwareIterQueryOptions{IncludedSources: []string{"apps"}} | ||
|
Comment on lines
154
to
160
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ Plain errors.New used for server-layer error instead of ctxerr.New In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ package msrc | |
|
|
||
| import ( | ||
| "context" | ||
| "errors" | ||
| "fmt" | ||
| "log/slog" | ||
| "strconv" | ||
|
|
@@ -34,12 +33,14 @@ func Analyze( | |
| return nil, err | ||
| } | ||
|
|
||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ New guard clause in upstream fleetdm/fleet file lacks OPENFRAME sentinel comments Wrapped the empty-bulletin guard clause in π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
| // >>> OPENFRAME(msrc-empty-bulletin-guard): reject corrupted empty MSRC feeds instead of remediating all vulns β openframe/docs/msrc-guard.md | ||
| // Refuse to proceed if the loaded bulletin contains no vulnerability data β an empty | ||
| // bulletin would cause every existing MSRC OS vulnerability for this OS to be marked as | ||
| // remediated. This usually indicates the bulletin file was corrupted during download. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ errors.New used instead of ctxerr.New in server-layer MSRC analyzer In π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| if len(bulletin.Vulnerabilities) == 0 { | ||
| return nil, errors.New("MSRC bulletin contains no vulnerabilities (possible corrupted feed)") | ||
| return nil, ctxerr.New(ctx, "MSRC bulletin contains no vulnerabilities (possible corrupted feed)") | ||
| } | ||
| // <<< OPENFRAME(msrc-empty-bulletin-guard) | ||
|
|
||
| // Find matching products inside the bulletin | ||
| matchingPIDs := make(map[string]bool) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ import ( | |
| "bytes" | ||
| "context" | ||
| "encoding/json" | ||
| "errors" | ||
| "fmt" | ||
| "log/slog" | ||
| "sort" | ||
|
|
@@ -267,7 +266,7 @@ func (z *Zendesk) Run(ctx context.Context, argsJSON json.RawMessage) error { | |
| func (z *Zendesk) runVuln(ctx context.Context, cli ZendeskClient, args zendeskArgs) error { | ||
| vargs := args.Vulnerability | ||
| if vargs == nil { | ||
| return errors.New("invalid job args") | ||
| return ctxerr.New(ctx, "invalid job args") | ||
| } | ||
|
|
||
| var hosts []fleet.HostVulnerabilitySummary | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π runVuln returns a plain errors.New instead of ctxerr.New for a server-layer validation error In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π΄ ee/server/service/apple_mdm.go uses fmt.Errorf instead of ctxerr.Wrap for a server-layer error
In
GetMDMAppleAccountEnrollmentProfile, replacedfmt.Errorf("loading SCEP challenge from the database: %w", err)withctxerr.Wrap(ctx, err, "loading SCEP challenge from the database"), matching the surrounding error-handling pattern in the same function. Thefmtimport remains used elsewhere in the file (GetMDMAccountDrivenEnrollmentSSOURL).π€ Prompt for AI agents
fix confidence: π’ 95 high β react π/π to teach the reviewer