open-policy-agent / open-policy-agent/frameworks

Wrong template parameter is being checked in e2e_tests: "expected" vs "name"

Open
#100 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
127
Forks
61
Avg merge
1d 17h
Merged PRs (30d)
13

Description

Function newConstraintTemplate() defines a template parameter named "expected":

"expected": {Type: "string"},

The Deny by Parameter test uses a parameter named "name":

cstr := newConstraint("Foo", "ph", map[string]string{"name": "deny_me"}, nil)

The tests passes because undefined template parameters are not type checked at all, which is probably a bug.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in constraint/pkg/client/e2e_tests.go, reviewing newConstraintTemplate() near line 39 and the Deny by Parameter test near line 601. Compare the declared template parameter with the parameter supplied by the test, then run the relevant e2e tests. Done means the test uses the declared parameter consistently and still verifies the intended denial behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.