Skip to content

feat(node-red): add valet/guest/speed-limit commands with PIN/password redaction - #97

Merged
Bre77 merged 1 commit into
mainfrom
fm/nred-t2-valet-security
Aug 6, 2026
Merged

feat(node-red): add valet/guest/speed-limit commands with PIN/password redaction#97
Bre77 merged 1 commit into
mainfrom
fm/nred-t2-valet-security

Conversation

@Bre77

@Bre77 Bre77 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Intent

  • Add the remaining tier-2 vehicle safety/security commands to teslemetry-vehicle-command - Guest Mode, Valet Mode, PIN to Drive, and Speed Limit Mode. The @teslemetry/api SDK already exposes all of these (setGuestMode, setValetMode, resetValetPin, setPinToDrive, clearPinToDriveAdmin, resetPinToDrive, clearPinToDrive, speedLimitActivate/Deactivate/ClearPin/ClearPinAdmin/SetLimit); this just wires them into the node's existing switch-case, following its on/off command-splitting pattern (mirrors setSentryModeOn/setSentryModeOff etc).
    • Password/PIN-taking commands (setValetModeOn/Off, setPinToDriveOn/Off, clearPinToDrive, speedLimitActivate/Deactivate/ClearPin) validate msg.password/msg.pin as required strings via validateParameters.
    • Admin-level recovery commands (resetValetPin, clearPinToDriveAdmin, resetPinToDrive, speedLimitClearPinAdmin) take no PIN/password - they're already-authenticated overrides for a lost credential.
  • Add a sensitive flag to ValidationRule (src/validation.ts). When a validation failure occurs on a sensitive field, the thrown error redacts the actual value as [redacted] instead of echoing it, so a bad PIN/password never ends up in the node's status text or node.error output (debug sidebar / Node-RED log).
  • Document the safety behavior of each mode (what it restricts, how to recover a lost PIN) and the redaction guarantee in the node's help text and README.
  • Add a test/ suite (tsx --test, matching the other four packages' convention) covering the redaction behavior, since node-red-contrib-teslemetry had none yet.

…d redaction

Wraps the already-existing setValetMode/setPinToDrive/speedLimit*/setGuestMode
SDK methods in the vehicle-command node's switch-case, following its existing
on/off command-splitting pattern. Adds a `sensitive` flag to validateParameters
so a bad PIN or password is never echoed into the node's error/status text -
only "[redacted]" is, keeping it out of the debug sidebar and Node-RED log.

Also adds a tsx --test suite for node-red-contrib-teslemetry, bringing it in
line with the rest of the monorepo's test convention.
@Bre77 Bre77 added the fm Opened by a Firstmate crewmate label Aug 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74f9f03ffd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +320 to +323
validateParameters(msg, {
password: { required: true, type: "string", sensitive: true },
});
result = await vehicle.setValetMode(true, msg.password);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Strip sensitive fields before forwarding messages

When any newly added password/PIN command succeeds, the handler later forwards the original object with send(msg), leaving msg.password or msg.pin intact; a downstream Debug node configured for the complete message will therefore expose the secret despite the documented redaction guarantee. Validation failures likewise pass the unchanged message to node.error(..., msg), making the secret available to Catch flows. Remove these fields before either success or error forwarding rather than only redacting the validation error string.

Useful? React with 👍 / 👎.

@Bre77
Bre77 merged commit d32d9e5 into main Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fm Opened by a Firstmate crewmate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant