# Contributing to Rspamd
:tada: First off, thanks for taking the time to contribute! :tada:
The following is a set of guidelines for contributing to Rspamd and its packages, which are hosted in the [Rspamd Organization](https://github.com/rspamd) on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. This contribution policy is heavily inspired by [Atom editor](https://github.com/atom/atom).
#### Table Of Contents
[I don't want to read this whole thing, I just have a question](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question)
[How Can I Contribute?](#how-can-i-contribute)
* [Reporting Bugs](#reporting-bugs)
[Styleguides](#styleguides)
* [Git Commit Messages](#git-commit-messages)
* [Lua style guide](#lua-styleguide)
## I don't want to read this whole thing I just have a question
> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below.
We have an official site with a detailed FAQ and various community support resources.
* [Support channels explained](https://rspamd.com/support.html)
* [Rspamd FAQ](https://rspamd.com/doc/faq.html)
The best way to ask a question and to get a relevant reply is the mailing list:
* [Join Rspamd mailing lists](https://lists.rspamd.com/)
If chat is more your speed, you can join the Rspamd developers and users using Telegram or IRC:
* [Join Rspamd telegram channel](http://t.me/rspamd)
* [Join Rspamd IRC channel](https://freenode.net/):
* server: irc.freenode.net (port 6666)
* channel: #rspamd
Please bear in mind that even though tel is a chat service, sometimes it takes several hours for community members to respond — please be patient!
## How Can I Contribute?
### Reporting Bugs
This section guides you through submitting a bug report for Rspamd. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behavior :computer: :computer:, and find related reports :mag_right:.
When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out the required template, the information it asks for helps us resolve issues faster.
> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
#### Before Submitting A Bug Report
* Read about bug reporting in general: https://rspamd.com/doc/faq.html#how-to-report-bugs-found-in-rspamd
* Enable relevant debugging logs: https://rspamd.com/doc/faq.html#how-to-debug-some-module-in-rspamd
* Check the FAQs about Core files in case of fatal crash: https://rspamd.com/doc/faq.html#how-to-figure-out-why-rspamd-process-crashed
* Check that your issue isn't already filed: https://github.com/issues?utf8=%E2%9C%93&q=is%3Aissue+user%3Arspamd
* Check that there is not already an experimental package or master branch
#### How Do I Submit A (Good) Bug Report?
Explain the problem and include additional details to help maintainers reproduce the problem:
* **Use a clear and descriptive title** for the issue to identify the problem.
* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining how you started Rspamd, e.g. which custom configuration are you using, or what message have you scanned. When listing steps, **don't just say what you did, but explain how you did it**.
* **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
* **Explain which behavior you expected to see instead and why.**
* **If you're reporting that Atom crashed**, include a crash report with a stack trace from the operating system: https://rspamd.com/doc/faq.html#how-to-figure-out-why-rspamd-process-crashed
* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
Provide more context by answering these questions:
* **Did the problem start happening recently** (e.g. after updating to a new version of Atom) or was this always a problem?
* If the problem started happening recently, **can you reproduce the problem in an older version of Atom?** What's the most recent version in which the problem doesn't happen? You can download older versions of Atom from [the releases page](https://github.com/atom/atom/releases).
* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
* If the problem is related to scanning messages, **does the problem happen for all messages or only some?**
Include details about your configuration and environment:
* **Which version of Rspamd are you using?**
* **What's the name and version of the OS you're using**?
* **What hardware are you using, including CPU generation**, e.g. Intel Haswell or ArmV7? If you have `gcc` installed, that could be achieved by the following command: `gcc -march=native -Q --help=target|grep march`. In Linux, you can also check `/proc/cpuinfo` file for the required details.
## Styleguides
### Git Commit Messages
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less (without tag)
* Reference issues and pull requests liberally after the first line
* Consider starting the commit message with an applicable tag:
* [Minor] - minor issue/improvement not worth to mention in ChangeLog
* [Feature] - a significant feature
* [Fix] - bug fix
* [CritFix] - critical bug fix
* [Rework] - some significant logic rework
* [Config] - configuration change
* [Rules] - rules change
### Lua styleguide
Please use the following [Lua style guide](lua_style.md) when contributing changes to Lua code. This guide is both applicable for rules, libraries and plugins.
de-signing-crl'>automated/noid/stable23-update-code-signing-crl
Nextcloud server, a safe home for all your data: https://github.com/nextcloud/server
Feature: commentsScenario: Creating a comment on a file belonging to myself Given user "user0" existsGiven As an "user0"Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"When "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user0"And the response should contain only "1" commentsScenario: Creating a comment on a shared file belonging to another user Given user "user0" existsGiven user "12345" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with | path | myFileToComment.txt | | shareWith | 12345 | | shareType | 0 |When "12345" posts a comment with content "A comment from another user" on the file named "/myFileToComment.txt" it should return "201"Then As "12345" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "A comment from another user"And the response should contain a property "oc:actorDisplayName" with value "12345"And the response should contain only "1" commentsScenario: Creating a comment on a non-shared file belonging to another user Given user "user0" existsGiven user "user1" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Then "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "404"Scenario: Reading comments on a non-shared file belonging to another user Given user "user0" existsGiven user "user1" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"Scenario: Deleting my own comments on a file belonging to myself Given user "user0" existsGiven As an "user0"Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"Then the response should contain a property "oc:parentId" with value "0"Then the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user0"And the response should contain only "1" commentsAnd As "user0" delete the created comment it should return "204"And As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain only "0" commentsScenario: Deleting my own comments on a file shared by somebody else Given user "user0" existsGiven user "user1" existsGiven As an "user0"Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 |Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"Then the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user1"And the response should contain only "1" commentsAnd As "user1" delete the created comment it should return "204"And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain only "0" commentsScenario: Deleting my own comments on a file unshared by someone else Given user "user0" existsGiven user "user1" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 |Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"Then the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user1"And the response should contain only "1" commentsAnd As "user0" remove all shares from the file named "/myFileToComment.txt"And As "user1" delete the created comment it should return "404"And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"Scenario: Edit my own comments on a file belonging to myself Given user "user0" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"Then the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user0"And the response should contain only "1" commentsWhen As "user0" edit the last created comment and set text to "My edited comment" it should return "207"Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My edited comment"And the response should contain a property "oc:actorDisplayName" with value "user0"Scenario: Edit my own comments on a file shared by someone with me Given user "user0" existsGiven user "user1" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 |Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"Then the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user1"And the response should contain only "1" commentsGiven As "user1" edit the last created comment and set text to "My edited comment" it should return "207"Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My edited comment"And the response should contain a property "oc:actorDisplayName" with value "user1"Scenario: Edit my own comments on a file unshared by someone with me Given user "user0" existsGiven user "user1" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 |When "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user1"And the response should contain only "1" commentsAnd As "user0" remove all shares from the file named "/myFileToComment.txt"When As "user1" edit the last created comment and set text to "My edited comment" it should return "404"Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"And the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user1"Scenario: Edit comments of other users should not be possible Given user "user0" existsGiven user "user1" existsGiven User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with | path | myFileToComment.txt | | shareWith | user1 | | shareType | 0 |Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"Then the response should contain a property "oc:parentId" with value "0"And the response should contain a property "oc:childrenCount" with value "0"And the response should contain a property "oc:verb" with value "comment"And the response should contain a property "oc:actorType" with value "users"And the response should contain a property "oc:objectType" with value "files"And the response should contain a property "oc:message" with value "My first comment"And the response should contain a property "oc:actorDisplayName" with value "user1"And the response should contain only "1" commentsThen As "user0" edit the last created comment and set text to "My edited comment" it should return "403"