Skip to content

Unhandled invalid JSON when users/groups contain backslashes #91

@dpwatrous

Description

@dpwatrous

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions