mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
cdb2c36dfe6237a86cee46dfd78bf37e7ffcef6e
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
024d74e5c4 |
feat(cloudtrail): in-process CloudTrail with S3 data event emission (#1460)
* feat(cloudtrail): in-process CloudTrail with S3 data event emission
New service supporting CreateTrail / DescribeTrails / DeleteTrail /
UpdateTrail / PutEventSelectors / GetEventSelectors / StartLogging /
StopLogging / GetTrailStatus.
S3 ops (PutObject / GetObject / HeadObject / DeleteObject / ListObjects
/ GetObjectAcl) emit CloudTrail data events through a per-trail buffer.
The CloudTrailLogWriter scheduler flushes pending records as gzipped
JSON envelopes into the destination bucket at AWS-shaped key paths
(AWSLogs/<account>/CloudTrail/<region>/yyyy/MM/dd/<file>.json.gz) on
a configurable cadence (default 60s).
IAM-enforcement denials emit matching AccessDenied records by hooking
IamEnforcementFilter. IamActionRegistry now distinguishes
s3:GetObjectAcl / PutObjectAcl / {Get|Put|Delete}ObjectTagging from
their base ops via ?acl / ?tagging query parameters so the right
event names land in the trail.
Seeded AWSCloudTrail_FullAccess / _ReadOnlyAccess managed policies.
* fix(cloudtrail): return LatestDeliveryTime in GetTrailStatus after StartLogging
The sdk-test-java compatibility test asserts latestDeliveryTime() is
non-null immediately after startLogging. Seed it with the startLoggingTime
so the field is always present once logging has been started.
* fix(cloudtrail): emit SnsTopicARN alongside SnsTopicName in CreateTrail/UpdateTrail responses
Accept both SnsTopicARN and SnsTopicName on input (SnsTopicARN takes
precedence). Emit both fields on output so clients reading the current
field name (SnsTopicARN) get a non-null value.
* fix(cloudtrail): wildcard S3 ARN matching, trail name validation, LookupEvents
- matchesS3DataResourceArn: handle bare "arn:aws:s3", "arn:aws:s3:::*", and
"arn:aws:s3:::*/*" wildcard forms so trails configured via the AWS Console
"capture everything" selector actually record events (previously fell through
silently). Unit tests added to CloudTrailSelectorMatchingTest.
- createTrail: enforce AWS trail name rules (3–128 chars, start/end with letter
or digit, only letters/numbers/./_/-). Integration tests in new
CloudTrailNameValidationTest.
- CloudTrailJsonHandler: add LookupEvents stub returning an empty Events array,
matching upstream's addition in #1603.
* fix(cloudtrail): log empty catches, key selectors/logging by trail home region
- CloudTrailLogWriter.stop(): log at WARN instead of silently swallowing the
final-flush exception (AGENTS.md: never leave a catch block empty).
- CloudTrailService.putEventSelectors / getEventSelectors / startLogging /
stopLogging / getTrailStatus: use trail.homeRegion() as the storage key
instead of the request region. Previously a cross-region call (e.g. accessing
a trail by ARN from a different-region endpoint) stored selectors and logging
state in the wrong region's map, so trailsMatching() found an empty selector
list and logging never fired.
- S3Controller.emitCloudTrailEvent / IamEnforcementFilter.emitS3DenialIfApplicable:
replace empty inner catch blocks with LOG.tracev() so unexpected failures
during request-context extraction surface at trace level.
* fix(iam): distinguish bucket-level vs object-level ?acl / ?tagging IAM actions
resolveS3SubResourceAction was always mapping ?acl and ?tagging to object-level
actions (s3:PutObjectAcl, s3:GetObjectAcl, etc.) regardless of path depth.
A PUT /{bucket}?acl request requires s3:PutBucketAcl, not s3:PutObjectAcl —
callers with the correct bucket-level permission were incorrectly denied.
Fix: inspect the URL path after stripping the leading slash. When there is no
slash (or the path ends with one), the target is a bucket; otherwise it is an
object. Applies to all six variants: GetBucketAcl, PutBucketAcl,
GetBucketTagging, PutBucketTagging, DeleteBucketTagging (and their object
counterparts).
* fix(cloudtrail): re-queue records on flush failure instead of dropping them
drainPendingRecords atomically dequeues all records before the S3 write.
If serializeAndGzip or s3Service.putObject threw, those records were gone —
permanently lost before the re-throw reached flushAll.
Fix: wrap the serialize+write block in a try-catch that calls requeueRecords
before rethrowing. Records are added back to the tail of the queue and will be
retried on the next flush cycle. The new CloudTrailService.requeueRecords helper
also makes the re-queue path unit-testable independently of flushTrail.
* fix(s3): emit GetObjectAcl error record under correct event name
getObjectAcl was called inside the outer GET-object try block. On any
AwsException (NoSuchKey, AccessDenied, etc.) the catch at the bottom fired
and emitted a GetObject error record. CloudTrail consumers auditing ACL
errors would see the wrong event name.
Wrap the acl branch in its own try-catch that emits GetObjectAcl on both
success and failure paths, mirroring the pattern used by the other hooked ops.
* ci: retrigger
* fix(test): pass CloudTrailService and CurrentVertxRequest to IamEnforcementFilter constructor
* fix(cloudtrail): persist trail state via StorageFactory instead of volatile in-memory maps
* fix(cloudtrail): address review feedback on region, name lookup, and ACL detection
- S3Controller: use request region (from credential scope) instead of
getDefaultRegion() for CloudTrail event emission, matching the IAM
denial hook behaviour so allowed and denied calls land in the same trail.
- CloudTrailService.findTrail: name lookup now uses regionKey(region, name)
directly; ARNs still do a cross-region scan. Prevents two same-name
single-region trails from resolving ambiguously by map iteration order.
- TrailKey: add eventRegion field so multi-region trail events are written
to the correct S3 delivery path (CloudTrail/<eventRegion>/) rather than
always the trail home region. drainPendingRecords/requeueRecords now take
a TrailKey to carry all three dimensions.
- IamActionRegistry: fix isBucketLevel — trailing slash is a valid S3 key
character, so /bucket/folder/?acl is an object ACL request. Replaced the
endsWith("/") check with an index-based test. Add IamActionRegistryTest
cases for the folder/ regression.
* docs(cloudtrail): sync action table order with make docs-sync
|
||
|
|
7d70f64162 |
feat(docs): generate Supported Actions tables from handler source (#1641)
* feat(docs): generate Supported Actions tables from handler source The "Supported Actions" tables in docs/services/*.md were hand-maintained and drifted from the handlers. For example secrets-manager.md omitted RestoreSecret, which SecretsManagerJsonHandler dispatches, and acm.md listed RenewCertificate, which is not implemented anywhere in src/. Derive the action list from handler source so it cannot drift, while keeping the hand-written Description column: - tools/docs/regen_action_docs.py extracts actions from `case "X" ->` switch arms (including multi-label arms) and JAX-RS REST controllers, and rewrites only the rows between the <!-- floci:actions --> markers. Descriptions are preserved by action name; new actions get a "-" placeholder. PascalCase-only matching avoids picking up SCREAMING_CASE labels from non-action switches. - tools/docs/services.yaml registers 18 single-table switch services and lists the remaining switch handlers under deferred_handlers, so the new-service sentinel fires only on a genuinely unregistered handler. - make docs-sync / docs-check / docs-test, plus a Python-only CI workflow that gates on handler, doc, and tooling changes. - Migrate 18 service docs into marker blocks, reconciling real drift (adds RestoreSecret, ImportCertificate, and others; drops the unimplemented RenewCertificate). Revives the parser and CI gate from #738 by @ericbsantana and completes the description-preservation its spec described. REST-mode, mixed-mode, multi-table, non-tabular, S3, and ecr docs are deferred and tracked in deferred_handlers. * docs: drop standalone design spec from action-docs tooling Remove ideas/auto-generated-action-tables.spec.md and the four references to it (CONTRIBUTING.md, Makefile, regen_action_docs.py docstring, services.yaml). It was a planning artifact; the operational docs live in CONTRIBUTING.md and the tooling is self-documenting. The #738 / @ericbsantana credit is preserved in the PR description. * chore: address review on action-docs tooling - pin actions/checkout to v7.0.0 in docs-actions workflow to match the repo-wide bump (#1690), so dependabot does not immediately flag the new file - document in the generator docstring that a switch case label counts as supported purely by existing, so a per-action UnsupportedOperation stub would be a false positive (handlers here reject from the default arm) * docs: regenerate action tables against current handler source Resync the generated Supported Actions tables to handler source after rebasing onto the latest main: - cloudformation: add DescribeStackInstance and DescribeStackSetOperation now emitted by the handler, and keep the implemented StackSet descriptions - cloudtrail: add LookupEvents - firehose: add UpdateDestination - step-functions: add PublishStateMachineVersion, ListStateMachineVersions, DeleteStateMachineVersion - register the cloudcontrol handler in deferred_handlers so the strict unregistered-handler gate passes (no standalone action table yet) * fix(docs): prevent action-table generator from silently dropping actions Address the latest review pass on the action-docs tooling: - switch extraction now captures case arms whose labels wrap across lines (valid Java 14+ syntax). The capture group excludes only `{ } ;` boundaries, so it spans newlines between labels but stops at the arm's `->`. A wrapped arm was previously missed, and docs-check would stay green because the doc and the generated output agreed on the omission, defeating the whole drift-prevention guarantee. - REST extraction skips Javadoc / inline comments between a verb annotation and the method signature; such a line otherwise reset the lookahead and dropped the action. - parse_marker_block raises a descriptive error when a marker is not on its own line, instead of a bare "substring not found". - doc, source, and registry reads/writes are pinned to UTF-8 so generation is locale-independent (the docs contain non-ASCII text). - the docs-actions push trigger watches Makefile and the workflow file, matching its pull_request trigger. Adds regression tests for the multi-line arm and comment-skip paths (20 total). |
||
|
|
717769857b |
docs: correct service count to 58 and add EMR, WAF v2, CloudTrail pages (#1398)
Reconcile inconsistent service counts (55/54/41) to 58 distinct services across the README, docs index, services overview, and the LocalStack migration guide. Add the missing per-service pages and Service Matrix rows for EMR, WAF v2, and CloudTrail, and wire them into the mkdocs nav and README service tables. |