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

escape transformation chokes on UTF characters #549

Closed
apogrebennyk opened this issue Mar 23, 2016 · 4 comments
Closed

escape transformation chokes on UTF characters #549

apogrebennyk opened this issue Mar 23, 2016 · 4 comments

Comments

@apogrebennyk
Copy link
Contributor

Version 4.3.4 fails to escape the string that contains Unicode characters:
$var(test) = "Foobar s.à.r.l.";
$var(test_escaped) = $(var(test){s.escape.user});

Mar 23 16:00:28 sp1 (local7.err) proxy[27853]: ERROR: [strcommon.c:241]: escape_user(): invalid escaped character <4294967235>
Mar 23 16:00:28 sp1 (local7.err) proxy[27853]: ERROR: [lvalue.c:345]: lval_pvar_assign(): non existing right pvar
Mar 23 16:00:28 sp1 (local7.err) proxy[27853]: ERROR: [lvalue.c:405]: lval_assign(): assignment failed at pos: (701,35-701,97)

is there a way to ignore those characters or is it something we have to live with?

Some background: we are storing some user-defined data as custom attributes in acc src_leg/dst_leg. As you know the fields in src/dst_leg are pipe-separated. In order to prevent the user from hijacking the attributes we have devided to escape the user-provided fields. This is when we realized that this is limited to latin1 encoding. In theory we can escape it using lua just wanted to avoid the overhead of calling the interpreter too often.

@miconda
Copy link
Member

miconda commented Apr 1, 2016

I think escape.user is trying to follow the SIP grammar/constraints for username, or at list it should. For db operations, maybe escape.common or sql transformation are more suitable.

At the end, the code can be patches, probably it's about lifting some restrictions there.

@apogrebennyk
Copy link
Contributor Author

You are right. The pipe character is a problem not for sql operations as such but for the ACC mediator that parses src/dst_leg. Therefore I had to use stricter escape.user instead of escape.common or sql transformations. Maybe a new transformation can be created or, as you said, some restrictions lifted in escape.user. Going to check it with Victor.

@miconda
Copy link
Member

miconda commented Apr 1, 2016

You can also use subst transformation to replace what characters you want in a variable.

@miconda
Copy link
Member

miconda commented Apr 10, 2016

Closing this one, either a new transformation needs to be added or use a combination of existing ones.

@miconda miconda closed this as completed Apr 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants