Contributing
Notes for anyone changing ipfence, including future you.
First
- Read What ipfence does, then the code tour.
- Read the design decisions before changing behaviour.
Promises that must not break
A change that breaks one of these changes what the project is.
| Promise | Meaning |
|---|---|
| Nothing leaves the machine | no telemetry, update checks, downloads or remote services at runtime |
| Only one firewall table | never flush or edit anything ipfence did not create |
| Never guess ownership | if the table cannot be proven ours, do not touch it |
| Client text never chooses a target | only the peer address a firewall would see |
| Observe by default | nothing is blocked without an explicit enable |
| Stopping keeps protection | no cleanup of rules on shutdown |
| Show gaps | never report something as protected or enforced when it is not |
| No false results | a skipped or unrun check is reported as such |
Workflow
-
Write a test that fails for the behaviour you want.
-
Make it pass with the smallest change.
-
Run:
Shell commands
gofmt -l . go vet ./... GOOS=linux go vet ./... go test ./... -
For anything touching the firewall, readers, daemon or service, also run the kernel tests and the end-to-end script on a disposable machine: Development and tests.
-
Update the documentation in the same change.
Never
- Run the integration or end-to-end tests on a machine you depend on.
- Edit a database migration that has been released.
- Commit logs, databases or configuration files containing real addresses or
secrets. Use documentation addresses:
192.0.2.0/24,198.51.100.0/24,203.0.113.0/24,2001:db8::/32. - Add a publishing or deployment workflow without the owner's approval.
Documentation style
Write for someone who has not seen the code. Show real output. State what was not tested.