[CDS Toolkit] GET /metrics Returns Success Response When Invalid Period Is Given
Introduction
The Consumer Data Standards (CDS) Toolkit is a critical component of the Australian government's efforts to promote competition and innovation in the financial services sector. The CDS Toolkit provides a standardized framework for the sharing of consumer data between financial institutions, enabling consumers to make more informed decisions about their financial products and services. However, as with any complex system, there are potential issues that can arise, and this article highlights one such issue.
Description
The issue at hand is related to the GET /metrics endpoint of the CDS Toolkit. Specifically, when an invalid period is provided, the endpoint returns a success response instead of an error. This is a critical issue, as it can lead to incorrect or misleading information being presented to consumers.
Steps to reproduce
To reproduce this issue, follow these steps:
- Invoke the GET /metrics endpoint with an invalid period parameter. For example, you can use the following curl command:
curl --location 'https://localhost:8243/consumerdatastandardsadminapi/v1/metrics?period=abc'
--header 'Content-Type: application/x-www-form-urlencoded'
--header 'Authorization: Bearer eyJraWQiOiJjZHMtMzAwLWFwcDEiLCJ0eXAiOiJKV1QiLCJhbGciOiJQUzI1NiJ9.eyJzdWIiOiJjZHItcmVnaXN0ZXIiLCJhdWQiOiJodHRwczovL3dzbzJvYi5jb20iLCJpc3MiOiJjZHItcmVnaXN0ZXIiLCJleHAiOjIwNjA1NzUyMjgsImlhdCI6MTc0NTIxNTIyMywianRpIjoiYU9sT05FUWNYcCJ9.SuMT0MfQnIiZMBi5jfgISgFZ_IL-7Z9Y_5XyLu8zI9ra0gpXF7zWX6BCkC7urOu8pzU4ABnoK6avU2i3cYnEp02sJMOo34ItWtMUBkZSMEVr11yRk3wPVavtZXcEZcttkxirkG6C9MtLzGo_z_e2DFdPa4-4YRZpijCL4ezXtiWhmK9yIxNdBIQCMXsoceYhFI1qzVQym_7bkh6R0yOoERDhfsBV1OFKEWYZQiDjC6H9xCqBD7ep1mNf8GMh7Zwz9zVgbddGoOtb9MU9CcNynvthSNwPnlE2R8A5Wf0SkgDES-k91zGj5uCwlUqNRMakX-5L0Z-lG6O0LzUIb_tC2A'
--header 'x-v: 5'
--header 'x-fapi-auth-date: Thu, 16 Jan 2025 16:50:15 GMT'
- Observe the response from the endpoint. In this case, a success response is returned, even though the parameter is invalid.
Observation
The observation is that a success response is returned when an invalid period is provided. This is unexpected, as the period parameter is a critical component of the GET /metrics endpoint, and an invalid value should result in an error.
Expectation
The expectation is that the endpoint should return an error when an invalid period is provided. The period parameter can take one of three values: CURRENT, HISTORIC, or ALL. Any other value is considered invalid and should result in an error.
Impact
This issue has significant implications for the CDS Toolkit. If an invalid period is provided, the endpoint will return a success response, which can lead to incorrect or misleading information being presented to consumers. This can have serious consequences, including financial losses or reputational damage.
Conclusion
In conclusion, the GET /metrics endpoint of the CDS Toolkit returns a success response when an invalid period is provided. This is a critical issue that needs to be addressed to ensure the integrity and accuracy of the data presented to consumers. The expectation is that the endpoint should return an error when an invalid period is provided, and this issue should be prioritized for resolution.
Recommendations
To address this issue, the following recommendations are made:
- Update the endpoint to return an error when an invalid period is provided.
- Provide clear documentation on the valid values for the period parameter.
- Conduct thorough testing to ensure that the endpoint behaves as expected.
By implementing these recommendations, the CDS Toolkit can ensure that the data presented to consumers is accurate and reliable, and that the integrity of the system is maintained.
Future Work
Future work on this issue should focus on the following areas:
- Conducting thorough testing to ensure that the endpoint behaves as expected.
- Providing clear documentation on the valid values for the period parameter.
- Updating the endpoint to return an error when an invalid period is provided.
By prioritizing these areas, the CDS Toolkit can ensure that the data presented to consumers is accurate and reliable, and that the integrity of the system is maintained.
References
[1] Consumer Data Standards Australia. (n.d.). Common Field Types. Retrieved from https://consumerdatastandardsaustralia.github.io/standards/#common-field-types
Introduction
In our previous article, we discussed the issue of the GET /metrics endpoint of the CDS Toolkit returning a success response when an invalid period is provided. This article provides a Q&A section to address some of the common questions and concerns related to this issue.
Q: What is the expected behavior of the GET /metrics endpoint?
A: The expected behavior of the GET /metrics endpoint is to return an error when an invalid period is provided. The period parameter can take one of three values: CURRENT, HISTORIC, or ALL. Any other value is considered invalid and should result in an error.
Q: Why is it important to return an error when an invalid period is provided?
A: Returning an error when an invalid period is provided is important because it ensures that the data presented to consumers is accurate and reliable. If an invalid period is provided, the endpoint should return an error to prevent incorrect or misleading information from being presented to consumers.
Q: What are the valid values for the period parameter?
A: The valid values for the period parameter are:
- CURRENT
- HISTORIC
- ALL
Any other value is considered invalid and should result in an error.
Q: How can I test the GET /metrics endpoint to ensure it behaves as expected?
A: To test the GET /metrics endpoint, you can use a tool like curl to send a request to the endpoint with an invalid period parameter. For example:
curl --location 'https://localhost:8243/consumerdatastandardsadminapi/v1/metrics?period=abc'
--header 'Content-Type: application/x-www-form-urlencoded'
--header 'Authorization: Bearer eyJraWQiOiJjZHMtMzAwLWFwcDEiLCJ0eXAiOiJKV1QiLCJhbGciOiJQUzI1NiJ9.eyJzdWIiOiJjZHItcmVnaXN0ZXIiLCJhdWQiOiJodHRwczovL3dzbzJvYi5jb20iLCJpc3MiOiJjZHItcmVnaXN0ZXIiLCJleHAiOjIwNjA1NzUyMjgsImlhdCI6MTc0NTIxNTIyMywianRpIjoiYU9sT05FUWNYcCJ9.SuMT0MfQnIiZMBi5jfgISgFZ_IL-7Z9Y_5XyLu8zI9ra0gpXF7zWX6BCkC7urOu8pzU4ABnoK6avU2i3cYnEp02sJMOo34ItWtMUBkZSMEVr11yRk3wPVavtZXcEZcttkxirkG6C9MtLzGo_z_e2DFdPa4-4YRZpijCL4ezXtiWhmK9yIxNdBIQCMXsoceYhFI1qzVQym_7bkh6R0yOoERDhfsBV1OFKEWYZQiDjC6H9xCqBD71mNf8GMh7Zwz9zVgbddGoOtb9MU9CcNynvthSNwPnlE2R8A5Wf0SkgDES-k91zGj5uCwlUqNRMakX-5L0Z-lG6O0LzUIb_tC2A'
--header 'x-v: 5'
--header 'x-fapi-auth-date: Thu, 16 Jan 2025 16:50:15 GMT'
Q: What are the potential consequences of not returning an error when an invalid period is provided?
A: The potential consequences of not returning an error when an invalid period is provided include:
- Incorrect or misleading information being presented to consumers
- Financial losses or reputational damage
- Loss of consumer trust and confidence in the CDS Toolkit
Q: How can I ensure that the GET /metrics endpoint behaves as expected?
A: To ensure that the GET /metrics endpoint behaves as expected, you can:
- Conduct thorough testing to ensure that the endpoint behaves as expected
- Provide clear documentation on the valid values for the period parameter
- Update the endpoint to return an error when an invalid period is provided
By following these steps, you can ensure that the data presented to consumers is accurate and reliable, and that the integrity of the system is maintained.