Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git,.gitignore,.gitattributes,*.svg,vendor,*.lock,.codespellrc,CHANGELOG.md,*/dkim_signing/*,*/postfix-bounce.msg,*/signing.key
check-hidden = true
# ignore-regex =
# checkin - method name in connection_pool.rb (not "checking"/"check in")
ignore-words-list = checkin
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ If applicable, add screenshots to help explain your problem.

## Additional information/context

Add any other context about the problem here. It is particularily useful to include log extracts (after removing private information).
Add any other context about the problem here. It is particularly useful to include log extracts (after removing private information).
23 changes: 23 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Codespell configuration is within .codespellrc
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6
- name: Codespell
uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # v2.2
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Layout/EmptyLinesAroundModuleBody:

# Space is required following -> when writing a lambda:
#
# somethign = -> (var) { block }
# something = -> (var) { block }
Layout/SpaceInLambdaLiteral:
EnforcedStyle: require_space

Expand Down Expand Up @@ -115,7 +115,7 @@ Lint/BooleanSymbol:
Style/SymbolProc:
Enabled: false

# Allow a maxmium of 5 arguments and don't include keyword arguments
# Allow a maximum of 5 arguments and don't include keyword arguments
Metrics/ParameterLists:
Max: 5
CountKeywordArgs: false
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ This version of Postal introduces a number of larger changes. Please be sure to
* **rubocop:** Lint/UselessAssignment ([7590a46](https://github.com/postalserver/postal/commit/7590a462341bddd412e660db9546ba1909aea9d7))
* **rubocop:** Naming/FileName ([919a601](https://github.com/postalserver/postal/commit/919a60116c5d81ed787061ff4614da4f1e067d4e))
* **rubocop:** Naming/MemoizedInstanceVariableName ([9563f30](https://github.com/postalserver/postal/commit/9563f30c96fba12073e845319b8d79a542d88109))
* **rubocop:** relax method length and block nexting for now ([b0ac9ef](https://github.com/postalserver/postal/commit/b0ac9ef0b96ab78c2961f45b6e9f20f87a6f1d07))
* **rubocop:** relax method length and block nesting for now ([b0ac9ef](https://github.com/postalserver/postal/commit/b0ac9ef0b96ab78c2961f45b6e9f20f87a6f1d07))
* **rubocop:** remaining offences ([ec63666](https://github.com/postalserver/postal/commit/ec636661d5c4b9e8f48e6f263ffef834acb68b39))
* **rubocop:** Security/YAMLLoad ([389ea77](https://github.com/postalserver/postal/commit/389ea7705047bf8700836137514b2497af3c6c01))
* **rubocop:** Style/AndOr ([b9f3f31](https://github.com/postalserver/postal/commit/b9f3f313f8ec992917bad3a51f0481f89675e935))
Expand Down Expand Up @@ -469,7 +469,7 @@ This version of Postal introduces a number of larger changes. Please be sure to
- Fix to newline conversion process ([9f4ef8](https://github.com/postalserver/postal/commit/9f4ef8f57a839c5529b4f00a36b832740386b4ed))
- Remove custom scrollbars ([b22f1b](https://github.com/postalserver/postal/commit/b22f1bdb2e2d66b096ca993d6a5f4f708274a4a2))
- Truncate 'output' field to avoid overflowing varchar(512) in database ([a188a1](https://github.com/postalserver/postal/commit/a188a161cbdcfd70158b09b53cef622842357c26))
- Fix link replacement in multipart messsages ([7ea00d](https://github.com/postalserver/postal/commit/7ea00dfa3bc3c7650cc2b134beacbff22101a913))
- Fix link replacement in multipart messages ([7ea00d](https://github.com/postalserver/postal/commit/7ea00dfa3bc3c7650cc2b134beacbff22101a913))
- Fix confusing error message when deleting IP pools ([cefc7d](https://github.com/postalserver/postal/commit/cefc7d17b82f610001859a8e323ee1dfde149ba5))
- Connect to correct IP rather than hostname suring SMTP delivery ([159509](https://github.com/postalserver/postal/commit/159509a3ed29ae33cba522b255904992922dcfdf))
- Change retry timings to avoid re-sending messages too early ([c8d27b](https://github.com/postalserver/postal/commit/c8d27b2963af122d6555abdf0742d2d2d6f11ce5))
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ openssl genrsa -out config/postal/signing.key 2048

If you're running the tests (and you probably should be), you'll find an example file for test configuration in `config/examples/test.yml`. This should be placed in `config/postal/postal.test.yml` with the appropriate values.

If you prefer, you can configure Postal using environment variables. These should be placed in `.env` or `.env.test` as apprpriate.
If you prefer, you can configure Postal using environment variables. These should be placed in `.env` or `.env.test` as appropriate.

## Running

Expand Down
2 changes: 1 addition & 1 deletion app/lib/message_dequeuer/incoming_message_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def inspect_message
def fail_if_spam
return if queued_message.message.spam_score < queued_message.server.spam_failure_threshold

log "message has a spam score higher than the server's maxmimum, hard failing", server_threshold: queued_message.server.spam_failure_threshold
log "message has a spam score higher than the server's maximum, hard failing", server_threshold: queued_message.server.spam_failure_threshold
create_delivery "HardFail",
details: "Message's spam score is higher than the failure threshold for this server. " \
"Threshold is currently #{queued_message.server.spam_failure_threshold}."
Expand Down
2 changes: 1 addition & 1 deletion app/lib/smtp_client/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def start_smtp_session(source_ip_address: nil, allow_ssl: true)
end

# Send a message to the current SMTP session (or create one if there isn't one for this endpoint).
# If sending messsage encouters some connection errors, retry again after re-establishing the SMTP
# If sending message encounters some connection errors, retry again after re-establishing the SMTP
# session.
#
# @param raw_message [String] the raw message to send
Expand Down
2 changes: 1 addition & 1 deletion app/lib/smtp_server/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def finished
msg.bounce = 1
end
else
# There's no return path route, we just need to insert the mesage
# There's no return path route, we just need to insert the message
# without going through the route.
message = server.message_db.new_message
message.rcpt_to = rcpt_to
Expand Down
2 changes: 1 addition & 1 deletion app/lib/smtp_server/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def register_prometheus_metrics
labels: [:type, :error]

register_prometheus_counter :postal_smtp_server_tls_connections_total,
docstring: "The number of successfuly TLS connections established"
docstring: "The number of successfully TLS connections established"

Client.register_prometheus_metrics
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/bounce_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def body
For further assistance please contact #{postmaster_address}. Please include the details below to help us identify the issue.

Message Token: #{@message.token}@#{@server.token}
Orginal Message ID: #{@message.message_id}
Original Message ID: #{@message.message_id}
Mail from: #{@message.mail_from}
Rcpt To: #{@message.rcpt_to}
BODY
Expand Down
8 changes: 4 additions & 4 deletions app/senders/smtp_sender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SMTPSender < BaseSender

attr_reader :endpoints

# @param domain [String] the domain to send mesages to
# @param domain [String] the domain to send messages to
# @param source_ip_address [IPAddress] the IP address to send messages from
# @param log_id [String] an ID to use when logging requests
def initialize(domain, source_ip_address = nil, servers: nil, log_id: nil, rcpt_to: nil)
Expand All @@ -15,7 +15,7 @@ def initialize(domain, source_ip_address = nil, servers: nil, log_id: nil, rcpt_

# An array of servers to forcefully send the message to
@servers = servers
# Stores all connection errors which we have seen during this send sesssion.
# Stores all connection errors which we have seen during this send session.
@connection_errors = []
# Stores all endpoints that we have attempted to deliver mail to
@endpoints = []
Expand Down Expand Up @@ -57,7 +57,7 @@ def send_message(message)
mail_from = determine_mail_from_for_message(message)
raw_message = message.raw_message

# Append the Resent-Sender header to the mesage to include the
# Append the Resent-Sender header to the message to include the
# MAIL FROM if the installation is configured to use that?
if Postal::Config.postal.use_resent_sender_header?
raw_message = "Resent-Sender: #{mail_from}\r\n" + raw_message
Expand Down Expand Up @@ -168,7 +168,7 @@ def resolve_mx_records_for_domain
hostnames.map { |hostname| SMTPClient::Server.new(hostname) }
end

# Attempt to begin an SMTP sesssion for the given endpoint. If successful, this endpoint
# Attempt to begin an SMTP session for the given endpoint. If successful, this endpoint
# becomes the current endpoints for the SMTP sender.
#
# Returns true if the session was established.
Expand Down
2 changes: 1 addition & 1 deletion app/views/domains/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
= f.select :verification_method, Domain::VERIFICATION_METHODS, {}, :class => 'input input--select'
.fieldSet__text
Choose how you'd like to verify your ownership of this domain. If you choose <b>E-Mail</b> we can send you
an email with a code whcih you'll need to enter - you can choose from a set of pre-defined addresses for
an email with a code which you'll need to enter - you can choose from a set of pre-defined addresses for
the domain. Using <b>DNS</b> you'll need to add a TXT record on this domain using your DNS provider.

.fieldSetSubmit
Expand Down
2 changes: 1 addition & 1 deletion app/views/messages/spam_checks.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
.noData.noData--clean
%h2.noData__title This message doesn't have any spam checks.
%p.noData__text
This likely means we haven't scanned this message to determine its likelyhood
This likely means we haven't scanned this message to determine its likelihood
of being spam. It may take a few seconds to appear after a new message is
received.

Expand Down
2 changes: 1 addition & 1 deletion doc/config/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ By default, tests will use the `config/postal/postal.test.yml` configuration fil

## Containers

Within a container, Postal will for a config file in `/config/postal.yml` unless overriden by the `POSTAL_CONFIG_FILE_PATH` environment variable.
Within a container, Postal will for a config file in `/config/postal.yml` unless overridden by the `POSTAL_CONFIG_FILE_PATH` environment variable.

## Ports & Bind Addresses

Expand Down
8 changes: 4 additions & 4 deletions doc/config/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ This document contains all the environment variables which are available for thi
| `POSTAL_TRUSTED_PROXIES` | Array of strings | An array of IP addresses to trust for proxying requests to Postal (in addition to localhost addresses) | [] |
| `POSTAL_QUEUED_MESSAGE_LOCK_STALE_DAYS` | Integer | The number of days after which to consider a lock as stale. Messages with stale locks will be removed and not retried. | 1 |
| `POSTAL_BATCH_QUEUED_MESSAGES` | Boolean | When enabled queued messages will be de-queued in batches based on their destination | true |
| `WEB_SERVER_DEFAULT_PORT` | Integer | The default port the web server should listen on unless overriden by the PORT environment variable | 5000 |
| `WEB_SERVER_DEFAULT_BIND_ADDRESS` | String | The default bind address the web server should listen on unless overriden by the BIND_ADDRESS environment variable | 127.0.0.1 |
| `WEB_SERVER_DEFAULT_PORT` | Integer | The default port the web server should listen on unless overridden by the PORT environment variable | 5000 |
| `WEB_SERVER_DEFAULT_BIND_ADDRESS` | String | The default bind address the web server should listen on unless overridden by the BIND_ADDRESS environment variable | 127.0.0.1 |
| `WEB_SERVER_MAX_THREADS` | Integer | The maximum number of threads which can be used by the web server | 5 |
| `WORKER_DEFAULT_HEALTH_SERVER_PORT` | Integer | The default port for the worker health server to listen on | 9090 |
| `WORKER_DEFAULT_HEALTH_SERVER_BIND_ADDRESS` | String | The default bind address for the worker health server to listen on | 127.0.0.1 |
Expand All @@ -46,8 +46,8 @@ This document contains all the environment variables which are available for thi
| `GELF_HOST` | String | GELF-capable host to send logs to | |
| `GELF_PORT` | Integer | GELF port to send logs to | 12201 |
| `GELF_FACILITY` | String | The facility name to add to all log entries sent to GELF | postal |
| `SMTP_SERVER_DEFAULT_PORT` | Integer | The default port the SMTP server should listen on unless overriden by the PORT environment variable | 25 |
| `SMTP_SERVER_DEFAULT_BIND_ADDRESS` | String | The default bind address the SMTP server should listen on unless overriden by the BIND_ADDRESS environment variable | :: |
| `SMTP_SERVER_DEFAULT_PORT` | Integer | The default port the SMTP server should listen on unless overridden by the PORT environment variable | 25 |
| `SMTP_SERVER_DEFAULT_BIND_ADDRESS` | String | The default bind address the SMTP server should listen on unless overridden by the BIND_ADDRESS environment variable | :: |
| `SMTP_SERVER_DEFAULT_HEALTH_SERVER_PORT` | Integer | The default port for the SMTP server health server to listen on | 9091 |
| `SMTP_SERVER_DEFAULT_HEALTH_SERVER_BIND_ADDRESS` | String | The default bind address for the SMTP server health server to listen on | 127.0.0.1 |
| `SMTP_SERVER_TLS_ENABLED` | Boolean | Enable TLS for the SMTP server (requires certificate) | false |
Expand Down
8 changes: 4 additions & 4 deletions doc/config/yaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ postal:
batch_queued_messages: true

web_server:
# The default port the web server should listen on unless overriden by the PORT environment variable
# The default port the web server should listen on unless overridden by the PORT environment variable
default_port: 5000
# The default bind address the web server should listen on unless overriden by the BIND_ADDRESS environment variable
# The default bind address the web server should listen on unless overridden by the BIND_ADDRESS environment variable
default_bind_address: 127.0.0.1
# The maximum number of threads which can be used by the web server
max_threads: 5
Expand Down Expand Up @@ -99,9 +99,9 @@ gelf:
facility: postal

smtp_server:
# The default port the SMTP server should listen on unless overriden by the PORT environment variable
# The default port the SMTP server should listen on unless overridden by the PORT environment variable
default_port: 25
# The default bind address the SMTP server should listen on unless overriden by the BIND_ADDRESS environment variable
# The default bind address the SMTP server should listen on unless overridden by the BIND_ADDRESS environment variable
default_bind_address: ::
# The default port for the SMTP server health server to listen on
default_health_server_port: 9091
Expand Down
8 changes: 4 additions & 4 deletions lib/postal/config_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ module Postal

group :web_server do
integer :default_port do
description "The default port the web server should listen on unless overriden by the PORT environment variable"
description "The default port the web server should listen on unless overridden by the PORT environment variable"
default 5000
end

string :default_bind_address do
description "The default bind address the web server should listen on unless overriden by the BIND_ADDRESS environment variable"
description "The default bind address the web server should listen on unless overridden by the BIND_ADDRESS environment variable"
default "127.0.0.1"
end

Expand Down Expand Up @@ -243,12 +243,12 @@ module Postal

group :smtp_server do
integer :default_port do
description "The default port the SMTP server should listen on unless overriden by the PORT environment variable"
description "The default port the SMTP server should listen on unless overridden by the PORT environment variable"
default 25
end

string :default_bind_address do
description "The default bind address the SMTP server should listen on unless overriden by the BIND_ADDRESS environment variable"
description "The default bind address the SMTP server should listen on unless overridden by the BIND_ADDRESS environment variable"
default "::"
end

Expand Down
4 changes: 2 additions & 2 deletions lib/postal/message_db/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def original_messages
end

#
# Was thsi message sent to a return path?
# Was this message sent to a return path?
#
def rcpt_to_return_path?
!!(rcpt_to =~ /@#{Regexp.escape(Postal::Config.dns.custom_return_path_prefix)}\./)
Expand Down Expand Up @@ -552,7 +552,7 @@ def cancel_hold
def parse_content
parse_result = Postal::MessageParser.new(self)
if parse_result.actioned?
# Somethign was changed, update the raw message
# Something was changed, update the raw message
@database.update(raw_table, { data: parse_result.new_body }, where: { id: raw_body_id })
@database.update(raw_table, { data: parse_result.new_headers }, where: { id: raw_headers_id })
@raw = parse_result.new_body
Expand Down
2 changes: 1 addition & 1 deletion lib/tracking_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def dispatch_image_request(request, server_token, message_token)
rescue Postal::MessageDB::Message::NotFound
# This message has been removed, we'll just continue to serve the image
rescue StandardError => e
# Somethign else went wrong. We don't want to stop the image loading though because
# Something else went wrong. We don't want to stop the image loading though because
# this is our problem. Log this exception though.
Sentry.capture_exception(e) if defined?(Sentry)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/examples/full_legacy_config_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# less than v3. It remains supported in v3+ by mapping these values to their
# correct values. Support for this file format will be removed in Postal v4.
#
# It exists here for reference but also to faciliate testing to ensure the
# It exists here for reference but also to facilitate testing to ensure the
# legacy mapping works as expected
version: 1

Expand Down
4 changes: 2 additions & 2 deletions spec/lib/message_dequeuer/incoming_message_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ module MessageDequeuer

it "logs" do
processor.process
expect(logger).to have_logged(/message has a spam score higher than the server's maxmimum/)
expect(logger).to have_logged(/message has a spam score higher than the server's maximum/)
end

it "sets the message status to HardFail" do
Expand Down Expand Up @@ -605,7 +605,7 @@ module MessageDequeuer
end
end

context "when an exception occurrs during processing" do
context "when an exception occurs during processing" do
let(:endpoint) { create(:smtp_endpoint, server: server) }
let(:route) { create(:route, server: server, mode: "Endpoint", endpoint: endpoint) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ module MessageDequeuer
end
end

context "when an exception occurrs during processing" do
context "when an exception occurs during processing" do
before do
smtp_sender_mock = double("SMTPSender")
allow(SMTPSender).to receive(:new).and_return(smtp_sender_mock)
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/postal/legacy_config_source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Postal

SOURCE_CONFIG = YAML.safe_load(File.read(Rails.root.join("spec/examples/full_legacy_config_file.yml")))

# Rather than actuall test the LegacyConfigSource directly, I have decided
# Rather than actually test the LegacyConfigSource directly, I have decided
# to test this source via. the Konfig::Config system to ensure it works as
# expected in practice rather than just in theory. Testing '#get' would be
# fairly easy (and mostly pointless) where as testing the values we actually
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/postal/message_db/connection_pool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
expect(pool.connections).to eq [connection]
end

it "checks in a connection if theres an error in the block" do
it "checks in a connection if there's an error in the block" do
expect do
pool.use do
raise StandardError
Expand Down
2 changes: 1 addition & 1 deletion spec/models/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
end
end

context "whent he IP pool does belong to the the same organization" do
context "when the IP pool does belong to the the same organization" do
before do
org.ip_pools << ip_pool
end
Expand Down
Loading