Skip to content

Commit

Permalink
Opcreds: Check for invalid admin subject (#30826)
Browse files Browse the repository at this point in the history
Moving this check to before the fabric gets added so that the
changes do not have to be backed out if this is invalid.

see #30799

This will be checked in TC-OPCREDS-3.1 (under development)
  • Loading branch information
cecille authored and pull[bot] committed Jan 19, 2024
1 parent 4d9eb63 commit 1483962
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,10 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co
// missing root. Let's early-bail with InvalidNOC.
VerifyOrExit(failSafeContext.AddTrustedRootCertHasBeenInvoked(), nocResponse = NodeOperationalCertStatusEnum::kInvalidNOC);

// Check this explicitly before adding the fabric so we don't need to back out changes if this is an error.
VerifyOrExit(IsOperationalNodeId(commandData.caseAdminSubject) || IsCASEAuthTag(commandData.caseAdminSubject),
nocResponse = NodeOperationalCertStatusEnum::kInvalidAdminSubject);

err = fabricTable.AddNewPendingFabricWithOperationalKeystore(NOCValue, ICACValue.ValueOr(ByteSpan{}), adminVendorId,
&newFabricIndex);
VerifyOrExit(err == CHIP_NO_ERROR, nocResponse = ConvertToNOCResponseStatus(err));
Expand Down

0 comments on commit 1483962

Please sign in to comment.