Skip to content

AJV schema validation functions should be pre-compiled to avoid unsafe-eval CSP requirement #423

Closed

Description

@hrobertson

Describe the Bug
Compiling the AJV schema validation functions at runtime uses new new Function which requires the CSP script-src to include 'unsafe-eval'.

Instead, the schema validation functions should be pre-compiled.

Steps to Reproduce

  1. Use the cloudevents/sdk-javascript library in a site with a CSP with script-src not including 'unsafe-eval'
  2. Use new CloudEvent(...)
  3. Observe CSP error

Expected Behavior
The library should be able to be used successfully without including 'unsafe-eval' in your CSP.

Additional context
See https://github.com/ajv-validator/ajv/blob/master/docs/security.md#content-security-policy

Activity

  1. lance commented on Aug 3, 2021

    @lance
    Member
  2. github-actions commented on Sep 3, 2021

    @github-actions
    Contributor

    This issue is stale because it has been open 30 days with no activity.

  3. lance commented on Dec 14, 2021

    @lance
    Member

    I have been working on this, but am awaiting some response from the ajv team ajv-validator/ajv#1837

  4. github-actions commented on Jan 14, 2022

    @github-actions
    Contributor

    This issue is stale because it has been open 30 days with no activity.

  5. github-actions commented on Feb 14, 2022

    @github-actions
    Contributor

    This issue is stale because it has been open 30 days with no activity.

  6. added a commit that references this issue on Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions