Commit Graph
2 Commits
  • fix(nodes): say which half of node mTLS failed, and say it as an error (#6565)
    * fix(nodes): say which half of node mTLS failed, and say it as an error
    
    A configured client CA bundle that will not parse produced the same
    warning as a settings read that failed, and both read as though mTLS
    were merely unavailable. It is not: the node API silently stops
    accepting client certificates, callers fall back to a bearer token or
    lose their only credential, and the one line saying so is a warning at
    boot.
    
    Report it at error level, and distinguish the two causes rather than
    attributing a storage fault to the operator's certificate bundle.
    NodeMtlsClientCAPool now tags the parse failure with
    ErrNodeMtlsTrustBundleInvalid; its message text is unchanged, so
    anything matching on the existing string still matches.
    
    Startup is deliberately left alone. Refusing to boot was considered and
    rejected: the bundle is one of two equal credentials here, a panel that
    will not start takes the proxies and the subscription server with it,
    and bundles written before the stricter validation landed in #6188 are
    already stored, editable only through the panel that would no longer
    come up.
    
    The tests pin the tag on an unusable bundle and its absence on an unset
    one; without the tag the first goes red.
    
    * test(nodes): drop a duplicate node mTLS trust-bundle test
    
    TestNodeMtlsClientCAPoolLeavesUnsetBundleUntagged asserted only that an
    unset nodeMtlsClientCAPem yields (nil, nil). That path returns before the
    line the sentinel change touched, so the test was green with and without
    ErrNodeMtlsTrustBundleInvalid, and TestNodeMtlsClientCAPool already pins
    the same two assertions on the same fixture. A test that passes either way
    certifies nothing and then gets cited as coverage for the sentinel.
    
    TestNodeMtlsClientCAPoolTagsAnInvalidBundle, which does go red without the
    sentinel, stays as the regression guard.
    
    ---------
    
    Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
  • fix(nodes): validate every certificate in the node mTLS trust bundle (#6188)
    * fix(nodes): validate every certificate in the node mTLS trust bundle
    
    AppendCertsFromPEM reports success once a single certificate parses, so a
    trust bundle whose later entries are damaged or truncated was accepted with
    those entries silently absent from the pool. Parse and validate every PEM
    block instead, and reject the bundle if any of them is malformed.
    
    * fix(mtls): reject malformed certificate bundle layout
    
    ---------
    
    Co-authored-by: n0ctal <293235942+n0ctal@users.noreply.github.com>