Skip to content
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

[rest] Fix ThingActionsResource does not accept new Thing action UIDs with hash #4445

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ public Response getActions(@PathParam("thingUID") @Parameter(description = "thin

@POST
@RolesAllowed({ Role.USER, Role.ADMIN })
@Path("/{thingUID}/{actionUid: [a-zA-Z0-9]+\\.[a-zA-Z0-9]+}")
// accept actionUid in the form of "scope.actionTypeUid" or "scope.actionTypeUid#signatureHash"
// # is URL encoded as %23
@Path("/{thingUID}/{actionUid: [a-zA-Z0-9]+\\.[a-zA-Z0-9]+(%23[a-zA-Z0-9]+)?}")
Copy link
Member

Choose a reason for hiding this comment

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

The hash is a hex string, correct? In that case A-Fa-f0-9 would be sufficient. Since we do a lookup on the hash and that is case-sensitive it Coups be a good idea to also restrict that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, just implemented and pushed that.
Local test looks good.

@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(operationId = "executeThingAction", summary = "Executes a thing action.", responses = {
Expand Down