openchargemap / ocm-docs

Documentation and branding source files
MIT License
8 stars 8 forks source link

Improve security of spec by restricting values #11

Closed ghost closed 2 months ago

ghost commented 2 months ago

All objects (spec-wide) now have additionalProperties: false set. This prevents extra properties from being sent.


The following models have more extensive improvements (these are the models I needed for my work): Tariff, TariffElement, TariffRestrictions, PriceComponent, DisplayText, Price, EnergyMix, EnergySource, EnvironmentImpact.

In cases where OCPI specified a max length for a string, I implemented the corresponding maxLength. When a fixed length was specified, I added minLength as well.

I added maxItems to arrays to prevent overloading servers. This is not prescribed by the OCPI spec, but I added a limit that I believe is both high enough to allow all reasonable use cases while preventing excess traffic from malicious actors.

I added a minimum and maximum to ints to prevent buffer overflows.