Rate gitlab-org/auth/iam merge requests against its own rules

What does this MR do and why?

Onboards gitlab-org/auth/iam (project 74293132) to the MR Risk Labeler for gitlab-org/gitlab#638927. These are steps 1 and 2 of the onboarding guide:

  • instructions/74293132/ holds the rules file, a rubric per area and a README;
  • the project joins the gitlab-org consumer in src/mr-risk/flow.yml.erb, and flows/mr-risk.yml is recompiled;
  • the project gets a row in instructions/README.md.

Nothing here approves anything. Until gitlab-org/quality/triage-ops!4548 (merged) lists the project (step 3), the flow only runs when someone mentions or assigns @ai-mr-risk-labeler-gitlab-org, and its labels carry the test- prefix.

@grzesiek: you are IAM's accountable maintainer, so these tiers are IAM's to correct. Every floor and tier below is a proposal. The questions at the end are where I was least sure.

IAM's own line

The rules follow IAM's CODEOWNERS and .gitlab/review-policy.md. An area has no floor only where CODEOWNERS already lets an agent approve alone: the docs and agent instruction text, the tests in pkg/, cmd/ and internal/, the root module's dependencies and tool pins, and the six non-auth packages. Every path IAM keeps human is floored at medium. Authentication, the data-access API, the migrations and the agent configuration are floored at high.

That makes one deliberate difference from the other projects here. Instruction text (AGENTS.md, CLAUDE.md, .ai/, the agents, rules and skills under .claude/) is read with the docs rather than floored at high, because IAM lets Duo approve it alone and IAM's docs move with the code. A rule change there still rates high. What IAM keeps human (.claude/settings.json, .claude/hooks/, .opencode/, .gitlab/duo/) is agent-config, floored at high.

Areas

Every one of the 856 tracked paths on main (ea9d4cbd) falls into one of eleven areas. This was checked with Manifest.area_for against git ls-files.

Area Paths Floor Files
docs docs/, README.md, the AGENTS.md and CLAUDE.md files CODEOWNERS excludes (root, auth/, dataaccess/), .ai/, .claude/{agents,commands,rules,skills}/, scripts/verify-agent-docs.sh 56
agent-config the rest of .claude/, .opencode/, .gitlab/duo/, any other AGENTS.md or CLAUDE.md high 4
specs *_test.go under pkg/, cmd/ and internal/, smoketest/, scripts/loadtest/, internal/testutil/, internal/prototest/, pkg/internal/testutil/, performance.yml 108
deps root go.mod and go.sum, vendir.yml, vendir.lock.yml, .tool-versions, the two CI versions files 7
code internal/dbstats/, pkg/buildinfo/, pkg/logging/, pkg/telemetry/, pkg/storage/, pkg/migrate/ 28
auth auth/ with its tests, pkg/userauth/ and pkg/serviceauth/ (both separate modules), pkg/boot/, cmd/, internal/validation/ high 317
dataaccess dataaccess/ high 84
db db/ high 88
config configs/, proto/config/, pkg/config/, pkg/internal/platformconfig/, .runway/ medium 93
api the rest of proto/, third_party/, the buf files medium 21
tooling .gitlab/, the rest of scripts/, env/, caproni/, every remaining root file medium 50

What each rubric turns on:

  • docs rates the words. A fact corrected to match code in the same MR is low, because verify_agent_docs holds the docs to the code. A rule added, removed or rescoped is high. So is anything that tells an agent to approve, merge or skip a person, a skill that runs or fetches something, a production runbook step or the SQL under docs/runbooks/sql/, and a check loosened in verify-agent-docs.sh.

  • agent-config is always high. It names the hook, plugin, marketplace or Duo review rule the change reaches.

  • specs is low only for added coverage. These are high:

    • a test deleted, skipped or weakened;
    • a committed key, since the helpers generate theirs at run time;
    • smoketest/bootstrap-ancestor-grant/, which is an admin tool that grants a relationships-admin role rather than a test.
  • deps rates a Go bump by the upstream block. These are high:

    • a mismatched hash, an init or cgo change, or a major bump;
    • a new Go release line;
    • above a patch bump, the credential, crypto and request-path modules: fosite, jwx, go-jose, go-oidc, x/oauth2, x/crypto, pgx, grpc, protovalidate, go-grpc-middleware, cors and goose.

    A lint-only tool's patch or minor bump is low. buf, sqlc, goreleaser, the builder images, fairway, a Go patch release and a glaz vendir bump are medium. Anything in a CI versions file other than a GL_*_VERSION variable is high: .gitlab-ci.yml includes both files, and IAM's gate checks the same thing.

  • code is low only for changes nothing outside the diff can see. These are high: a token or secret logged, where telemetry sends, how pkg/storage connects, how pkg/migrate locks and orders, and an import of auth/ or dataaccess/.

  • auth, dataaccess and db never rate below high. Their rubrics name the reason. For auth, that covers PKCE's deliberate Doorkeeper parity, so hardening it is high too, the claim allowlist, lifespans, the jti denylist, hashers, redirect URIs, the interceptor chain and public routes, and pkg/userauth's audiences. For dataaccess, it covers permission-not-role checks, the GLAZ shadow action, the vendored roles and the health-only publicGRPCMethods allowlist. For db, it covers paired backends, no edits to merged migrations, no DML, and -- +goose NO TRANSACTION on YugabyteDB.

  • config: a setting added on both the TOML and proto paths is medium. These are high: a staging or production value, a Vault path, a chart name, one config path changed without the other, the loader's layering, and an audience or issuer.

  • api: an additive field or RPC is medium. These are high: a removed or renumbered field, an auth level, a hand-edited .pb.go, and buf's rules loosened. breaking_proto is allowed to fail, so a green pipeline does not show compatibility.

  • tooling: an ordinary job or lint change is medium. These are high: release and signing, the Dockerfile and scripts/entrypoint.sh, CODEOWNERS and .gitlab/review-policy.md, a required job made optional, a credential given to a job, an outside image or component, and the gitleaks allowlist.

