{"id":18830138,"url":"https://github.com/gravitee-io/gravitee-policy-request-validation","last_synced_at":"2025-04-14T03:42:02.217Z","repository":{"id":24764785,"uuid":"102392831","full_name":"gravitee-io/gravitee-policy-request-validation","owner":"gravitee-io","description":"Gravitee.io - API Management - Policy - Request Validation","archived":false,"fork":false,"pushed_at":"2025-04-11T23:22:07.000Z","size":198,"stargazers_count":1,"open_issues_count":7,"forks_count":5,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-12T00:27:16.798Z","etag":null,"topics":["product-am","product-apim","security-scan"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gravitee-io.png","metadata":{"files":{"readme":"README.adoc","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.adoc","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-04T18:57:34.000Z","updated_at":"2025-04-01T19:34:58.000Z","dependencies_parsed_at":"2023-11-24T19:27:40.576Z","dependency_job_id":"a4a5646b-c74b-4e0b-9660-461e683b01e8","html_url":"https://github.com/gravitee-io/gravitee-policy-request-validation","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravitee-io%2Fgravitee-policy-request-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravitee-io%2Fgravitee-policy-request-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravitee-io%2Fgravitee-policy-request-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravitee-io%2Fgravitee-policy-request-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gravitee-io","download_url":"https://codeload.github.com/gravitee-io/gravitee-policy-request-validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248818717,"owners_count":21166468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["product-am","product-apim","security-scan"],"created_at":"2024-11-08T01:47:56.909Z","updated_at":"2025-04-14T03:42:02.192Z","avatar_url":"https://github.com/gravitee-io.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Request validation policy\n\nifdef::env-github[]\nimage:https://img.shields.io/static/v1?label=Available%20at\u0026message=Gravitee.io\u0026color=1EC9D2[\"Gravitee.io\", link=\"https://download.gravitee.io/#graviteeio-apim/plugins/policies/gravitee-policy-request-validation/\"]\nimage:https://img.shields.io/badge/License-Apache%202.0-blue.svg[\"License\", link=\"https://github.com/gravitee-io/gravitee-policy-request-validation/blob/master/LICENSE.txt\"]\nimage:https://img.shields.io/badge/semantic--release-conventional%20commits-e10079?logo=semantic-release[\"Releases\", link=\"https://github.com/gravitee-io/gravitee-policy-request-validation/releases\"]\nimage:https://circleci.com/gh/gravitee-io/gravitee-policy-request-validation.svg?style=svg[\"CircleCI\", link=\"https://circleci.com/gh/gravitee-io/gravitee-policy-request-validation\"]\nendif::[]\n\n== Phase\n\n[cols=\"4*\", options=\"header\"]\n|===\n^|onRequest\n^|onResponse\n^|onRequestContent\n^|onResponseContent\n\n^.^| X\n^.^|\n^.^| X\n^.^|\n\n|===\n\n== Description\n\nYou can use the `request-validation` policy to validate an incoming HTTP request according to defined rules.\nA rule is defined for an input value. This input value supports Expression Language expressions and is validated against constraint\nrules.\n\nConstraint rules can be:\n\n* `NOT_NULL` -- Input value is required\n* `MIN` -- Input value is a number and its value is greater than or equal to a given parameter\n* `MAX` -- Input value is a number and its value is lower than or equal to a given parameter\n* `MAIL` -- Input value is valid according to the mail pattern\n* `DATE` -- Input value is valid according to the date format pattern given as a parameter\n* `PATTERN` -- Input value is valid according to the pattern given as a parameter\n* `SIZE` -- Input value length is between two given parameters\n* `ENUM` -- Field value included in ENUM\n\nBy default, if none of the rules can be validated, the policy returns a `400` status code.\n\n== Compatibility with APIM\n\n|===\n| Plugin version | APIM version\n| 1.x            | All supported versions\n|===\n\n== Configuration\n\n|===\n|Property |Required |Description |Type |Default\n\n.^|scope\n^.^|X\n|Phase when the policy is executed\n^.^|Policy scope\n^.^|ON_REQUEST\n\n.^|status\n^.^|X\n|HTTP status code send to the consumer in case of validation issues\n^.^|HTTP status code\n^.^|400\n\n.^|rules\n^.^|X\n|Rules to apply to incoming request\n^.^|List of rules\n^.^|-\n\n|===\n\n=== Example configuration\n\n[source, json]\n----\n\"policy-request-validation\": {\n    \"rules\": [\n        {\n            \"constraint\": {\n                \"parameters\": [\n                    \".*\\\\\\\\.(txt)$\"\n                ],\n                \"type\": \"PATTERN\"\n            },\n            \"input\": \"{#request.pathInfos[2]}\"\n        }\n    ],\n    \"status\": \"400\"\n}\n----\n\n== Errors\n\n=== HTTP status code\n|===\n|Code |Message\n\n.^| ```400```\n| Incoming HTTP request can not be validated.\n\n|===\n\n=== Default response override\n\nYou can use the response template feature to override the default response provided by the policy. These templates must be defined at the API level (see the API Console *Response Templates*\noption in the API *Proxy* menu).\n\n=== Error keys\n\nThe error keys sent by this policy are as follows:\n\n[cols=\"2*\", options=\"header\"]\n|===\n^|Key\n^|Parameters\n\n.^|REQUEST_VALIDATION_INVALID\n^.^|violations\n\n|===\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgravitee-io%2Fgravitee-policy-request-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgravitee-io%2Fgravitee-policy-request-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgravitee-io%2Fgravitee-policy-request-validation/lists"}