Skip to content

Commit 948cde9

Browse files
The visibility of the posts can now be configured via the configuration file (fedivuln/conf.py).
The value in the default configuration for the posts related to security advisories is set to ``unlisted``.o
1 parent 12f4550 commit 948cde9

5 files changed

Lines changed: 26 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Release 1.4.0 (2026-01-08)
4+
5+
The visibility of the posts can now be configured via the configuration file (``fedivuln/conf.py``).
6+
The value in the default configuration for the posts related to security advisories is set to ``unlisted``.
7+
8+
39
## Release 1.3.3 (2026-01-08)
410

511
Improved the display of the datePublished from cveMetadata.

‎fedivuln/conf_sample.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
"on Vulnerability-Lookup:\n<LINK>\n\n#VulnerabilityLookup #Vulnerability #Cybersecurity #bot",
3030
}
3131

32+
# The visibility of the status to posts is configarable per type of posts.
33+
status_visibility = {
34+
"vulnerability": "unlisted",
35+
"comment": "public",
36+
"bundle": "public",
37+
"sighting": "private",
38+
}
39+
3240

3341
# Regular expression to match CVE, GHSA, and PySec IDs
3442
vulnerability_patterns = re.compile(

‎fedivuln/config.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def load_config(path):
3232
mastodon_clientcred = conf.mastodon_clientcred
3333
mastodon_usercred = conf.mastodon_usercred
3434
templates = conf.templates
35+
status_visibility = conf.status_visibility
3536

3637
vulnerability_patterns = conf.vulnerability_patterns
3738

‎fedivuln/publish.py‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ async def create_status_content(event_data: str, topic: str) -> str:
135135
# ### Streaming functions
136136

137137

138-
def publish(message: str) -> None:
138+
def publish(message: str, visibility: str = "public") -> None:
139139
if message:
140140
print(message)
141141
try:
142-
mastodon.status_post(message)
142+
mastodon.status_post(message, visibility)
143143
except MastodonAPIError as e:
144144
print(
145145
f"Mastodon instance returned MastodonAPIError - the server has decided it can't fulfil your request: {str(e)}"
@@ -178,7 +178,10 @@ def listen_to_http_event_stream(url, headers=None, params=None, topic="comment")
178178
event_data = json.loads(data_line)
179179
# print("Received JSON message:")
180180
# print(message)
181-
publish(create_status_content_sync(event_data, topic))
181+
publish(
182+
create_status_content_sync(event_data, topic),
183+
config.status_visibility[topic],
184+
)
182185
except json.JSONDecodeError:
183186
# Handle plain text messages
184187
print(f"Received plain message: {data_line}")
@@ -244,7 +247,10 @@ def main():
244247
if arguments.valkey:
245248
for elem in listen_to_valkey_stream(topic=arguments.topic):
246249
event_data = json.loads(elem)
247-
publish(create_status_content_sync(event_data, arguments.topic))
250+
publish(
251+
create_status_content_sync(event_data, arguments.topic),
252+
config.status_visibility[arguments.topic],
253+
)
248254
else:
249255
combined = urljoin(config.vulnerability_lookup_base_url, "pubsub/subscribe/")
250256
full_url = urljoin(combined, arguments.topic)

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
55

66
[project]
77
name = "FediVuln"
8-
version = "1.3.3"
8+
version = "1.4.0"
99
description = "A client to gather vulnerability-related information from the Fediverse."
1010
authors = [
1111
{name = "Cédric Bonhomme", email = "cedric.bonhomme@circl.lu"}

0 commit comments

Comments
 (0)