Repository navigation
Description
G4: A pull request that brings a new severe code-scanning alert cannot merge
Caller: lines 4 and 5 of #10's card, both ruled A by the operator on 09.11.2026. Behind them stands marketplace#484, row S4 (security settings differ across the fleet).
Ruled
The operator, 09.11.2026, on #10's line 4, answer A ("Neue schwere Warnung sperrt"). The contract, as #10's body holds it:
In
src/opentofu/github(moduleorganization/): a code-scanning rule (providerrequired_code_scanning, tool CodeQL,security_alerts_threshold = "high_or_higher",alerts_threshold = "none") reaching repositories throughquality_gate=true, withprevent_destroyanddestroy = falselike the other rulesets; applied only byscripts/apply_github_settings.sh --applyfrom a cleanorigin/main. Verified at the pull, else this card returns: provider 6.13.0 carries the rule, everyquality_gate=truerepository runs CodeQL through quality'scodeql.yml, and the rule judges only alerts a pull request introduces.
The operator, 09.11.2026, on #10's line 5, answer A ("Geheimnis-Repo ausnehmen"). The contract, as #10's body holds it:
G4 as drafted (a new organisation ruleset with the rule required_code_scanning: tool CodeQL, security_alerts_threshold high_or_higher, alerts_threshold none; prevent_destroy and destroy = false) targets quality_gate=true and excludes platform-secrets: by a repository-name exclusion if the provider and GitHub's API allow it beside the property condition, else by a second custom property declared in src/opentofu/github/organization whose excluded value only platform-secrets carries; verified at the pull. Condition 3 (only alerts a pull request introduces) is proven by a throwaway pull request after the apply; if it fails, this line returns.
Settled at the pull (09.11.2026, main e375b80)
- Provider 6.13.0 carries the rule: holds.
github/resource_github_organization_ruleset.go:640-680declaresrules.required_code_scanningwithrequired_code_scanning_tool(tool,alerts_threshold,security_alerts_threshold);github/util_rules.go:573-593,818-835expands and flattens it. - A name exclusion beside the property condition: neither GitHub nor the provider allows it.
- GitHub's REST description (
github/rest-api-description, schemaorg-ruleset-conditions) makes the conditions aoneOfofrepository_name_and_ref_name,repository_id_and_ref_nameandrepository_property_and_ref_name, and says: "The branch and tag rulesets conditions object should contain bothrepository_nameandref_nameproperties, or bothrepository_idandref_nameproperties, or bothrepository_propertyandref_nameproperties." docs.github.com, "Create an organization repository ruleset", carries the same sentence. - Provider 6.13.0:
repository_propertyhasConflictsWith: ["conditions.0.repository_id", "conditions.0.repository_name"](resource_github_organization_ruleset.go:130),repository_namethe converse (:202), andexpandConditionssends only the first of name, id or property it finds (util_rules.go:223,247,257).tofu validateon a scratch copy with both blocks fails with"conditions.0.repository_name": conflicts with conditions.0.repository_property. - So the contract's second branch applies: a second custom property. Its
excludeis one GitHub documents: "The repository properties and values to exclude. The condition will not pass if any of these properties match." (schemarepository-ruleset-conditions-repository-property-target; providerresource_github_organization_ruleset.go:169).
- GitHub's REST description (
- Every targeted repository but platform-secrets runs CodeQL through quality's
codeql.yml: holds.quality_gate=trueholds for 16 repositories (gh api orgs/overnightworks/properties/values). The 14 that are not archived, all public, run quality'scodeql.yml(quality through its owncode-scanning.yml, the other 13 at2d2b68b, v0.10.0) on every pull request tomainwithout a paths filter, and each has a CodeQL analysis of 09.11.2026.claudebotis archived and takes no pull request, so the rule is inert there.platform-secretsanswers the code-scanning API with 403 ("Code Security must be enabled for this repository to use code scanning") and is the one exclusion. - The rule judges only alerts a pull request introduces: still not documented. It is matrix row 6, after the apply, as line 5 orders.
halholds 5 open high alerts onmainsince 06.11.2026 (py/weak-sensitive-data-hashing,py/insecure-protocol,py/clear-text-logging-sensitive-datatwice,py/polynomial-redos), so its first pull request after the apply shows whether a base alert blocks.
What it builds
All in src/opentofu/github/organization/main.tf, beside quality_gate and the three rulesets:
- The property
github_organization_custom_properties.code_scanning_exempt:value_type = "true_false",required = false, no default,values_editable_by = "org_actors", a description that names the ruleset,lifecycle { destroy = false }. A repository without a value does not match the exclusion, so no default is needed. Only organisation actors set a value, so no repository admin can exempt a repository. - The one value
github_repository_custom_property.platform_secrets_code_scanning_exempt:repository = "platform-secrets",property_nameandproperty_typefrom the property,property_value = ["true"],lifecycle { destroy = false }. - The ruleset
github_organization_ruleset.code_scanning_required: namecode scanning: high or higher blocks the merge, targetbranch, enforcementactive,ref_nameinclude~DEFAULT_BRANCH,repository_propertyincludequality_gate/custom/["true"]from the property (asquality / verdict requireddoes) and exclude the name and values of item 2, no bypass actor, onerequired_code_scanning_tool(tool = "CodeQL",security_alerts_threshold = "high_or_higher",alerts_threshold = "none"),prevent_destroy = true,destroy = false. The exclusion references the value, not the schema, so the apply creates the ruleset only after platform-secrets carries the value; a failed create of the value stops it before the ruleset exists. - The mocked test in
src/opentofu/github/tests/organization_rulesets.tftest.hcl: one run asserts the tool and both thresholds; the property inclusion equal to the quality ruleset's; exactly one exclusion, the property and values of the one declared value; that value's repositoryplatform-secrets; the property'svalues_editable_by = "org_actors". The bypass and enforcement runs list the fourth ruleset. The file's header cites The gate fails on legacy Sonar findings now that main is analysed #7. docs/github-settings.md: Platform on k3s and Flux: from an empty PC to every app live, with hal archived #1 names four rulesets, the schemas ofquality_gateandcode_scanning_exemptand platform-secrets' one value. A new The gate fails on legacy Sonar findings now that main is analysed #7 states the ruled reach: the ruleset requires CodeQL athigh_or_higherandalerts_thresholdnoneon the default branch of everyquality_gate=truerepository except one whosecode_scanning_exemptistrue, which only platform-secrets carries. The commit names lines 4 and 5 of Every fleet repository's GitHub settings and the organisation rulesets live as code in platform #10 as the rulings.- After the apply, a follow-up item, cut at this item's landing, adds to
src/opentofu/github/organization.tftheimportblocks of the three new objects by the ids the read-back shows. An import of an id that does not exist fails the plan, so they cannot come first. Until they land, a lost state would plan the three as creates. The property and value creates are idempotent PUTs. The ruleset would come back as a second ruleset or a refusal.
No import block in the first pull request: none of the three objects exists yet.
Alternatives weighed, for the exclusion:
- (a) A name exclusion beside the property condition is refused by GitHub's schema and the provider (point 2).
- (b) A name or id condition instead of the property would leave the property and reach repositories by a list that
quality_gate's values no longer steer (six repositories havequality_gate=falsetoday). It also breaks "targets quality_gate=true". - (c) A new value of the existing
roleproperty needsroledeclared here, which P0: the skeleton and the fleet's quality gate, from the first pull request #2 keeps as set on GitHub. It also mixes a scanning exemption into a repository's role. - (d) A system property such as
visibilitywould exempt every private repository, a later one included. Line 5's own notice says such a repository needs a new decision. GitHub's REST description does not document the name either. - (e) A second property, chosen. It is
true_falselikequality_gate, since the exemption is yes or no. Asingle_selectorstringproperty would add allowed values or free text, and the provider would still send an empty default at its create.
Alternatives weighed, for where the value lives:
repositories.tfbeside the managed repositories:tofu testcannot plan a resource that depends on one animportblock names, so no mocked run could judge it there.- The module beside its schema and the ruleset that excludes it, chosen: the one exemption has one owner, and the mocked run judges all three together. The root declares no repository's property value today, since P0: the skeleton and the fleet's quality gate, from the first pull request #2 leaves
quality_gate's values to quality's merge command. This value is the first, and that command'sPATCHsends onlyquality_gate(quality/src/quality/merge.py:378), so the two never touch.
Alternatives weighed, for the rule itself: the rule inside quality / verdict required would mean one resource fewer. But that ruleset is quality's contract, so its import id and rollback would carry two unrelated gates. A separate ruleset lets each one apply, fail and roll back alone. Chosen: a separate ruleset.
Size: one production file, 67 added lines. Later, 15 lines of import blocks in a second production file. About 45 test lines and 8 doc lines. A scratch copy of origin/main e375b80 with this design passed tofu fmt -check -recursive, tofu init -backend=false -lockfile=readonly, tofu validate and tofu test (14 passed). A mutation of the exclusion's value failed the new run.
Proof
mise run github:testin CI'sopentofujob is green: format, init against the lock, validate, the mocked tests andtests/github/plan_with_a_delete_is_refused.sh.- The head's apply. First
scripts/apply_github_settings.sh, whose plan holds exactly three creates (code_scanning_exempt, its value, the ruleset) and no other action. The three existing rulesets andquality_gatekeep an unchanged configuration, and the command refuses anydelete. Thenscripts/apply_github_settings.sh --applyfrom a cleanorigin/main. The plan output goes into the item's journal before the apply. - A read-back:
gh api orgs/overnightworks/rulesets/<id>shows the onecode_scanningrule withtool: CodeQL,security_alerts_threshold: high_or_higherandalerts_threshold: none, the property include and exclude, enforcementactiveand an empty bypass list.gh api orgs/overnightworks/properties/schema/code_scanning_exemptshowstrue_falseandorg_actors.gh api repos/overnightworks/platform-secrets/properties/valuesshowscode_scanning_exempt=true.
Trace (main e375b80)
src/opentofu/github/organization/main.tf:quality_gate(true_false, required,org_actors,destroy = false; its comment names the provider's missing true_false default) and the three rulesets.quality_verdict_requiredalready targetsquality_gateby reference.src/opentofu/github/organization.tf:6-24: the fourimportblocks (three rulesets andquality_gate). They stay unchanged here.src/opentofu/github/tests/organization_rulesets.tftest.hcl: header "Proves docs/github-settings.md Platform on k3s and Flux: from an empty PC to every app live, with hal archived #1, P0: the skeleton and the fleet's quality gate, from the first pull request #2". The runsno_organisation_ruleset_has_a_bypass_actorandevery_organisation_ruleset_is_enforcedlist the three rulesets by name and gain the fourth.git grep -n 'required_code_scanning\|code_scanning_exempt\|github_repository_custom_property': no hits, so all three names are new.scripts/apply_github_settings.sh:80-85: the plan is refused when anyresource_changes[].change.actionsholdsdelete. Tested bytests/github/plan_with_a_delete_is_refused.sh, whichmise run github:testruns.- Provider limits: the module comment and
AGENTS.md:415-420name the missing true_false default.docs/github-settings.mddoes not. The new property inherits the limit:resource_github_organization_custom_properties.go:125reads the default throughDefaultValueString(), which returns nothing fortrue_false(go-github v88orgs_properties.go:52-60), although GitHub returns"default_value":"false"forquality_gate.- An update re-sends the schema through the create path (
:139-144) withdefault_value""(:83,95).
- Sentences this item makes false:
docs/github-settings.md:9-13(Platform on k3s and Flux: from an empty PC to every app live, with hal archived #1, "the organisation's three rulesets … and the schema of the propertyquality_gate"). It is in this lane's scope: platform carries the fleet document set: AGENTS.md within its budget, an architecture overview and runbooks #134's P5 (docs/github-settings.md holds the six ruled sentences on GitHub settings, and AGENTS.md loses them #300) has landed, and no live claim or open slice holds the file.- No sentence of
AGENTS.md: the count of rulesets left it with docs/github-settings.md holds the six ruled sentences on GitHub settings, and AGENTS.md loses them #300, andAGENTS.md:415-420stays true. Nothing is named on platform carries the fleet document set: AGENTS.md within its budget, an architecture overview and runbooks #134.
Risk
Material: security and rights.
- The rule gates the merge of 14 active repositories, so a wrong condition blocks their pull requests. A missing exclusion blocks platform-secrets for good.
- A new property's value is an exemption from a security gate.
- quality's merge command switches
quality_gateoff for its merge and back on, so it lifts this ruleset too, but only for a pull request whose other checks are green: it stops on any red check butquality / verdictand the Sonar check (quality/src/quality/merge.py:538-558, the gate's reading at 29cfee6). So it is no way past a pull request this rule alone holds back. quality's head is told. - GitHub's answer to the empty
default_valuethat provider 6.13.0 sends at the property's create is unknown (Unknowns).
The lane gets an Opus review at high effort and a Codex gpt-6-astra gate. The first review drives this matrix:
| # | Sentence | Cell | Driven by |
|---|---|---|---|
| 1 | The rule reaches repositories only through quality_gate=true |
the mocked run (inclusion equal to the quality ruleset's); after the apply, gh api repos/overnightworks/kiln/rules/branches/main (quality_gate=false) lists no code_scanning rule |
CI, head |
| 2 | Tool CodeQL, high_or_higher, alerts_threshold = "none" |
the mocked run; read-back | CI, head |
| 3 | prevent_destroy, destroy = false, no bypass actor, enforcement active |
the mocked runs; the delete-refusing test | CI |
| 4 | The apply plan holds three creates and no delete or change of another ruleset or of quality_gate |
scripts/apply_github_settings.sh plan in the journal |
head |
| 5 | Every targeted repository but platform-secrets runs CodeQL on each pull request to main |
before the apply, gh api repos/overnightworks/<r>/code-scanning/analyses?ref=refs/heads/main returns a CodeQL analysis for each of the 14 active quality_gate=true repositories (claudebot archived); after it, each one's rules/branches/main lists code_scanning |
head |
| 6 | A pull request that introduces a high alert cannot merge; one that adds none can, though the base holds a high alert | a throwaway pull request in platform (CodeQL analyses python and actions there) planting one high Python alert, closed unmerged with its branch deleted; the first hal pull request after the apply (5 high alerts on main). If the second half fails, line 5 returns. |
head, after the apply |
| 7 | A pull request whose CodeQL run is still in progress cannot merge until it ends | the throwaway pull request of row 6 | head, after the apply |
| 8 | quality's merge command still merges: with quality_gate off the ruleset does not reach the repository |
row 1's read of a quality_gate=false repository |
head |
| 9 | platform-secrets is not reached, and only its value exempts | the mocked run (one exclusion, the value's repository platform-secrets); after the apply, gh api repos/overnightworks/platform-secrets/rules/branches/main lists required_status_checks (it still has quality_gate=true) and no code_scanning, and gh api orgs/overnightworks/properties/values shows code_scanning_exempt=true on platform-secrets alone |
CI, head |
| 10 | Only organisation actors set the exemption | the mocked run; gh api orgs/overnightworks/properties/schema/code_scanning_exempt shows org_actors |
CI, head |
Before the apply: the root's plan fails today, before any create. The repository agents was renamed personas: gh api repos/overnightworks/agents answers overnightworks/personas, and the property listing names personas. Meanwhile local.managed and the listing test still name agents. Read from the code, not run here: the output's preconditions then fail, and the repository resource would plan a rename back to agents. #307 holds the fix. G4's apply waits for its landing and apply. The build and CI do not.
Unknowns:
- Whether GitHub accepts
default_value: ""on creating a non-required true_false property. Provider 6.13.0 always sends it (resource_github_organization_custom_properties.go:83,95; go-github v88 sends a non-nilDefaultValue). A refusal fails the apply at the property's create, before the value and the ruleset that depend on it, so nothing reaches a repository. The item then returns to the head with the error. - Whether the rule wants an analysis of the base commit as well; rows 6 and 7 show it.
- A second repository set to
code_scanning_exempt=trueby hand is not in any plan. Only organisation actors can do it, and G3's targeting check (effective rules against property values) is where it shows. Named on Every fleet repository's GitHub settings and the organisation rulesets live as code in platform #10 for G3, with the fourth ruleset and the second schema.
Rollback:
- At once, by hand, only with the operator's word given before the apply:
gh api -X PUT orgs/overnightworks/rulesets/<id>withenforcementdisabledopens the merge again across the fleet. Through the command it is not at once:--applyneeds the change onorigin/main, platform isquality_gate=true, so this ruleset gates that pull request too, anddisabledcontradicts Platform on k3s and Flux: from an empty PC to every app live, with hal archived #1'sactiveand the enforcement test. The hand containment is then followed by that pull request, which brings the code to the hand state, and the operator's word on Platform on k3s and Flux: from an empty PC to every app live, with hal archived #1. This is also the containment if row 6's base half fails, while line 5 returns. - Final: a revert of the code carries
removedblocks withlifecycle { destroy = false }for the three addresses, since the command refuses adelete. First the ruleset, then the property: a property deleted first could drop the exclusion while the ruleset stays active and block platform-secrets. The head deletes the ruleset bygh api -X DELETE orgs/overnightworks/rulesets/<id>and the property bygh api -X DELETE orgs/overnightworks/properties/schema/code_scanning_exempton the operator's word.
Done when
- The property
code_scanning_exempt, platform-secrets' one value and the rulesetcode scanning: high or higher blocks the mergeare declared inorganization/main.tf. A mocked run judges them,docs/github-settings.mdstates Platform on k3s and Flux: from an empty PC to every app live, with hal archived #1 and The gate fails on legacy Sonar findings now that main is analysed #7, andmise run github:testis green in CI. - The head applied them through
scripts/apply_github_settings.sh --applyfrom a cleanorigin/main, with the plan of three creates in the journal, and thegh apiread-back equals the contract. - The follow-up item that adds the three
importblocks toorganization.tfby the read-back ids is cut and named here. - Matrix rows 4 to 10 are driven and reported. Row 6's failure returns line 5 to the operator, with the ruleset disabled.
- Predecessor: none. CodeQL default setup is configured nowhere, and the merge gate has no code-scanning rule today.
version = 1
now = "Lines 4 and 5 of #10 are ruled A (09.11.2026). The pull at e375b80 settled it: GitHub's schema and provider 6.13.0 refuse a name exclusion beside the property condition, so a second true_false property code_scanning_exempt, set on platform-secrets alone, is excluded; the design passed fmt, validate and the mocked tests in a scratch copy."
next = "Claim with aco start and build the property, its one value, the ruleset, the test and GH-1/GH-7; the apply waits for #307, which declares personas in place of the renamed agents, since the root's plan fails until then."
done_when = "code_scanning_exempt, platform-secrets' value and the ruleset code scanning: high or higher blocks the merge are declared in organization/main.tf, judged by a mocked run and stated as GH-1 and GH-7; applied by apply_github_settings.sh --apply from a clean origin/main with a plan of three creates in the journal and read back by gh api; the follow-up item for their import blocks is cut; matrix rows 4 to 10 are driven."
scope = ["src/opentofu/github/organization/main.tf", "src/opentofu/github/tests/organization_rulesets.tftest.hcl", "docs/github-settings.md"]
whole = "One exempting ruleset: the property, platform-secrets' value and the ruleset that excludes it apply together or the rule blocks platform-secrets for good; the test and GH-1/GH-7 judge and state them, and their import blocks follow the apply in an item of their own."
Activity
The code scanning test pins the exclusion's property source and the r…
FlexOr2 commentedon Nov 9, 2026
The operator's word for the hand containment, in platform's head session on 09.11.2026. Asked „Darf ich die neue Sperre im Notfall sofort von Hand abschalten? … falls sie wider Erwarten Merges in allen Repos blockiert … Ich setze sie per
gh apiauf „disabled“ und ziehe den Code danach per PR nach.“, he answered „ja“.So the "At once" rollback in this body holds: if the ruleset blocks merges across the fleet, the head (or an agent on its order) sets its
enforcementtodisabledwithgh api -X PUT orgs/overnightworks/rulesets/<id>, then brings the code to that state by pull request.Follow-ups from the gate (29cfee6), with owners: the ruleset's
targetand the create order are not pinned by the test (F4), for the follow-up item that adds the import blocks; aco's landing check and lane-ci read no code-scanning rule, so a pull request whose CodeQL still runs may be reported ready and refused at merge (F5), for aco's board.An organisation ruleset blocks the merge of a pull request that bring…
FlexOr2 commentedon Nov 9, 2026
The head's plan at e0d3586, before the apply, from clean origin/main: "Plan: 3 to add, 0 to change, 0 to destroy."
module.organization.github_organization_custom_properties.code_scanning_exemptwill be createdmodule.organization.github_organization_ruleset.code_scanning_requiredwill be createdmodule.organization.github_repository_custom_property.platform_secrets_code_scanning_exemptwill be createdRow 5, read before the apply:
code-scanning/analyses?ref=refs/heads/mainreturns a CodeQL analysis for each of the 14 activequality_gate=truerepositories: aco, agents, design, hal, hopin, marketplace, personas, platform, presentator, quality, skat, songmaker, speech, webauth. claudebot is archived, and platform-secrets is exempt.FlexOr2 commentedon Nov 9, 2026
Applied from clean main at e0d3586 by
scripts/apply_github_settings.sh --apply: 3 added, 0 changed, 0 destroyed. The plan afterwards exits 0, "No changes".Read back:
active, bypass list empty, one rulecode_scanning,CodeQL/high_or_higher/none, includequality_gate=true, excludecode_scanning_exempt=true.code_scanning_exempt:true_false,org_actors.platform-secretsholdscode_scanning_exempt=true.rules/branches/mainlistscode_scanningon aco, agents, design, hal, hopin, marketplace, personas, platform, presentator, quality, skat, songmaker, speech and webauth, and not on platform-secrets.Rows 1, 2, 4, 5, 9 and 10 hold. Rows 6 and 7, the throwaway pull request, and row 8 follow here.
FlexOr2 commentedon Nov 9, 2026
Row 8 holds:
quality_gateisfalseonovernightworks/kiln, andgh api repos/overnightworks/kiln/rules/branches/mainlists onlydeletion,non_fast_forwardandpull_request, so neither the quality ruleset nor the code-scanning rule reaches a repository outside the property.FlexOr2 commentedon Nov 9, 2026
The follow-up of this item's point 6 is cut: #335 (import blocks, and F4's
targetpin). Rows 6 and 7 are not driven yet: the throwaway pull request's merge attempt was refused by the session's safety check and is with the operator. quality's head confirmed the reading of its merge command at quality main 896030a; that a high alert leaves CodeQL's own check red stays to be proven by row 6.FlexOr2 commentedon Nov 9, 2026
aco's head, asked live on this item's rows 6 and 7 (its finding F5 of the gate on #310): a clear refusal is enough, aco opens no item, and aco's own reading of
landanswers the worry.aco landreads every check run on the head,CodeQLandcodeql / Analyze (...)included. While CodeQL runs it refuses and names the check (LANDCMD-05); a CodeQL check that ended without success refuses too (LANDCMD-06); amergeable_stateother thancleanrefuses (LANDCMD-03). So "CodeQL still runs, reported ready, then 405" does not reach the merge inaco land;aco check <pr>never claimed readiness. lane-ci is marketplace's to answer.codeql / Analyzeended and before GitHub posts theCodeQLcheck run, no check is pending. Either LANDCMD-03 refusesnot mergeable (blocked), or the merge gets a 405 and LANDCMD-37 refuses with GitHub's message. Nothing merges either way and the claim stays.mergeable_stateand the merge answer in that window and send it the exact refusal text; a sentence that does not say what to do, or a 405, becomes an item on aco's board with that incident as caller.FlexOr2 commentedon Nov 9, 2026
Rows 6 and 7, read under #10 line 6 (A: read state only, no merge call), on throwaway PR #343 (closed unmerged, branch deleted, lane released):
active,~DEFAULT_BRANCH, toolCodeQL,security_alerts_threshold: high_or_higher,alerts_threshold: none, forquality_gate=trueand notcode_scanning_exempt=true.mergeStateStatuswasBLOCKEDat 19:24, 19:25 and 19:26 UTC while CodeQL ran, butclusteralso ran the whole time, so the read does not single out the code-scanning rule. Not proven.requests.get(url, verify=False)raised no alert: theCodeQLcheck run concludedsuccess, "No new alerts in code changed by this pull request", and the PR ref lists no alert.A second read waits until CI is quiet (after songmaker's go), with a finding the default suite raises without a data flow (for example
py/insecure-protocol, ansslcontext at TLS 1.0), and readsmergeStateStatusonce every other check is green.