1770 Commits

Author SHA1 Message Date
rofl0r
3c0fde9498 reqs: fix integer overflow in port number processing
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
shellcheck / Shellcheck (push) Has been cancelled
closes #586
2025-10-17 22:57:39 +00:00
rofl0r
f0033b733b tinyproxy.conf.5: add an IPv6 example to allow/deny section
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
closes #578
2025-06-21 10:50:29 +00:00
tangaac
8b02f86ce0 remove redundant config_directive_entry CD_NIL
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
2025-05-07 14:47:44 +02:00
rofl0r
d54e9a7a04 remove unused strlcat checks and fallback code
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
the function isn't used anywhere in the current codebase, so don't
waste user's time checking for it.
2025-05-01 16:41:11 +00:00
rofl0r
d62b7d2871 remove unused vsyslog code
due to the use of an invalid macro HAVE_VSYSLOG_H (a corresponding
header doesn't exist on POSIX libcs, plus there was no configure
check setting it), the code here was never compiled in, and the
portable fallback was always used. since the fallback is already
there and known to work as intended, just use it always.

closes #574
2025-05-01 16:36:57 +00:00
Michael Adam
0a2da97328 tests: remove duplicate code from run_tests.sh
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
Signed-off-by: Michael Adam <obnox@samba.org>
2025-02-15 12:37:29 +01:00
Michael Adam
1a02315ce1 CI: add a shellcheck ci workflow
Signed-off-by: Michael Adam <obnox@samba.org>
2025-02-15 12:37:29 +01:00
Michael Adam
acd99f15b9 build: add make shellcheck
This can be used to lint shell scripts
for syntactic correctness and style.

It requires shellcheck to be installed on the host.

Signed-off-by: Michael Adam <obnox@samba.org>
2025-02-15 12:37:29 +01:00
Michael Adam
f1347866a0 tests: fix shellcheck issues in run_tests_valgrind.sh
This fixes instances of:

https://shellcheck.net/wiki/SC2086 (info): Double quote to prevent globbing and word splitting.
https://shellcheck.net/wiki/SC2034 (warning): BASEDIR appears unused.

Signed-off-by: Michael Adam <obnox@samba.org>
2025-02-15 12:37:29 +01:00
Michael Adam
0712ec33ad tests: fix shellcheck issues and syntax errors in run_tests.sh
This fixes several instances of the following shellcheck issues:

https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitting.
https://shellcheck.net/wiki/SC3037 (warning): In POSIX sh, echo flags are undefined.
https://shellchelleck.net/wiki/SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a purpose.
https://shellcheck.net/wiki/SC2009 (info): Consider using pgrep instead of grepping ps output.
https://shellcheck.net/wiki/SC3028 (warning): In POSIX sh, SECONDS is undefined.
SC2059 (info): Don't use variables in the printf format string
 COUNT appears unused. Verify use (or export if used externally).
https://shellcheck.net/wiki/SC2162 (info): read without -r will mangle backslashes.
https://shellcheck.net/wiki/SC2034 (warning): READ appears unused. Verify use (or export if used externally).
https://shellcheck.net/wiki/SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
https://shellcheck.net/wiki/SC2086 (info): Double quote to prevent globbing and word splitting.

Signed-off-by: Michael Adam <obnox@samba.org>

tests: fix syntax errors in run_tests.sh

Signed-off-by: Michael Adam <obnox@samba.org>
2025-02-15 12:37:29 +01:00
Michael Adam
74f5f593bb build: fix shellcheck errors in autogen.sh
The following error types are addressed:

https://www.shellcheck.net/wiki/SC2164 -- Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing and word splitting.
  https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of legacy backticks `...`.

Signed-off-by: Michael Adam <obnox@samba.org>
2025-02-15 12:37:29 +01:00
rofl0r
56404a3dd6 replace orderedmap for connection headers with linear list
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
it turned out that a hashmap isn't the right datastructure, as the
special-case header Set-Cookie not only can, but is even heavily
recommended to be used multiple times.

we now use a dumb list as a key-value store for this purpose, but
restrict it to max 256 entries so the linear search can always be
completed in reasonable time in case of an attack.

closes #403
2025-01-22 16:33:13 +01:00
rofl0r
cea0ebe657 tinyproxy.conf.5: explain what a site_spec looks like
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
2025-01-06 19:25:57 +00:00
rofl0r
05f6e4e000 basic auth: fix error status 401 vs 407
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
if tinyproxy serves as a HTTP server (i.e. when serving stats),
use error code 401, else error code 407.

