Azure / Azure/cyclecloud-pbspro
Unhandled invalid JSON when users/groups contain backslashes
- Dominant language
- Python
- Stars
- 16
- Forks
- 30
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 1
Description
This is really a PBS issue, but it seems like azpbs could work around it in the JSON parsing, similar to the workaround for invalid JSON quoting.
If Job_Owner, euser, or egroup contain backslashes (may be common in Active Directory environments due to `DOMAIN\user` format, PBS will return invalid JSON.
**Example:**
```
"Job_Owner":"MYDOMAIN\myuser@myhost"
"euser":"MYDOMAIN\myuser",
"egroup":"MYDOMAIN\domain users",
```
**Proposed fix:**
We could specifically try to handle the DOMAIN\user format for all possible JSON backslash escape sequences:
`\"` No-op - users/groups can't begin with quotes
`\\` No-op - users/groups can't begin with backslash
`\/` No-op - users/groups can't begin with forward slash
`\b` Safe to escape as `\\b`. Backspace is not valid in user/group names.
`\f` Safe to escape as `\\f`. Form feed is not valid in user/group names.
`\n` Safe to escape as `\\n`. Newline is not valid in user/group names.
`\r` Safe to escape as `\\r`. Carriage return is not valid in user/group names.
`\t` Safe to escape as `\\t`. Tab is not valid in user/group names.
`\uXXXX` Detect whether `\u` is followed by a valid unicode hex value. If so, no-op. If not, escape as `\\u`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.