Reputation: 357
Is there a common way to secure a pathvariable?
@RequestMapping("/image/{id}")
public String getArticleImageUrl(@PathVariable String id) {
....
I mean remove unusual content e.g. javascript or other security issue related things to prevent "hacking" or abusive use?
Upvotes: 0
Views: 423
Reputation: 3300
What is secure depends on what you want to use the input for. Bottom line: You should take the same care with these kinds of parameters as any other parameter you would accept from the outside into the system, e.g.:
"Washing" the input from unwanted characters is possible but, as always: tricky and depending on what the data will be used for.
Upvotes: 1
Reputation: 357
Nvm.
I used a regex to check if this String is alphanumeric. ( ^[\\pL\\pN]+$
)
Should be enough.
Upvotes: 0