Skip to content
Merged
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
5 changes: 4 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Issue


## Solution

## Checklist
- [ ] I have added or updated any relevant documentation.
- [ ] I have cleaned any remaining cloud resources from my accounts.
44 changes: 44 additions & 0 deletions .github/workflows/tiobe_scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

name: Weekly TICS scan

on:
schedule:
- cron: "0 2 * * 6" # Every Saturday 2:00 AM UTC
workflow_dispatch:

jobs:
TICS:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create and activate virtual environment
run: |
python3 -m venv .venv
. .venv/bin/activate
pip install flake8 poetry pylint pytest tox
poetry install --all-groups
echo PATH="$PATH" >> "$GITHUB_ENV"

- name: Run coverage tests
run: |
tox -e unit

- name: Move results to the necessary folder for TICS
run: |
mkdir -p .cover
mv coverage.xml .cover/cobertura.xml

- name: TICS GitHub Action
uses: tiobe/tics-github-action@v3
with:
mode: qserver
project: postgresql-k8s-operator
viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default
branchdir: ${{ env.GITHUB_WORKSPACE }}
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
installTics: true
calc: ALL
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,24 @@ juju relate postgresql-k8s:db finos-waltz-k8s
**Note:** The endpoint `db-admin` provides the same legacy interface `pgsql` with PostgreSQL admin-level privileges. It is NOT recommended to use it from security point of view.

## OCI Images

This charm uses pinned and tested version of the [charmed-postgresql](https://github.com/canonical/charmed-postgresql-rock/pkgs/container/charmed-postgresql) rock.

## Security
Security issues in the Charmed PostgreSQL K8s Operator can be reported through [LaunchPad](https://wiki.ubuntu.com/DebuggingSecurity#How%20to%20File). Please do not file GitHub issues about security issues.

Security issues in the Charmed PostgreSQL K8s Operator can be reported through [private security reports](https://github.com/canonical/postgresql-k8s-operator/security/advisories/new) on GitHub.
For more information, see the [Security policy](SECURITY.md).

## Contributing

Please see the [Juju SDK docs](https://juju.is/docs/sdk) for guidelines on enhancements to this charm following best practice guidelines, and [CONTRIBUTING.md](https://github.com/canonical/postgresql-k8s-operator/blob/main/CONTRIBUTING.md) for developer guidance.

## License

The Charmed PostgreSQL K8s Operator [is distributed](https://github.com/canonical/postgresql-k8s-operator/blob/main/LICENSE) under the Apache Software License, version 2.0.
It installs/operates/depends on [PostgreSQL](https://www.postgresql.org/ftp/source/), which [is licensed](https://www.postgresql.org/about/licence/) under PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.

## Trademark Notice

PostgreSQL is a trademark or registered trademark of PostgreSQL Global Development Group.
Other trademarks are property of their respective owners.
25 changes: 25 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Security policy

## What qualifies as a security issue

Credentials leakage, outdated dependencies with known vulnerabilities, and
other issues that could lead to unprivileged or unauthorized access to the
database or the system.

## Reporting a vulnerability

The easiest way to report a security issue is through
[GitHub](https://github.com/canonical/postgresql-k8s-operator/security/advisories/new). See
[Privately reporting a security
vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)
for instructions.

The repository admins will be notified of the issue and will work with you
to determine whether the issue qualifies as a security issue and, if so, in
which component. We will then handle figuring out a fix, getting a CVE
assigned and coordinating the release of the fix.

The [Ubuntu Security disclosure and embargo
policy](https://ubuntu.com/security/disclosure-policy) contains more
information about what you can expect when you contact us, and what we
expect from you.
5 changes: 4 additions & 1 deletion lib/charms/postgresql_k8s/v0/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 48
LIBPATCH = 49

# Groups to distinguish HBA access
ACCESS_GROUP_IDENTITY = "identity_access"
Expand Down Expand Up @@ -626,6 +626,7 @@ def list_access_groups(self) -> Set[str]:
Returns:
List of PostgreSQL database access groups.
"""
connection = None
try:
with self._connect_to_database() as connection, connection.cursor() as cursor:
cursor.execute(
Expand All @@ -646,6 +647,7 @@ def list_users(self) -> Set[str]:
Returns:
List of PostgreSQL database users.
"""
connection = None
try:
with self._connect_to_database() as connection, connection.cursor() as cursor:
cursor.execute("SELECT usename FROM pg_catalog.pg_user;")
Expand All @@ -664,6 +666,7 @@ def list_users_from_relation(self) -> Set[str]:
Returns:
List of PostgreSQL database users.
"""
connection = None
try:
with self._connect_to_database() as connection, connection.cursor() as cursor:
cursor.execute(
Expand Down
74 changes: 37 additions & 37 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires-poetry = ">=2.0.0"
[tool.poetry.dependencies]
python = "^3.10"
ops = "^2.18.1"
boto3 = "^1.35.99"
boto3 = "^1.37.22"
pgconnstr = "^1.0.1"
requests = "^2.32.3"
tenacity = "^9.0.0"
Expand Down
Loading
Loading