Skip to main content

govtech-csg-xcg-securemodelpkid

This package belongs to the eXtended Code Guardrails (XCG) project, which consists of a series of packages that harden the Django web framework to prevent common web application vulnerabilities.

Specifically, the Secure Model PKID package provides mechanisms to generate random primary keys for Django model objects, as opposed to Django's default behaviour that uses an auto-incrementing integer value. The aim of this package is to prevent IDOR vulnerabilities.

Do note that the README in this repository is intentionally limited in scope and is catered towards developers. For detailed instructions on installation, usage, and community guidelines, please refer to the published documentation at https://xcg.tech.gov.sg.

For instructions on how to report a vulnerability, refer to the official documentation website.

Additionally, enable email alerts for security issues by "watching" this repository. The "watch" button can be found near the top right corner of this repo's home page, and there are various options for configuring notification volume. To receive security alerts, either enable notifications for "All Activity" or "Custom -> Security alerts".

Installing development dependencies

Before building or testing the package, or committing changes, install the development dependencies into a virtual environment:

# In the project root directory
python -m venv .venv && source .venv/bin/activate
pip install -r requirements-dev.txt

Building

The package can be built using build as the build frontend and setuptools as the build backend.

Run the build command below:

# In the project root directory
python -m build .

This creates a directory named dist/, which should contain 2 files:

  1. A .whl (wheel) file, which is a binary distribution format for Python packages
  2. A .tar.gz file, which is a source distribution format for Python packages

To view the source files included in the source distribution, use the tar utility as follows:

tar --list -f dist/<filename>.tar.gz

To install the package directly from either distribution files:

pip install <name_of_distribution_file>

Testing

As the tests for this package use multiple variants of the Django settings module, a convenience script has been provided for ease of running all test methods. Execute the tests using the commands below:

pip install -e . # Performs an "editable install" of the govtech-csg-xcg-securemodelpkid package
cd tests
/bin/bash run_all_tests.sh

Running pre-commit hooks

Note: This section is only relevant if you intend to contribute code

This project uses the pre-commit tool to run Git pre-commit hooks for linting and code quality checks. The pre-commit tool itself should have been installed along with the development dependencies. After cloning the repository for the first time, run the command below to "install" the Git hooks:

pre-commit install

The command above creates a file .git/hooks/pre-commit, which defines the shell commands to run before any Git commit is created.

Subsequently, any invocation of git commit will trigger the commands, rejecting the commit if there are linting errors. Issues should be automatically fixed, but you will need to re-stage the changes before attempting the commit again.

For a list of hooks run by pre-commit, see its configuration file.

Metadata

Release files for govtech-csg-xcg-securemodelpkid 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for govtech-csg-xcg-securemodelpkid 0.1.0
File Size Uploaded Provenance Actions
govtech-csg-xcg-securemodelpkid-0.1.0.tar.gz 18.4 kB Without provenance Details for govtech-csg-xcg-securemodelpkid-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for govtech-csg-xcg-securemodelpkid 0.1.0
File Interpreter ABI Platform Actions
govtech_csg_xcg_securemodelpkid-0.1.0-py3-none-any.whl Python 3 none any Details for govtech_csg_xcg_securemodelpkid-0.1.0-py3-none-any.whl

Total release size: 30.8 kB

Release files / govtech-csg-xcg-securemodelpkid-0.1.0.tar.gz

Download URL govtech-csg-xcg-securemodelpkid-0.1.0.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
324a4bb7e0040ed6f4c559a3fba1178ca3daa2ec47097887a50ef5041e282df3
BLAKE2b-256 checksum
How to use checksums
cb941ce34765a7c408e531a1d4639fe7d1c433b341ac8d654ea59f0afb133e7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / govtech_csg_xcg_securemodelpkid-0.1.0-py3-none-any.whl

Download URL govtech_csg_xcg_securemodelpkid-0.1.0-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0510466d663884e60b666198a617e73c4533755f662b2f7d0a75e0cc05665a75
BLAKE2b-256 checksum
How to use checksums
b59bfe13ec18dd638408ec1166640f4ba6ae916985f6412579f59b52c13dd348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for govtech-csg-xcg-securemodelpkid 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page