Checked against recent merges to main

These were run through the gate's path logic, using Manifest.area_for, Diffs::REFUSED_SUBJECTS and the 20-file and four-area caps, over every MR merged since 20 October. All of them came from the project's own branches. None was from a fork or carried Community contribution.

  • 202 merged, 63 of them Renovate's: 181 are rated, every Renovate bump among them. Of the 21 refused:
  • Floors of the 181:
    • 39 touch only areas with no floor, so the rubric decides between low, medium and high;
    • 64 are floored at medium;
    • 78 are floored at high.
  • Renovate's 63:
    • 24 move only deps files, and can rate low;
    • 35 also touch tooling, for CI components, the Dockerfile or .mise.toml, and are floored at medium;
    • 4 are floored at high: 2 move a public module's go.mod, 1 moves the vendored glaz roles, and 1 is a copier update that touches the Duo review file.

The upstream check was also run, outside a sandbox, on three of Renovate's recent Go bumps here: go-jose v4.1.7 to v4.1.9, pgx v5.11.0 to v5.12.0 and labkit v2.70.0 to v2.72.1. Every version matched sum.golang.org and go.sum. The go-jose and pgx diffs are long enough to be cut, which the rubric rates medium.

Before this does anything

  • Consumer. The tag after this merges creates the project's consumer. gitlab-org/quality/triage-ops!4548 (merged) then takes its ID.
  • Membership. The same sync adds @ai-mr-risk-labeler-gitlab-org to the project as a Developer. Check that before step 3 runs the flow on every MR.
  • Ruby. IAM has no .gitlab/duo/agent-config.yml, so the flow runs in the default image, which has Ruby and git. Nothing to install.
  • Network. Without a network policy, a Duo session here reaches only GitLab's hosts, so every Go bump comes out not downloaded and rates medium. gitlab-org/auth/iam!1144 (merged) allows proxy.golang.org and sum.golang.org. It is a draft, and it needs an IAM code owner.
  • Labels. The flow creates each test- label as a project label the first time it writes it.

Two things stay as they are: Duo Code Review, and IAM's independent-approval gate. Step 4, approvals, will need @gitlab-bot as a code owner on the paths that can rate low. gitlab-org/auth/iam!1128 (closed) drafts that for the closed Duo-review path.

Questions for IAM's maintainers

  • testdata/. CODEOWNERS excludes *_test.go in pkg/, cmd/ and internal/, but not the testdata/ beside them. These rules follow it, so pkg/config/testdata/ is in config, floored at medium. Should testdata go with the tests?
  • smoketest/bootstrap-ancestor-grant/. CODEOWNERS lets an agent approve all of smoketest/. This one is an admin tool that grants the smoke tests' service account a relationships-admin role. The specs rubric rates any change to it high. Should CODEOWNERS keep it human as well?
  • internal/validation. .ai/components.md lists it as a test helper. It is the protovalidate interceptor that pkg/boot/grpcserver and two gRPC handlers import, so these rules put it in auth.
  • Tool and Go tiers. A patch or minor bump of golangci-lint, shellcheck, shfmt, squawk or pre-commit rates low. A Go patch release rates medium, and a new Go release line rates high. Should any of these move?

How to set up and validate locally

make check

🤖 Generated with Claude Code

Edited by Connor Sanders

Merge request reports

Loading
Loading