Skip to content

feat(glue-alpha): ensure job parameters consistency - #38480

Open
otaviomacedo wants to merge 7 commits into
mainfrom
otaivom/glue/warn-log-without-encryption
Open

feat(glue-alpha): ensure job parameters consistency#38480
otaviomacedo wants to merge 7 commits into
mainfrom
otaivom/glue/warn-log-without-encryption

Conversation

@otaviomacedo

@otaviomacedo otaviomacedo commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The CfnJob L1 takes a defaultArguments property, which are the arguments it runs with by default. The various Job L2 constructs build this argument from two sources:

  1. A defaultArguments provided directly by the user.
  2. Arguments owned by the L2s themselves, but derived from user provided arguments. For instance, if it's a Scala job, it includes --job-language scala; if the user passed continuousLogging.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

{
  defaultArguments: { '--continuous-log-logGroup': 'foo' },
  continuousLogging: { logGroup: 'bar' },
}

Currently, defaultArguments silently 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 passes defaultArguments['--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 defaultArguments as 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 SecurityConfiguration with cloudWatchEncryption is 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-metrics and --enable-observability-metrics arguments that were being emitted by PythonShellJob were removed. They are no-ops, probably copied from SparkJobProps and RayJobProps. 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 via
defaultArguments was silently honored in SparkJob and PythonShellJob (customer
value won over the construct default) and silently ignored in RayJob (construct
default won). Both behaviors let a caller bypass the construct's security and
observability defaults with no error. Passing any of the following through
defaultArguments now throws a ValidationError at synthesis time:

  • construct-managed arguments — --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
  • Glue-reserved arguments — --debug, --mode, --JOB_NAME

Configure these through their dedicated props instead (continuousLogging,
enableMetrics, enableObservabilityMetrics, sparkUI, className, extraJars,
extraJarsFirst, extraPythonFiles, extraFiles). For example, replace
defaultArguments: { '--enable-continuous-cloudwatch-log': 'false' } with
continuousLogging: { enabled: false }. Arguments without a dedicated prop (e.g.
--enable-glue-datacatalog) are unaffected and remain settable via defaultArguments.

The checkNoReservedArgs(defaultArguments?) method on the Job base class was removed and replaced with protected mergeManagedArguments(managedArguments, defaultArguments?)

@github-actions github-actions Bot added the p2 label Aug 3, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team August 3, 2026 09:15
@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ This pull request description does not follow the correct template structure.

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 Closes #123 in the Issue section. If no existing issue matches your change, create one first.

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@otaviomacedo otaviomacedo added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Aug 3, 2026
@aws-cdk-automation
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 aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Aug 3, 2026
@otaviomacedo otaviomacedo changed the title fix(glue-alpha): warn when continuous logging is enabled without log encryption feat(glue-alpha): ensure job parameters consistency Aug 3, 2026
@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Aug 3, 2026
@otaviomacedo otaviomacedo added the pr/breaking-change This PR is a breaking change. It needs to be modified to be allowed in the current major version. label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS. p2 pr/breaking-change This PR is a breaking change. It needs to be modified to be allowed in the current major version. pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr/needs-maintainer-review This PR needs a review from a Core Team Member pr-linter/exempt-integ-test The PR linter will not require integ test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants