Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cel eval is not validating json already validated #1765

Open
alansenairj opened this issue Sep 8, 2024 · 1 comment
Open

cel eval is not validating json already validated #1765

alansenairj opened this issue Sep 8, 2024 · 1 comment
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@alansenairj
Copy link

Expected Behavior

cel-eval -e expressiont.txt -r payload.json: true or false

Actual Behavior

error making eval context: failed to parse the body as JSON: unexpected end of JSON input

body.object_kind == 'push' && (body.ref == 'refs/heads/develop' || body.ref == 'refs/heads/staging')
or
object_kind == 'push' && (ref == 'refs/heads/develop'

payload file:

POST / HTTP/1.1
Content-Type: application/json
User-Agent: insomnia/9.3.2
X-Gitlab-Event: Push Hook
X-Gitlab-Token: nononono
Host: localhost:8080
Content-Length: 4373

{
	"object_kind": "push",
	"event_name": "push",
	"before": "36988bdb67e6fc4df847c37c4b040823ffa401d8",
	"after": "143f0123a00e035a850b9f991a0214b5844b9e24",
	"ref": "refs/heads/develop",

<... bla bla bla validated>

}

Steps to Reproduce the Problem

  1. get webhook payload from gitlab
  2. validate paylod in insomnia or json lint at https://jsonlint.com/
  3. not filtering!
  4. error making eval context: failed to parse the body as JSON: unexpected end of JSON input (???)

Additional Info

  • Kubernetes version:

    Output of kubectl version:

    (paste your output here)
    
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

@alansenairj alansenairj added the kind/bug Categorizes issue or PR as related to a bug. label Sep 8, 2024
@bigkevmcd
Copy link
Member

@alansenairj Are you changing the body from the original, if so, your Content-Length might be wrong which would cause the HTTP request reader to fail to parse the payload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants