mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 19:18:01 -05:00
fix(iam): check PutEvents on each entry's event bus (#6704)
PutEvents was checked on `*`: the request-resources table gave it no resources, as its bus is a field of each entry, which no rule read. A policy allowing or denying events:PutEvents on one event bus therefore did not hold for publishing. Each entry's EventBusName is "the name or ARN of the event bus to receive the event", and "if you omit this, the default event bus is used". Bus policies grant events:PutEvents on `event-bus/<name>`. The EventBridge User Guide checks events:PutEvents against "the bus, once per entry in the request", and says "Publishing is authorized against the bus ARN for every entry in the request. If one entry fails an authorization condition, EventBridge denies the whole request." It says so in its section on the Custom Event Bus, which keeps the events: IAM namespace of the Classic one; nothing in the guide says otherwise for a Classic bus, whose API model lists AccessDeniedException among the error codes of an entry without saying when. The table now reads PutEvents' `Entries[].EventBusName`, a field of each of a list's structures, one resource for each entry: - The generator takes a correction filling a variable from such a field, and finds a field whose pattern takes an ARN before a name inside a list's structures, as it does a top-level member, so the field gets `arnOf` from botocore. - The loader reads `Name[].Field` in `fill`, and in `absent` and `arnOf` when it fills a variable. - The reader gives one value for each entry, the `absent` value for an entry that names no bus, gives a null or a blank, as the handler's `asText(null)` does, and none for no entries, which stay on `*`. Each value that is an ARN puts its own entry's bus in that ARN's account and Region, checked as given and as the caller's, which the handler publishes to; until now the first ARN a request gave set the account and Region of every value. The filter checks every resource, so one entry for a bus the caller may not publish to refuses the whole request, as the guide gives it. Not in this change: the events:source and events:detail-type condition keys (Floci supplies neither), EndpointId (the handler ignores it), and PutPartnerEvents, which stays on `*`. The upstream drift check on a pull request now verifies only the vendored IAM files the pull request changes, each with its generator, its tests and the modules that generator imports. It verified all six files whichever one a pull request touched, so this change, which touches only the table of the resources requests name, failed on the service namespace list, which AWS's index stopped matching when it dropped `codestar`: drift in a file the change leaves alone. The pull request's job passes the paths its merge commit changes to `make iam-data-verify CHANGED=...`, which names each check it skips; the weekly and manual runs, and a diff that cannot be read, still check every file, so the namespace list's drift is reported there.
This commit is contained in:
1 parent
5c9eb3eb30
commit
0410a2b4ea
11 files changed
+384
-62
No files matched your search
@@ -14,7 +14,10 @@ name: IAM Data Drift
|
||||
#
|
||||
# - On a pull request that touches a vendored file or its generator, which is where a
|
||||
# hand-typed or mistyped entry would enter the repository. A pull request that does not touch
|
||||
# them cannot introduce one, so it does not run and cannot be failed by an outage.
|
||||
# them cannot introduce one, so it does not run and cannot be failed by an outage. For the same
|
||||
# reason, one that does checks only the files it touches, each with its generator and the
|
||||
# modules that generator imports (the paths in the Makefile, above iam-data-verify): drift in a
|
||||
# file it leaves alone is not its doing, and the weekly run reports it.
|
||||
# - Weekly, because the files also go stale without anyone touching them: AWS ships services
|
||||
# and actions, and occasionally retires them. Tying the only upstream check to pull request
|
||||
# activity would mean a quiet month is a month with no drift detection at all.
|
||||
@@ -72,6 +75,10 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
# A pull request's merge commit and its first parent, the base branch, so the step below
|
||||
# can tell which files the pull request changes.
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
@@ -80,5 +87,15 @@ jobs:
|
||||
|
||||
# No dependency install: the generators are deliberately stdlib-only, and this job runs no
|
||||
# tests. The pinned botocore the sibling workflow needs is for the partition generator.
|
||||
- name: Check every vendored IAM file still matches upstream
|
||||
run: make iam-data-verify
|
||||
#
|
||||
# A pull request checks the files it changes; the weekly and manual runs check every file. A
|
||||
# diff that cannot be read leaves CHANGED empty, which checks every file too.
|
||||
- name: Check the vendored IAM files still match upstream
|
||||
env:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
run: |
|
||||
if [ "$EVENT_NAME" = pull_request ]; then
|
||||
make iam-data-verify CHANGED="$(git diff --name-only HEAD^1 HEAD | tr '\n' ' ')"
|
||||
else
|
||||
make iam-data-verify
|
||||
fi
|
||||
Reference in new issue
Block a user