feat(glue-alpha): ensure job parameters consistency - #38480
Open
otaviomacedo wants to merge 7 commits into
Open
Conversation
Contributor
|
PRs without a linked issue will receive lower priority for review and merging. Please update the description to follow the PR template and include a line like |
aws-cdk-automation
previously requested changes
Aug 3, 2026
aws-cdk-automation
dismissed
their stale review
August 3, 2026 09:54
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
aws-cdk-automation
temporarily deployed
to
automation
August 3, 2026 10:07 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
August 3, 2026 10:07 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
August 3, 2026 14:38 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
August 3, 2026 14:38 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
CfnJobL1 takes adefaultArgumentsproperty, which are the arguments it runs with by default. The variousJobL2 constructs build this argument from two sources:defaultArgumentsprovided directly by the user.--job-language scala; if the user passedcontinuousLogging.logGroup, it will include--continuous-log-logGroup <group name>and so on.The main problem, both for usability and security, is that users can pass default arguments that conflict with construct-owned ones. For example, users can create a job with
Currently,
defaultArgumentssilently wins. This can weaken the user's security posture because the L2 constructs have secure defaults, such as continuous logging being enabled. If the user accidentally passesdefaultArguments['--enable-continuous-cloudwatch-log']: false, it will silently disable logs for the job.One possible solution would be to invert the precedence of the arguments, such that the construct owned ones win in case of conflict. But then the problem would flip, and user provided parameter would be silently ignored. Despite being more secure than the current behavior, it is also more confusing.
The solution adopted here is to make them mutually exclusive, so that there is only way to configure an argument: either via the strongly typed API if it exists, or directly via
defaultArgumentsas an escape hatch. If a given argument is present in both, the construct throws an error.Also, as mentioned, Glue jobs enable continuous CloudWatch logging by default across all job types. But unless a
SecurityConfigurationwithcloudWatchEncryptionis attached, driver/executor stdout and stderr are written to the account-shared default log group (/aws-glue/jobs/logs-v2/) in plaintext. Job logs routinely contain sensitive runtime data (SQL statements, row values, error stack traces), so this is a silent gap for regulated workloads. This PR adds a warning when setting up continuous logging if there is no security configuration set.Note: the
--enable-metricsand--enable-observability-metricsarguments that were being emitted byPythonShellJobwere removed. They are no-ops, probably copied fromSparkJobPropsandRayJobProps. This was confirmed by deploying a job with and without the arguments, and both worked identically. This is a behavior change, in that it modifies the synthesized template, but it has no runtime impact.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
BREAKING CHANGE: Glue job constructs now reject construct-managed and Glue-reserved
arguments passed through
defaultArguments. Previously, a managed argument set viadefaultArgumentswas silently honored inSparkJobandPythonShellJob(customervalue won over the construct default) and silently ignored in
RayJob(constructdefault won). Both behaviors let a caller bypass the construct's security and
observability defaults with no error. Passing any of the following through
defaultArgumentsnow throws aValidationErrorat synthesis time:--enable-continuous-cloudwatch-log,--continuous-log-logGroup,--continuous-log-logStreamPrefix,--continuous-log-conversionPattern,--enable-continuous-log-filter,--enable-metrics,--enable-observability-metrics,--enable-spark-ui,--spark-event-logs-path,--job-language,--class,--extra-jars,--user-jars-first,--extra-py-files,--extra-files,library-set--debug,--mode,--JOB_NAMEConfigure these through their dedicated props instead (
continuousLogging,enableMetrics,enableObservabilityMetrics,sparkUI,className,extraJars,extraJarsFirst,extraPythonFiles,extraFiles). For example, replacedefaultArguments: { '--enable-continuous-cloudwatch-log': 'false' }withcontinuousLogging: { enabled: false }. Arguments without a dedicated prop (e.g.--enable-glue-datacatalog) are unaffected and remain settable viadefaultArguments.The
checkNoReservedArgs(defaultArguments?)method on theJobbase class was removed and replaced withprotected mergeManagedArguments(managedArguments, defaultArguments?)