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 22, 2024
1 parent 90214d8 commit 1702676
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 1702676

Please sign in to comment.