Repository navigation
Description
Problem
config/constants.py and config/defaults.py declare 97 names (78 constants, 19 defaults) that only one of security/, sandbox/ or crypto/ uses. Counted at 38517a8 (the release/v0.2.25 tip) by AST, with the method described in #1016: from-imports and attribute reads count, and re-exports do not. The counts are approximate (an independent count differs by up to about ten per item, mostly in how function-local imports and names that only build another config/ name are attributed); the baseline is the exact list.
- By package:
security/72,sandbox/16 andcrypto/9. 30 modules read them. The largest readers aresecurity/checkov.py(16),sandbox/models.py(13),security/vault_lease.py(12),security/sarif.py(10),security/reference_extractor.py(9) andsecurity/secrets.py(7). - The 16
checkov.pytables include the 23-name, 90-line block 9c879ae (fix(security): dive invents layers, the rbac audit checks nothing, and checkov's fallback and the complexity scan miss cases #957) added atconstants.py:399; the other 7 of those names arek8s/rbac.py's and move in refactor(k8s): the kubernetes, argo, docker, terraform, observability and valkey tables move out of config/ next to their owners #1031. - Seven are read by two or more modules of one package. For example,
CONST_PERM_PRIVATE_KEY(constants.py:505) is read bycrypto/known_hosts.py,crypto/ssh_keys.pyandcrypto/tls_certificates.py, andCONST_SEVERITY_ORDER(:2465) bysecurity/normalization.pyandsecurity/pipeline.py. - Four test files import them from
config/:test_sandbox_networking.py,test_security_sarif.py,test_ssh_host_keys.pyandtest_workload_sandbox.py.
The placement rule (#1016) puts each of these names next to the code that reads it. That item's baseline lists them under security, sandbox and crypto, and its invariant fails once a listed name is moved and its entry is left behind, so this PR deletes those blocks.
Acceptance criteria
- Each name listed under
security,sandboxandcryptointests/fixtures/config_placement_baseline.jsonis declared in the one module that reads it, or in its package'sconstants.pywhen two or more modules of the package read it. Its name, value and comment are unchanged, and it is annotatedFinal.config/constants.pyandconfig/defaults.pyno longer declare it, and its block is gone from the baseline. - Every importer imports the name from its new module, including the test files named above. Nothing in
config/re-exports it. - A name that only code deleted by an earlier item read is deleted, not moved.
- The two invariant tests from docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016 pass.
- Apart from the
Finalannotation added where a name lacked it, the PR only moves code:git diff --color-moved=zebrashows every other declaration line as moved. The diff touches onlyconfig/constants.py,config/defaults.py, the baseline,security/,sandbox/andcrypto/and the tests that import the moved names. -
uv run devops cipasses.
Key questions
- Does a name go into the module that reads it, or into the package's
constants.py? (proposed) Into the module, when one module reads it. Into the package'sconstants.pywhen two or more do, as the rule says. That applies to seven names here, for exampleCONST_PERM_PRIVATE_KEYandCONST_SEVERITY_ORDER. - When does it land? (proposed) After fix(security): network references come from url and ip syntax, not identifier-prefix and property-suffix lists #431 (v0.2.26), which replaces the identifier-prefix and property-suffix lists in reference extraction, so the lists it deletes are not moved first. It also lands after fix(security): local names come from the public suffix list, and domains match on DNS labels, not string suffixes #887, fix(security): secret masking tells code from literals by the file's syntax, not by receiver names #889 and fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897 when those are scheduled first, since they rewrite matching tables in the same modules.
- Can the move add an import cycle? (proposed) No. A moved table imports nothing new, and a package's
constants.pyimports nothing from its package.test_no_circular_imports_in_decoupled_subsystems(tests/test_architectural_invariants.py:308) is the check.
Depends on: #1016, #776.
Order: after #431. A security review of the PR checks that no table changed while it moved, since these tables decide what the scanners flag.
Related: #431, #887, #889, #897, #776.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsReady
Activity
dan-petty commentedon Oct 3, 2026
Lines cited at dcafadf.
At 132ecc5,
config/constants.py:2799-2830is:2833-2864(the tables at:2801-2829are at:2835-2863);:1048-1062is unchanged.SSH host-key tables
cryptoblock of the baseline, all atconfig/constants.py:2801-2829:CONST_KNOWN_HOSTS_HASH_PREFIX,CONST_KNOWN_HOSTS_MARKER_REVOKEDandCONST_KNOWN_HOSTS_MARKER_CERT_AUTHORITY, read bycrypto/known_hosts.py;CONST_SSH_FINGERPRINT_PREFIX,CONST_SSH_HOST_KEY_TYPESandCONST_GITHUB_HOST_KEY_FINGERPRINTS, read bycrypto/host_keys.py.:2799-2830with GitHub's published known_hosts lines, which it writes to~/.ssh/known_hosts, and leaves every known_hosts decision to OpenSSH.config/with their baseline entries. Both modules still read them, andtests/test_ssh_host_keys.pystill imports the fingerprints fromconfig/. They are deleted rather than moved only once fix(git): GitHub clones trust GitHub's published host keys through OpenSSH, so junk known_hosts lines and a failed key scan no longer skip pinning #1114 has removed their readers.CONST_SPECIAL_USE_TLDS:1048-1062and is read only atsecurity/reference_extractor.py:69. fix(security): network references come from url and ip syntax, not identifier-prefix and property-suffix lists #431 keeps it for URL hosts, and fix(security): local names come from the public suffix list, and domains match on DNS labels, not string suffixes #887 no longer touches it.securityblock once fix(security): network references come from url and ip syntax, not identifier-prefix and property-suffix lists #431 has landed.Any other name
dan-petty commentedon Oct 28, 2026
Closed as not planned. The item conflicts with a more recent project direction. No code was written.
This item is a bulk move of single-owner tables out of
config/. Its acceptance criteria use the placement baseline and the invariant tests that #1016 planned.The owner decision of 2026-10-22 on #1016 replaced that plan:
core/config_placement.py, the baseline filetests/fixtures/config_placement_baseline.jsonand the two invariants are not built.#2492 (merged 2026-10-28) put the rule in
CONTRIBUTING.md: "When you change the owner of a table inconfig/that only one package reads, move the table to its owner in the same pull request."On origin/main (2026-10-28) the baseline file,
core/config_placement.pyand the placement tests do not exist, so the criteria of this item that use them cannot be met. A bulk move also conflicts with each open pull request that changesconfig/constants.pyorconfig/defaults.py. #1026, the sibling item, is closed with the same evidence.A table in
config/that only one package reads now moves to its owner in the pull request that next changes that owner.