Feature request: Leave off computer name when issuing an Alexa command
-
@Russ, The most obvious way to prevent it form stressing your server is a throttle system. Simplest is to refuse to run too many commands in a row without a delay between them. That wouldn't solve the problem of an infinite loop mistake, though, and preventing those seems far more tricky to me. I can imagine this might frustrate people who want to "chain" triggers, but that's not really the right way to do it; they should be writing a shell, batch, or whatever script that does everything on a single trigger.
Allowing parameters is something I think you should avoid, since it's too likely to create security holes even if you try to sanitize input. You definitely need to strip out shell meta-characters such as $, *, ?, {}, (), [], quotes, and so on, especially since some shells like Bash and zsh have some mind-boggling extra expansion capabilities.
If you really want to do it, I suggest forcing the user to explicitly specify allowed parameters in the json config file:
{"trigger":"Foo","command":"foo","ground":"foreground","parameters":["bar","baz","qux","etc"]},
So triggering "foo" is only allowed to have some combination of "bar", "baz", "qux", and "etc" passed to it. It wouldn't stop the user from shooting themselves in the foot if they were determined to, but it'd make it harder, and shift the responsibility to them.
-
@Christian-Robinson, this is more good input.
I didn't even think of that use-case of chaining commands. That could be useful, especially when you want the next command in the chain to run on a different computer.
My original idea was to avoid parameters because of the potential security risk. Your idea of limiting the options for those parameters makes sense, but I figure if you want to be able to run foo bar and foo baz, you could make two commands. I'll probably keep it simple and nix the parameter idea.
Thanks again.
-
@Christian-Robinson, I added the default computer field in your Profile page. As soon as Amazon approves my update to the Alexa skill, you'll be able to use it like this:
"Alexa, tell TRIGGERcmd run Calculator"
or:
"Alexa, open TRIGGERcmd"
"run Calculator"It will run the command with voice word "calculator" on your default computer.
Thanks again for the suggestion.
-
Amazon approved the skill update.
-
@Russ Unfortunately it's not working. I can still do "Alexa, tell TRIGGER c m d [command] on Windows," and it works fine, but if I leave the "on Windows" part off Alexa always says "Could not find a trigger called undefined on [...]"
Edit: Perhaps it has something to do with the fact that I have a different name and voice trigger name for my Windows machine? For Alexa I just call it "Windows" but in my profile it's called "Arrietty". I had to set the default name in my profile to "Arrietty" or Alexa would tell me it could not find the device.
-
Yes, that's it. You have to give it the computer name, not your voice trigger name.
I think other people will do the same, so I'll try to make that clearer in the interface.
Although it said your trigger is undefined, so I'm still confused.
-
@Russ Unfortunately it just doesn't work either way. Giving it the voice name gives an overall error (can't find the device, or something like that), but giving it the computer name always gives the "Could not find a trigger called undefined on Arrietty" error.
-
I have a theory. You have two of the same command. I think you got those when the agent still had that bug. Can you rename that command in your commands.json and see if the problem goes away?
-
@Russ Unfortunately I still get the "undefined" response. Also, duplicates still appear on me occasionally--when I notice it I use the rename trick to clear them, but didn't see that one.
-
Ok. I appreciate your patience. I'll try to reproduce these two problems. I thought I fixed the duplicate commands problem in v1.0.5 of the Windows agent.
Are you saying the word, "run" before your trigger's voice word?
-
I reproduced it!
I said, Alexa, tell trigger c m d, Calculator.
Alexa said, cannot find a trigger called "undefined" on RussFam.
Sweet. I can fix this.
-
@Russ No, I wasn't saying "run," but when I do it works.
-
Awesome. Thanks for showing me another bug. I'll do an update to the Alexa skill to allow a single word to represent the trigger's voice word to run on your default computer.
-
@Russ No problem. I'm happy to help, especially since this is such a cool skill. Thank you for your efforts.
-
@Christian-Robinson Amazon approved my update to the skill, so now you can say, "Alexa, tell trigger c m d, Calculator."
-
@russ
Is this feature "default computer" made available for all the users now ? How can I enable/get it for my profile .. please advise .. -
@venkat-karthik, you just do this:
- Take a note of your computer name in you list of computers.
- Click your name in the upper right corner of the web interface while logged in.
- Write or paste the computer name (not its voice word) in the default computer field.
Then you can leave the computer name off when you tell Alexa to run your command.
-
@russ
Got it. Looks like you already set that up for me .. as I could see my laptop on the default computer field .. and it is working ! Thank you!P.S: Is there a location on this forum or site for "How-to's" / Knowledge base - for people to find such information there .. if yes, please direct me to the same, if not, might be a good idea to create one