fixes #532
2024-11-04 12:57:04 +01:00
rofl0r
c04ba4711a reqs: don't compile upstream code if feature disabled
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
fixes warning about implicit function declaration which is by default
treated as an error starting with GCC14.

closes #560
2024-10-19 09:26:37 +00:00
Robert Grumann
73da8a35a3 conf: add BasicAuthRealm feature (#547)
Some checks failed
CI / test (push) Has been cancelled
CI / test-macos (push) Has been cancelled
CI / valgrind-test (push) Has been cancelled
makes BasicAuth realm string editable in config file.

closes #235
2024-07-14 13:38:25 +02:00
James McKinney
d652ed8538 Omit the version number from headers and HTML responses (#543)
Omit the version number from headers, HTML responses, and templates
2024-06-20 10:51:29 +02:00
rofl0r
72b93f6d4b CI: update release workflow to non-deprecated actions
github continues to deprecate actions and idioms in their CI system.
hopefully these changes will last for a while and maintaining a simple
CI task doesn't turn into a neverending story.
2024-06-16 13:12:25 +00:00
Mohamed Akram
942d0c6b03 Use appropriate installation path variables 2024-06-02 20:42:49 +02:00
rofl0r
dd49e975a0 release 1.11.2 1.11.2 2024-05-08 18:22:55 +00:00
rofl0r
e69788b761 Add SECURITY.md
given the catastrophic way TALOS Intelligence "communicated" with upstream
(i.e. by probably sending a single mail to an unused email address),
it's probably best to explicitly document how to approach upstream
when a security issue is discovered.
2024-05-05 20:56:17 +02:00
rofl0r
12a8484265 fix potential UAF in header handling (CVE-2023-49606)
https://talosintelligence.com/vulnerability_reports/TALOS-2023-1889

this bug was brought to my attention today by the debian tinyproxy
package maintainer. the above link states that the issue was known
since last year and that maintainers have been contacted, but if
that is even true then it probably was done via a private email
to a potentially outdated email address of one of the maintainers,
not through the channels described clearly on the tinyproxy homepage:

> Feel free to report a new bug or suggest features via github issues.
> Tinyproxy developers hang out in #tinyproxy on irc.libera.chat.

no github issue was filed, and nobody mentioned a vulnerability on
the mentioned IRC chat. if the issue had been reported on github or
IRC, the bug would have been fixed within a day.
2024-05-05 10:37:29 +00:00
rofl0r
92289d5a4c main: print filename of config file used on (re)load 2024-05-01 23:48:37 +00:00
strongleong
c4df45b7e4 BasicAuth: Added logging for failed login attemps
closes #514
2023-11-12 15:05:38 +00:00
Victor Kislov
84285b640d BasicAuth: Accept special chars in username and password (#516)
Co-authored-by: Victor Kislov <victork@primis.tech>
2023-11-02 19:24:42 +00:00
rofl0r
c834073968 fix CI by running apt update 2023-10-16 00:06:15 +01:00
rofl0r
1289d8afc8 conf: use case-independent match for Filtertype parameter 2023-10-13 19:54:26 +00:00
rofl0r
2935519eb7 fix omission to reset socklen parameter for accept()
since accept() uses the socklen parameter as in/out, after processing
an IPv4 the socklen fed to it waiting for the next client was only
the length of sockaddr_in, so if a connection from an IPv6 came in
the client sockaddr was only partially filled in.
this caused wrongly printed ipv6 addresses in log, and failure to
match them correctly against the acl.

closes #495
2023-06-07 18:57:05 +00:00
rofl0r
d7c20e663f tinyproxy.conf.5: document syntax for upstream IPv6 addresses
follow-up to 2bec15ee40
2023-05-25 19:42:02 +00:00
ivanwick
1e615e66a9 tinyproxy.conf.5: document config strings that require double quotes (#493)
* tinyproxy.conf.5: document config strings that require double quotes

String config values matched by the STR regex must be enclosed in double
quotes

Edit descriptions for brevity

conf.c: move boolean arguments comment before BOOL group

addresses #491

* Revert conf.c: move boolean arguments comment before BOOL group
2023-05-24 15:06:15 +01:00
Mario-Klebsch
2bec15ee40 Allow configuring IPv6 address for upstream proxy (#492)
* Added support to configure IPv6 upstream proxy servers using bracket syntax.
* Added regular expression for IPv6 scope identifier to re for IPv6 address.
2023-05-23 14:04:48 +01:00
rofl0r
ef60434b39 docs: typo fix
closes #487
2023-03-20 20:36:01 +00:00
rofl0r
31339cb161 tinyproxy.conf.5: update text for bind directive
the existing text was sort of misleading as it was written in a
pre-HTTPS era.

addressing #475
2023-02-01 15:46:58 +00:00
rofl0r
470cc0863d conf: fix potential crash with invalid input data
closes #474
2023-02-01 13:32:45 +00:00
rofl0r
6ffd9af2c7 hsearch: fix potential UB (pointer arithmetics on nullptr)
closes #471
addresses #470
2023-02-01 13:16:58 +00:00
rofl0r
3764b85514 prevent junk from showing up in error page in invalid requests
fixes #457
2022-09-08 15:18:04 +00:00
rofl0r
84f203fb1c fix reversepath directive using https url giving misleading error
it's not possible to use a https url in a ReversePath directive, without
removing the security provided by https, and would require adding a
dependency on a TLS library like openssl and a lot of code complexity
to fetch the requested resource via https and relay it back to the client.

in case the reversepath directive kicked in, but the protocol wasn't
recognized, and support for transparent proxying built-in, the code
wrongfully tried to turn the request into a trans request, leading
to a bogus rewritten url like http://localhost:8888https://www.endpoint.com
and an error message that we're trying to connect to the machine the
proxy runs on.

now instead use the generic code that signals an invalid protocol/url
was used.

closes #419
2022-08-20 14:43:24 +00:00
rofl0r
121be4a74e echo http protocol version on CONNECT request response
while at it, the function doing it was renamed from the misleading
ssl name to what it actually does.
also inlined the strings that were previously defined as macros.

addressing #152
2022-07-15 23:43:13 +00:00
rofl0r
8b373f804e update html documentation, add quickstart section 2022-05-30 19:10:27 +00:00
rofl0r
90adf28663 release 1.11.1 1.11.1 2022-05-27 14:08:03 +00:00
rofl0r
ea75e79609 CI: add github workflow to build release tarball 2022-05-27 14:06:16 +00:00
rofl0r
d6ee3835f0 configure: use release tarball provided gperf file 2022-05-27 14:06:16 +00:00
rofl0r
d9e38babb7 add gperf generated files to make dist 2022-05-27 14:06:16 +00:00
rofl0r
77cd87efef print error message if errorfile is configured but can't be opened
also, don't use fopen(NULL) if usage of errorfiles is not configured.
2022-05-27 12:48:41 +00:00
rofl0r
7d1e86ccae don't try to send 408 error to closed client socket
read_request_line() is exercised on the client's fd, and it fails
when the client closed the connection. therefore it's wrong
to send an error message to the client in this situation.
additionally, the error message states that the server closed
the connection.

might fix #383
2022-05-02 14:50:42 +00:00
rofl0r
235b1c10a7 implement filtertype keyword and fnmatch-based filtering
as suggested in #212, it seems the majority of people don't understand
that input was expected to be in regex format and people were using
filter lists containing plain hostnames, e.g. `www.google.com`.

apart from that, using fnmatch() for matching is actually a lot less
computationally expensive and allows to use big blacklists without
incurring a huge performance hit.

the config file now understands a new option `FilterType` which can
be one of `bre`, `ere` and `fnmatch`.
The `FilterExtended` option was deprecated in favor of it.
It still works, but will be removed in the release after the next.
2022-05-02 13:13:40 +00:00
Tristan Stenner
26db3f6cc9 Allow "XTinyProxy No" with xtinyproxy disabled 2022-05-02 08:32:54 +01:00
dr|z3d
14d31ed63f Prettify stats.html 2022-04-22 06:13:38 +00:00
rofl0r
c63028d675 bind_socket(): improve log output
bind_socket most often fails due to having wrong address family,
so it's helpful to see which one was used.
2022-03-01 15:17:32 +00:00
rofl0r
9718be09c1 reload_logging: fix returning possibly uninitialized value
introduced in 17d3733be3

may fix #422
2022-02-16 02:28:11 +00:00