-
-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arduino_secrets.h
not added to Cloud sketches that contain secrets not defined via the web interface
#443
Comments
Addendum: we read secrets from the sketch json file and we create the I need to confirm this, but this might require a change on the arduino cloud api so that the "secrets" section in the json is always populated even if secrets are defined but have no assigned value |
arduino_secrets.h
to Cloud sketches that contain secrets not defined via the web interfacearduino_secrets.h
not added to Cloud sketches that contain secrets not defined via the web interface
From the browser's network tab, I can see that the request and response are correct when I leave the secret value empty and the auto-save does the update: Request:
Request payload: {
"id": "8f7a44c7-98bf-4084-9ad7-5a100cf07ecb",
"secrets": {
"data": [
{
"name": "SECRET_PASSWORD",
"value": ""
}
]
},
"libraries": []
} Response: {
"board_fqbn": "",
"board_name": "",
"board_type": "",
"created_at": "2023-02-14T12:35:08.436905Z",
"href": "/create/v2/files/d/8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/copy_to_cloud",
"id": "8f7a44c7-98bf-4084-9ad7-5a100cf07ecb",
"is_public": false,
"libraries": [],
"modified_at": "2023-02-14T14:13:47.678774Z",
"name": "copy_to_cloud",
"path": "8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/copy_to_cloud",
"secrets": [
{
"name": "SECRET_PASSWORD",
"value": ""
}
],
"tutorials": null,
"types": null,
"user_id": "b036b0a3-ef0e-44b1-af37-3c756f20fdf0"
} The problem must be with the GET part. |
I looked into the server code and did not find anything suspicious. I started the investigation from scratch using https://create.arduino.cc/editor and not Prerequisite:
Steps:
Request payload: {"id":"105c241b-30b6-4908-84ae-9b9931e24072","libraries":[]} This is the bug 👆 The editor does not send the Response: {
"board_fqbn": "arduino:avr:uno",
"board_name": "Arduino Uno",
"board_type": "serial",
"created_at": "2023-02-14T15:46:02.770568Z",
"href": "/create/v2/files/d/8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/sketch_feb14a",
"id": "105c241b-30b6-4908-84ae-9b9931e24072",
"is_public": false,
"libraries": [],
"modified_at": "2023-02-14T15:46:30.007601Z",
"name": "sketch_feb14a",
"path": "8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/sketch_feb14a",
"tutorials": null,
"types": null,
"user_id": "b036b0a3-ef0e-44b1-af37-3c756f20fdf0"
} The response is incorrect because the client did not send the
Request payload: {"id":"105c241b-30b6-4908-84ae-9b9931e24072","secrets":{"data":[{"name":"SECRET_PASSWORD","value":"x"}]},"libraries":[]} Here the request payload is correct. Response: {
"board_fqbn": "arduino:avr:uno",
"board_name": "Arduino Uno",
"board_type": "serial",
"created_at": "2023-02-14T15:46:02.770568Z",
"href": "/create/v2/files/d/8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/sketch_feb14a",
"id": "105c241b-30b6-4908-84ae-9b9931e24072",
"is_public": false,
"libraries": [],
"modified_at": "2023-02-14T15:49:02.276733Z",
"name": "sketch_feb14a",
"path": "8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/sketch_feb14a",
"secrets": [
{
"name": "SECRET_PASSWORD",
"value": "x"
}
],
"tutorials": null,
"types": null,
"user_id": "b036b0a3-ef0e-44b1-af37-3c756f20fdf0"
}
Request payload: {"id":"105c241b-30b6-4908-84ae-9b9931e24072","secrets":{"data":[{"name":"SECRET_PASSWORD","value":""}]},"libraries":[]} This 👆 proves that empty secret values are allowed and correctly handled by the server if the client sends them. Response: {
"board_fqbn": "arduino:avr:uno",
"board_name": "Arduino Uno",
"board_type": "serial",
"created_at": "2023-02-14T15:46:02.770568Z",
"href": "/create/v2/files/d/8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/sketch_feb14a",
"id": "105c241b-30b6-4908-84ae-9b9931e24072",
"is_public": false,
"libraries": [],
"modified_at": "2023-02-14T15:50:36.964194Z",
"name": "sketch_feb14a",
"path": "8a694e4b83878cc53472bd75ee928053:kittaakos/sketches_v2/sketch_feb14a",
"secrets": [
{
"name": "SECRET_PASSWORD",
"value": ""
}
],
"tutorials": null,
"types": null,
"user_id": "b036b0a3-ef0e-44b1-af37-3c756f20fdf0"
} The response contains the empty value for my |
I will report this in the webide repo |
Describe the problem
Arduino Web Editor has a "Secret tab" feature that makes it easy to share sketches without accidentally exposing sensitive data (e.g., passwords or tokens). Secrets are automatically generated for any identifier in the sketch which starts with
SECRET_
and contains all uppercase characters.The values of these secrets can be defined on Arduino Cloud via a form in the "Secret" tab in Arduino Web Editor.
Secrets are also used in Arduino IoT Cloud Thing sketches to store network credentials. The value of these secrets can be set via the Arduino IoT Cloud web interface.
When you download a sketch containing secrets from Arduino Web Editor (via the ●●● > Download Sketch menu item), the downloaded ZIP file includes a file named
arduino_secrets.h
that contains#define
directives for the secrets.When you have defined the value of secrets via the Arduino Cloud web interfaces and then pull the sketch via Arduino IDE's Remote Sketchbook, the
arduino_secrets.h
file is added to the sketch.🐛 However, if you have not defined values for the secrets via the web interface before pulling, then the sketch will not contain this file.
🐛 The sketch will fail to compile and the average user will find it very difficult to manually add the correct file and code for the missing secrets definitions.
To reproduce
SECRET_PASSWORD
.🐛 The sketch contains only the primary
.ino
file andReadMe.adoc
.🐛 The compilation fails:
Expected behavior
When a sketch that uses secrets is pulled, it will always contain:
arduino_secrets.h
file with#define
directives for the secret macros#include
directive at the top of the primary sketch file forarduino_secrets.h
(include arduino_secrets when needed #438)Arduino IDE version
Original report
2.0.0-beta.8-snapshot.491fa19
Last verified with
9a6a457
Operating system
Windows
Operating system version
11
Additional context
I can envision two common use cases where secrets are not defined on Arduino Cloud before pulling the sketch:
Additional reports:
Issue checklist
The text was updated successfully, but these errors were encountered: