Forum Discussion
AWAF Path Parameters with OPENAPI json file
Hi, Iam securing a API with a JSON OPENAPI file it mostly works fine however I have two positional parameters used in one url that seems to mask the following paths "/dqm/v1/projects/{customerId}/{pageNumber} & /dqm/v1/projects/projectDetails/{workRequestId}" The result is illegal parameter length violations on a url that is actually valid. the two paths have different operationId headers associated with them Does the WAF use the operationId to match the Path? It appears not as if I delete the operation Id from the api file then the policy matches the correct URL.
Any assistance in ubderstanding what is happening and why is appreaciated.
Allowed URL's
extract from JSON openAPI file
/dqm/v1/projects/{customerId}/{pageNumber}:
get:
tags:
- customer-projects-controller
operationId: getCustomerProjectsForIdperPage
parameters:
- name: customerId
in: path
required: true
schema:
type: string
- name: pageNumber
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
'*/*':
schema:
$ref: '#/components/schemas/CustomerProjectsResponse'
/dqm/v1/projects/projectDetails/{workRequestId}:
get:
tags:
- customer-projects-controller
operationId: getProjectDetailswithID
parameters:
- name: workRequestId
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
'*/*':
schema:
$ref: '#/components/schemas/ProjectDetailsResponse'
To use variable with string map, it expects list argument. Also no curly braces for defining variables. Try below code
when HTTP_REQUEST { log local0. "Request URL: [HTTP::host][HTTP::uri]" if { [class match [HTTP::uri] starts_with intranet_redirect_datagroup] } { set full_uri [HTTP::uri] log local0. "full URI - $full_uri" set old_uri [class match -name [HTTP::uri] starts_with intranet_redirect_datagroup] set new_uri [class match -value [HTTP::uri] starts_with intranet_redirect_datagroup] log local0. "old_uri - $old_uri" log local0. "new_uri - $new_uri" set rewrite_uri [string map [list "$old_uri" "$new_uri"] [HTTP::uri]] log local0. "New full URI - $rewrite_uri" HTTP::respond 302 Location "https://cloud1.sharepoint.com$rewrite_uri" " return } }
5 Replies
- spalande
Nacreous
great to know. please mark this as answered
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com