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

Add filtering/sanitising #10

Open
tjorim opened this issue Dec 30, 2024 · 2 comments
Open

Add filtering/sanitising #10

tjorim opened this issue Dec 30, 2024 · 2 comments

Comments

@tjorim
Copy link
Owner

tjorim commented Dec 30, 2024

I was contacted by the team behind irail a while ago. Here is the email:

Sinds een tijdje zie ik deze calls van pyRail. pyRail is slechts een wrapper en je kan gebruikers niet dwingen om te updaten, maar is er een manier om deze fouten op te vangen alvorens ze naar iRail komen? Het zijn niet overdreven veel fouten, maar gezien de lengte van de foutmeldingen zijn ze lichtjes storend in de logs. Het verbieden van bvb %, |, {} en [] tesamen met het begrenzen van de input lengte tot 72 karakters oid (ruim boven wat nu de langste stationsnaam is) zou dit kunnen voorkomen.

Stop '{% set ns = namespace(x=[]) %} {% for zone in states.zone %} {% set ns.x = ns.x + [(distance(zone, 'person.Toon_proost'), zone.name)] %} {% endfor %} {{ (ns.x|sort)[0][1] }}

[01/Sep/2024:20:58:24 +0200] "GET /v1/connections/?format=json&lang=en&from=%7B%25+set+ns+%3D+namespace%28x%3D%5B%5D%29+%25%7D+%7B%25+for+zone+in+states.zone+%25%7D+%7B%25+set+ns.x+%3D+ns.x+%2B+%5B%28distance%28zone%2C+%27person.Toon_proost%27%29%2C+zone.name%29%5D+%25%7D+%7B%25+endfor+%25%7D+%7B%7B+%28ns.x%7Csort%29%5B0%5D%5B1%5D+%7D%7D%0A&to=Turnhout HTTP/1.1" 404 288 "-" "pyRail (tielemans.jorim@gmail.com)

@tjorim
Copy link
Owner Author

tjorim commented Jan 7, 2025

Longest station name (check all languages) seems to be 41, will maybe limit the lenth to 50?
Not sure if there are other jinja specific symbols that won't be used in the API.

@silamon
Copy link
Contributor

silamon commented Jan 11, 2025

Let's just take the considerations from the team itself?

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