28.4.2. Contribution guidelines

2025.10.06.
AI Security Blog

Contribution guidelines are the social and technical contract of a collaborative project. They ensure consistency, maintain quality, and create a transparent, predictable process for everyone involved. By establishing clear expectations, you empower contributors and protect the project’s integrity.

The Contribution Lifecycle

Contributing to an open-source project follows a structured lifecycle. Understanding this process helps you integrate your work smoothly and efficiently. The goal is to move from an idea or bug report to a merged piece of code or documentation that improves the project for everyone.

Kapcsolati űrlap - EN

Do you have a question about AI Security? Reach out to us here:

Contribution Workflow Diagram 1. Find/Open Issue 2. Fork & Create Branch 3. Develop & Test 4. Submit Pull Request 5. Review & Merge Discuss Implement Propose Iterate
  1. Find or Open an Issue: Before writing any code, check the project’s issue tracker. Look for existing bugs or feature requests tagged with labels like good first issue or help wanted. If your idea is new, open an issue first to discuss it with the maintainers. This prevents wasted effort on work that might not align with the project’s direction.
  2. Fork and Branch: Create a personal copy (a “fork”) of the repository. Then, create a new branch from the main development branch (e.g., main or develop). Your branch name should be descriptive, like fix-prompt-injection-validator or feature-add-toxicity-scanner. Never work directly on the main branch.
  3. Develop and Test: This is where you implement your changes. Adhere to the project’s coding standards and conventions. Crucially, any new functionality must be accompanied by tests. If you are fixing a bug, write a test that fails before your fix and passes after. This proves your fix works and prevents future regressions.
  4. Submit a Pull Request (PR): Once your changes are complete and tested, push your branch to your fork and open a Pull Request against the original project’s main branch. Your PR description is vital. Clearly explain the “what” and “why” of your changes. Link to the issue it resolves (e.g., “Closes #123”).
  5. Review and Merge: Project maintainers will review your PR. They may ask for changes or clarifications. Respond to feedback constructively and push new commits to your branch to update the PR. Once approved, a maintainer will merge your contribution into the project.

Types of Contributions

Meaningful contributions extend far beyond writing code. A healthy project thrives on diverse forms of support. Consider contributing in areas that match your skills and interests.

Contribution Type Description Impact
Code (Features/Fixes) Implementing new adversarial attacks, defensive mechanisms, or fixing bugs in existing tools. Directly enhances the project’s core capabilities and reliability.
Documentation Writing tutorials, improving API references, clarifying installation steps, or correcting typos. Lowers the barrier to entry for new users and contributors, increasing project adoption.
Testing Adding unit tests, integration tests, or end-to-end tests to increase code coverage and robustness. Improves project stability and reduces the likelihood of future bugs.
Issue Triage Reproducing reported bugs, clarifying vague issue descriptions, and applying appropriate labels. Helps maintainers focus on development by ensuring the issue tracker is organized and actionable.
Security Research Identifying and responsibly disclosing vulnerabilities within the project’s tools or dependencies. Strengthens the project’s security posture and protects its users.

Technical Standards and Conventions

Consistency is key to a maintainable codebase. Following established standards makes the code easier to read, review, and debug for everyone.

Commit Message Format

A well-formatted commit history is an invaluable resource. We use a conventional format to make commits readable and machine-parsable. Each commit message should consist of a header, a body, and an optional footer.

<type>(<scope>): <subject>

<body>

<footer>
  • type: The nature of the change (e.g., feat, fix, docs, test, refactor, chore).
  • scope (optional): The part of the codebase affected (e.g., prompt_injection, auth, llm_api).
  • subject: A concise, imperative-mood description of the change (e.g., “Add validation for user-controlled prompts”).
  • body (optional): A more detailed explanation of the change, including the motivation and context.
  • footer (optional): Reference to issues (e.g., Fixes #451).

Coding and Documentation Style

Your code should follow the established style guide for the project’s primary language (e.g., PEP 8 for Python). This includes conventions for naming, formatting, and structure. Furthermore, all public functions, classes, and modules must have clear, comprehensive docstrings that explain their purpose, arguments, and return values. This internal documentation is as critical as external guides.

Legal Notice: Contributor License Agreement (CLA)

Many mature open-source projects require you to sign a Contributor License Agreement (CLA) before your first contribution can be merged. A CLA is a legal document that clarifies the terms under which your intellectual property is being contributed. It typically states that you are entitled to grant the license for your contribution and that the project has the right to use your work. This protects both you and the project. The process is usually automated and handled when you open your first pull request.