func invoke: reject reserved CloudEvents attribute names passed with -e

Open Beginner friendly
#4,191 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
cli

Research direction

Start in cmd/invoke.go at the CloudEvents extension-name validation added in #4130. Compare the reserved core attribute list from the issue (id, type, source, specversion, subject, time, datacontenttype, dataschema) against that check, then reject them with a message naming the matching --id, --type or --source flag. Extend the existing extension-name test cases beside that validation; done when reserved names fail with the new message and ordinary extension names still pass.

Written by the indexing model from the issue text.

Description

help wanted kind/good-first-issue

Follow-up to #4130 / #3346.

func invoke -e name=value sets a CloudEvent extension. #4130 validates the name against the CloudEvents rule for extension names (lowercase letters and digits). Names that are core CloudEvents attributes, such as id, type, source, specversion, subject, time, datacontenttype and dataschema, pass that check and are only rejected later, inside the CloudEvents SDK, with a less helpful error.

Suggested change: reject those names in the same place the extension names are validated in cmd/invoke.go, with a message that says the name is a reserved CloudEvents attribute and points at the flag that sets it where one exists (--id, --type, --source). Add test cases next to the existing extension-name tests.

Open for contribution.

Dominant language
Go
Stars
366
Forks
231
Avg merge
2d 23h
Merged PRs (30d)
50

Getting set up

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.

More from knative/func

All issues in knative/func

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.