Maker API debug logging writes access token to hub logs in plaintext

With "Enable logging for debugging" turned on, the Maker API app writes its full API URL (including the access_token query parameter) in plaintext to the hub's Past Logs.

To try it:

  1. Enable "Enable logging for debugging".
  2. Trigger any Maker API activity.
  3. Open Logs > Past Logs: the "Testing URL is ..." debug line contains the full URL with access_token in plaintext.

Is this a security problem? When I noticed, I figured I'd rotate the token, but I don't have any reason to think my Logs have been compromised. I started wondering, what if my Logs get exposed unknowingly, bad guys get my token, and they use it to monitor my hub's activity through the Marker API? Probably won't happen, but could it be avoided by not putting the token in the Logs? I turned debugging off just in case...

Logs don't go anywhere besides the hub by default. If an attacker can get to your hub and read Past Logs to get the access token (or try in hopes that it might be there), they could just open the Maker API app itself and get it that way instead -- easier and guaranteed to be there (it's presented there since you need it to set things up, after all), which is not the case for Logs. :slight_smile: So, I'd say there is nothing specifically concerning about having this data in Logs.

I would say that if you are concerned about rogue actors to either use hub login security (so unauthorized people/devices on your LAN can't see either one of these places) or at least restrict Maker API access to just LAN or cloud as needed for your use case (won't really help with a compromise, but, for example, LAN-only access would make this information useless outside your home network).

I think the problem, at least for me, is pasting this into an AI chat for help and finding out that your tokens, API keys, and other similar info have just been shared to the whole world. I wonder if credentials could be walled off like they are in Node-RED.

So for logs to be useful for troubleshooting, they need to include pertinent information. Sometimes, that includes tokens. I think the issue you bring up is user error. You wouldn't paste your passswords into AI, and should also clean your own logs for anything that might be similar (including tokens, WAN IP, etc.) before pasting into a public area.

The problem isn't with the logs. The problem is users who don't know what they should/shouldn't post into AI. AI is a useful tool. But it doesn't prevent a user from doing dangerous things.

Perhaps the token info could be obfuscated, like when only the last 4 digits of a credit card number are displayed.

Those numbers are obfuscated on PUBLIC facing locations (Websites on WAN, banking Apps, Mail that goes through public transprtation to get to your mailbox). You logs aren't public, unless you make them so yourself.

If you look at the logs, the links from the buttons in the logs themselves have text (required to open the device/app from the log entry) that also have some information that could be dangerous. If you copy the lines and paste them into a text editor, you will readily see it.

The information provided is useful, and sometimes necessary to resolve issues. For instance, an issue I was having with getting the Ecowitt installation working and communicating with HE would not have been solved if it didn't post the actual MAC address of the device it was trying to connect to. There was a hidden MAC for the WIFI connection that was different from the MAC for the wired. The Factory app only displays the MAC of the wired.

That information is really needed in the logs for them to serve the purpose they were designed for. As a user, I made sure to mask the MAC's of the log entries before I posted them publicly in here when troubleshooting.

Gotcha. Thanks for the explanation.

Question about cleaning logs. What is the best way to handle that. I noticed there is "Purge Past logs on this hub on reboot" toggle at the time you do an upgrade. It doesn't specify on the page but I was guessing that meant that you first back up your hub (does the backup keep your old logs?), and then you upgrade and reboot, which clears all the past logs. Then you repeat at least at every upgrade?

I honestly don't know if the hub stores the logs in backups. That would be a question for @support_team. But, I do purge my logs on reboot on occaision. I tend to want to keep mine, especially after major changes, so that I can compare before/after information around events.

**** Edited to add - a quick search found the following, indicating that logs ARE NOT backed up as part of the database. They are separate and erased if you soft reset and restore.


@confirmed - I agree with @tray_e's assessment, and recommend you reconsider your strategy to routinely purge logs. @bertabcd1234's post summarizes the best practices in securing your hub. Deleting logs doesn't really add much if the hub isn't secured, and makes it difficult to debug issues that arise.

Exactly my point. But, people are people and they trust AI way more than they probably should.

Users deserve blame far less often than we assume. Expecting them to comb through dozens or hundreds of log lines to catch credentials isn’t pragmatic.

There’s almost always a design that takes the user out of the equation. Secrets have no business in logs; they should be redacted or masked. That they’re “sometimes” useful for troubleshooting isn’t a reason to include them, and when they are, logging them should take a deliberate choice by the user, not happen by accident.

While -- just to directly address the original question again -- I'd still assess this as not being an inherent "security problem," as the token is only accessible if you can get to Logs, and if you can get to Logs, you can already get to Maker API itself (where you can view or reset the actual access token), I'd also say the value of having the token in Logs in the first place is probably minimal. So, the next major platform release will hide all but the last few characters of the access token in Logs by default -- hopefully enough to verify it's likely the same token if this is at all useful for troubleshooting.

This, of course, does not change the fact that what you do with the token -- like blindly feeding to an AI agent -- is another issue that could happen no matter where it comes from. But maybe this will make doing that a bit harder. :slight_smile:

(Basically this kind of "security" concern if anyone else enjoys this blog as much as I do: It rather involved being on the other side of the airtight hatchway: Disabling a security feature as an administrator - The Old New Thing)

Thank you. Now I’m sad my old logs are gone, but we will make new memories.

That is a useful analogy. I appreciate the blog writer’s perspective. I also think you mentioned good reasons for why the token is logged and how it helps with troubleshooting.

I guess I was thinking of it in terms of layers of security. In normal use, the token sitting there isn’t a problem. Someone capable of extracting the logs is already in a position to do destructive things.

So the concern about a bad guy maybe anticipating my movements as they are trickled by an API is outweighed by the fact that, in the likely scenario, it means my full log is available, with a detailed history of what actually happened over a period of time.

For example (and this is just going down a rabbit trail), one of my logged automations has my kid’s name. Another logged hub variable, driven by my calendar, shows when it is a school day. Not stuff I’d love to be out there, but that’s on me for logging it. Cleaning up the log is more like reducing the downstream impact of a breach.

From that standpoint, it turns out that contemplating the sensitivity of the log has been an important exercise and some great points made here about ways to protect information.

I would disagree. I get financial statements from my bank and credit cards. Those statements are full of information that is much more dangerous than what is in Maker API. I would never ever paste unedited copies of financial statements into an AI. The same holds true for any other form of PII. The same is also true for logs.

Users have a responsibility of knowing enough about what they are doing before disclosing information publicly. Maybe HE documentation could do a better job of explaining what might or might not be too sensitive to post in public areas, including into open AI platforms.

It isn't pragmatic or feasible for HE to wrangle all the logging for all of the apps, many of which aren't even baked into HE as system apps. Doing so, even if possible as a practicality, would also limit troublshooting capabilities which are the main reason for logs in the first place. (Just as much so as if your bank decided to not report vendor names or transaction ID's in your statements in order to protect you from yourself).

TL;DR: thank you @bertabcd1234 for masking the token, that is exactly the kind of pragmatic solution needed across the hub.

I’ve spent a fair amount of time keeping an AI coding agent from leaking hub tokens to AI session logs. Written instructions never held up; only keeping the secrets out of its view did.

Keeping them out of logs is in fact not enough: agents end up leaking secrets into session logs from app state ! So my apps now encrypt secrets saved in app state, and in part because decryption is super expensive (especially on the previous-gen hubs) I save them to a @Field variable in memory - mostly to keep them out of the agent's reach.

Even so, with all those fences and tooling in place, just yesterday I stopped an agent who, after a routine request to push code to git, literally exclaimed:

I'll scan the files to make sure there aren't any credentials in them

Unfortunately, by the time I noticed it, it had already scanned the files, the result of which gets sent to the AI's session log. Fortunately, because I had put them out of its view, nothing was leaked (why this particular prompt made it past the auto-mode classifier is beyond me).

If explicit rules don’t reliably stop a tool built to follow them, “users should be careful” won’t either. Chen’s argument assumes whoever reads the logs could already open the app. With agents holding scoped tools, that’s no longer true. And for users posting debug logs to get help, the issue was never who can read the logs, but where they end up.

That’s the gap this request is meant to close: a platform-level authorization model so integrations, AI agents included, get exactly the access they need and no more. An upvote would be appreciated: Request: a platform-level authorization model for integrations

Your bank statement proves the point: the bank already masks your card and account numbers on it. The vendor names and transaction IDs stay because they’re useful and harmless. That’s exactly the split here: keep the useful context, mask the credential.

Nobody’s asking HE to police every community app, just to set the default in its own and offer a masking helper to developers. Glad to see it’s coming in the next release for MakerAPI.

[quote="hubitrep, post:18, topic:166982"]
Your bank statement proves the point: the bank already masks your card and account numbers on it.[/quote]

First, the bank only masks your account ID at the top level..... just like hubitat does on the main details page if you click hide. Second, the bank ID is only masked on PUBLIC facing interfaces... the WWW, the mailed statements (sometimes), where outside actors have access.

Pasting logs into an AI for troubleshooting is also VERY different than giving AI access directly to accounts (something I would not do at this point in any event).

There was an interesting article that popped up less than 5 minutes after I posted my earlier comment. People are giving AI their banking credentials and now banks are worried about AI performing transactions without user intervention.

If you don't give AI agents access to your stuff, then the masking is not needed on your local account anymore than it needs to be masked on your physical card. I am sorry, I just don't feel that the loss of useful information in the logs is needed to prevent users from being able to do things that they really should not have been doing in the first place.

This is a 100% false impression. Transaction ID's and vendor names can hold VERY personal information. Records of spending habits, doctor visits, hotel stays, etc. Not really any different than getting into a hub and seeing which lights were on or off, or when you were home.

It's not useful information. The masked secret is just as useful for troubleshooting purposes. An unmasked secret adds nothing.

You're making a category error.

Sorry, but this argument with you is going nowhere, the main point has been made, I'll stop here.

I already gave an actual example of where that type of information was actually essential in a troubleshooting event

No, I am not.

I was about to say the same. I feel that people should not do things they are not 100% sure is safe and not rely on systems to protect them from themselves. It is not a reasonable expectation. It is just a core belief of mine.