Negative Lookahead pattern is not supporting in OAS policy

Hi Team,

The below issue is in hybrid (1.9.3).

Proxy is giving deployment error for below pattern which exists in OAS policy resource file (openapispec). Saying that unsupported Perl Syntax : `(?!`

 

^(?![\s\S]*<script\b|[\s\S]*javascript\b|[\s\S]*[<>\[\]{};\\|!])[\s\S]*$

 

It is giving error for negative lookahead (?!) pattern. So I tried by giving alternative negative lookahead like below

 

^(?=[\s\S]*$)(?![\s\S]*<script\b)(?![\s\S]*javascript\b)(?![\s\S]*[<>\[\]{};\\|!])[\s\S]*$

 

But still it is giving error.  Saying that unsupported Perl Syntax : `(?=`

And I tried the same patterns in apigee edge where it is deploying without any issues.

May I know why its not working in hybrid. If its a bug pls let me know in which version will this be resolved.


  

 

0 6 368
6 REPLIES 6

Hi

Could you provide some additional information please? 

Can you provide  the configuration you used, that leads to this problem? Including a small yet complete OpenAPISpec ?

Can you clarify what command you run, or what action you perform, which leads to the error "Saying that unsupported Perl Syntax : `(?!`" .  Where do you see this error?  In the console?  In a terminal?  In an API response?  Something else? 

Thanks

EDIT: Making some guesses, I am thinking you are observing this error as you try to import the proxy into the organization?  Or maybe at deployment time?  I've created a bug to track this. Internal ref: b/293460993 . 

Hi,

Here is the sample spec

 

openapi: 3.0.3
info:
  description: test Service API
  version: 1.5.0
  title: test Service API
  x-mox-force-incompatible-changes: true
  contact:
    name: test Squad
  x-provider: test-service
paths:
  /test:
    parameters:
        - name: customerId
          in: header
          description: The customer ID on whose behalf we perform the request.
          example: "5709211005542779000"
          required: true
          schema:
            type: string
    get:
      summary: test summary
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/testresponse"
      operationId: testId
      tags:
        - test Api
      description: testing id
components:
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            required:
              - errorCode
            properties:
              errorCode:
                type: string
                description: refer to error code list per API
  parameters:
    testId:
      name: testId
      in: path
      description: test description
      example: '1234567890'
      required: true
      schema:
        type: string
  schemas:
    testresponse:
      title: testresponse
      type: object
      properties:
        isUnion:
          type: boolean
        count:
          type: number
        reasonForUpdate:
          type: string
          minLength: 3
          maxLength: 255
          pattern: '^(?![\s\S]*<script\b|[\s\S]*javascript\b|[\s\S]*[<>\[\]{};\\|!])[\s\S]*$'  
security:
  - accessTokenAuth: []
tags:
  - name: test Api

 


The error is getting while trying to save.

Teja_0-1690803558281.png
But the same spec is working in edge
May I know how I can track the bug id which you have created.

Thanks.


 

Hello @dchiesa1 , Please provide some update on above issue & query
Thanks In Advance.

Sure. I'm sorry I should have replied with this information earlier. 

I've reproduced the problem here.  I've investigated and found the cause - the implementation of Apigee in X & hybrid applies a validation of the spec that is more restrictive than the validation that Apigee Edge uses. This is why Apigee is rejecting your valid OAS spec.  I've filed an enhancement request on Apigee, regarding the problem you described. The internal reference for this is b/293460993 .  This request is now in the backlog. 

I can't offer a timeframe to you on when the product and engineering team might triage this, nor can I offer a commitment that the request will be accepted and fixed. If you want to escalate this, you will need to use your official support channel, and ask the Apigee support engineer to assist with that.

Still no update on progress on this ticket. Sorry.

 

Thanks for information.

Just wanted to get this one also to your notice that below types are not supporting in hybrid
type: date 
type: date-time