Skip to content

Fix ignored errors in security-sensitive operations #75

Closed

Description

@David-Noble-at-work

Summary

Several locations in the codebase ignore errors from operations where failure matters. This is the same class of error as issue NobleFactor/noblefactor-engprod#317 (stub functions returning success) - the code continues as if everything succeeded when it didn't.

Pattern: Ignoring Errors That Matter

1. Identity loading errors ignored (Critical)

File: internal/writ/commands.go:409

identities, _ := identity.LoadIdentities()
return engineData, identities, nil

LoadIdentities() returns errors when:

  • AGE_IDENTITY env var points to corrupted/inaccessible file
  • No identities found anywhere

Impact: If decryption is needed later, operations fail with confusing errors instead of the clear "no age identities found" message.

Fix: Propagate the error or warn the user.


2. Config load errors ignored

File: internal/model/config.go:234, 328

cfg, _ := config.Load()
cfg.Model = modelCfg
config.Save(cfg)

Impact: If config load fails (permissions, corruption), the code overwrites with defaults, losing user settings.

Fix: Check error, warn user if load failed before overwriting.


3. npm command errors silently ignored

File: internal/starlark/npm.go:191, 237, 258

output, _ := cmd.Output()

Impact: If npm isn't installed or commands fail, functions return incorrect results (false negatives for package existence checks).

Fix: Return error or handle npm-not-found case explicitly.


Root Cause

Same as issue NobleFactor/noblefactor-engprod#317 pattern: prioritizing "keep going" over correctness. Errors are ignored to avoid disrupting flow, but this creates confusing downstream failures.

Acceptance Criteria

  • identity.LoadIdentities() errors are handled (propagate or warn)
  • config.Load() errors are checked before overwriting
  • npm command failures are handled appropriately
  • No _, _ := patterns on operations where failure matters

Related

Activity

  1. David-Noble-at-work commented on Mar 11, 2026

    @David-Noble-at-work
    ContributorAuthor

    Status Update (2026-03-10)

    Item 3 is obsolete

    internal/starlark/npm.go no longer exists in the codebase. The npm command error ignoring item can be removed from this issue.

    Remaining items

    1. identity.LoadIdentities() at internal/writ/commands.go:604 — error still ignored with //nolint:errcheck // fallback: continue without identities
    2. config.Load() at internal/model/config.go:234,328 — error still ignored with //nolint:errcheck // fallback: continue without value

    Both use intentional //nolint annotations justifying the suppression as fallback behavior. Whether these are acceptable or should propagate errors is a design decision.

  2. David-Noble-at-work commented on Mar 18, 2026

    @David-Noble-at-work
    ContributorAuthor

    Resolved — 117 unhandled error results fixed in commit 5e4315d across 28 files. iox.Close, errors.Join patterns adopted. Covered by compensation, archive, and recovery error path tests.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions