Skip to content

Add AGI/ASI governance artifacts, validation rules, and tests (Sentinel v2.4, 2026–2035 roadmap)#141

Open
OneFineStarstuff wants to merge 1 commit into
mainfrom
codex/develop-agi/asi-governance-implementation-roadmap
Open

Add AGI/ASI governance artifacts, validation rules, and tests (Sentinel v2.4, 2026–2035 roadmap)#141
OneFineStarstuff wants to merge 1 commit into
mainfrom
codex/develop-agi/asi-governance-implementation-roadmap

Harden governance artifact validation

9472a1a
Select commit
Loading
Failed to load commit list.
Precaution / Precaution Basic completed Jul 6, 2026 in 3s

Found 0 failures, 78 warnings, and 0 notices.

The check found 0 failures, 78 warnings, and 0 notices. Review the documentation link on each issue to determine how to resolve. Alternatively, false positives can be suppressed. See documentation for details.

Details

PY009: Deserialization of Untrusted Data

Expand for further details

The Python json module provides a way to parse and generate JSON data.
However, it is important to be aware that malicious JSON strings can be used
to attack applications that use the json module. For example, a malicious
JSON string could be used to cause the decoder to consume considerable CPU
and memory resources, which could lead to a denial-of-service attack.

Example

import json


json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')

??? example "Example Output"
> precli --enable=all tests/unit/rules/python/stdlib/json/examples/json_loads.py ⚠️ Warning on line 4 in tests/unit/rules/python/stdlib/json/examples/json_loads.py PY009: Deserialization of Untrusted Data Potential unsafe usage of 'json.loads' that can allow instantiation of arbitrary objects.

Remediation

To avoid this vulnerability, it is important to only parse JSON data from
trusted sources. If you are parsing JSON data from an untrusted source, you
should first sanitize the data to remove any potential malicious code.

Default Configuration

enabled = false
level = "warning"

See also

!!! info
- json — JSON encoder and decoder
- CWE-502: Deserialization of Untrusted Data

New in version 0.1.0

PY001: Improper Check or Handling of Exceptional Conditions

Expand for further details

Assertions are typically used during the development phase to catch logic
errors and conditions that should never occur. However, relying on assertions
for security checks or other critical runtime validations is not recommended
because:

  • Assertions can be disabled in Python with the -O (optimize) and -OO flags,
    which remove assert statements and sometimes docstrings. If critical checks
    are implemented using assertions, this could lead to security vulnerabilities
    being exposed in production environments where optimizations are enabled.

  • Assertions throw exceptions if the condition fails, which, if not properly
    handled, can lead to crashes or other unintended behavior in the application.

Using assertions for non-critical checks during development is common, but for
production code, especially for input validation, error handling, or other
security-sensitive operations, it's important to use proper error handling
mechanisms and validations that do not get removed during optimization.

Examples

def foobar(a: str = None):
    assert a is not None
    return f"Hello {a}"

foobar("World")

??? example "Example Output"
> precli tests/unit/rules/python/stdlib/assert/examples/assert.py ⚠️ Warning on line 2 in tests/unit/rules/python/stdlib/assert/examples/assert.py PY001: Improper Check or Handling of Exceptional Conditions Assert statements are disabled when optimizations are enabled.

Remediation

Use proper error handling mechanism appropriate for production code.

def foobar(a: str = None):
    if a is not None:
        return f"Hello {a}"

foobar("World")

Default Configuration

enabled = false
level = "warning"

See also

!!! info
- Simple statements — Python documentation
- CWE-617: Reachable Assertion
- CWE-703: Improper Check or Handling of Exceptional Conditions

New in version 0.3.8

Precaution v0.7.9

Annotations

Check warning on line 95 in artifacts/validate_artifacts.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.load' that can allow instantiation of
arbitrary objects.

Check warning on line 39 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 40 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 45 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 46 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of
arbitrary objects.

Check warning on line 47 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 48 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 53 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 54 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of
arbitrary objects.

Check warning on line 55 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 65 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of
arbitrary objects.

Check warning on line 67 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 68 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 69 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 80 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of
arbitrary objects.

Check warning on line 82 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 83 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 84 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 85 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 105 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 114 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 119 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 135 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 214 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.

Check warning on line 219 in unit_tests/test_artifacts_validation.py

See this annotation in the file changed.

@precaution precaution / Precaution Basic

PY001: Improper Check or Handling of Exceptional Conditions

Assert statements are disabled when optimizations are enabled.