Skip to content

chore(security): harden examples and refresh secure-default docs#13

Open
anmolnagpal wants to merge 3 commits intomasterfrom
track-c-security-defaults-examples
Open

chore(security): harden examples and refresh secure-default docs#13
anmolnagpal wants to merge 3 commits intomasterfrom
track-c-security-defaults-examples

Conversation

@anmolnagpal
Copy link

Summary

  • remove broad public ingress patterns from examples
  • align examples to secure defaults and explicit opt-out paths
  • update README/CHANGELOG with migration guidance

Notes

  • PR only; no merge performed.

@anmolnagpal anmolnagpal requested a review from a team as a code owner February 9, 2026 03:35
@gemini-code-assist
Copy link

Summary of Changes

Hello @anmolnagpal, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the security posture of the repository's examples by shifting towards secure-by-default configurations, particularly for network access. It also improves documentation to clearly articulate these secure defaults and provides guidance for scenarios requiring public access. Furthermore, a new workflow baseline document establishes clear guidelines for CI/CD practices, aiming to reduce supply-chain risk and improve reproducibility.

Highlights

  • Security Hardening in Examples: Updated Key Vault and MySQL examples to enforce secure-by-default configurations, specifically disabling public network access and removing broad IP ingress rules (0.0.0.0/0).
  • Documentation Refresh: Added a new 'Security Notes' section to the README.md to guide users on secure defaults and explicit opt-out paths for public networking. The CHANGELOG.md was also updated with migration guidance.
  • Workflow Baseline Introduction: Introduced a new WORKFLOW_BASELINE.md document outlining organizational standards for GitHub collaboration and CI hygiene, including policies for reusable workflow references and pull request requirements.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .github/WORKFLOW_BASELINE.md
    • Added a new document defining the organization-level baseline for GitHub collaboration and CI hygiene.
    • Outlined policies for reusable workflow references, emphasizing immutable refs (pinned commit SHA or release tag).
    • Defined pull request baseline requirements, including Conventional Commit titles and mandatory CI checks.
    • Specified Terraform module baseline standards for terraform.required_version, required_providers, and pinned shared workflow refs.
  • CHANGELOG.md
    • Added an entry for hardened dependent Key Vault configuration, setting public_network_access_enabled = false and ip_rules = [].
    • Included an entry for aligning MySQL examples with secure-by-default networking (public_network_access = "Disabled") and removing stale public-access flags.
    • Added an entry for documentation updates, specifically explicit opt-out guidance for public networking.
  • README.md
    • Appended a new 'Security Notes' section to provide guidance on secure defaults for examples (public_network_access = "Disabled") and instructions for explicit opt-out for public deployments.
  • examples/complete/example.tf
    • Modified the module "vault" configuration to set public_network_access_enabled to false.
    • Updated the network_acls.ip_rules for the vault module from ["0.0.0.0/0"] to [].
  • examples/mysql_with_private_endpoint/example.tf
    • Modified the module "vault" configuration to set public_network_access_enabled to false.
    • Updated the network_acls.ip_rules for the vault module from ["0.0.0.0/0"] to [].
Ignored Files
  • Ignored by pattern: .github/workflows/** (7)
    • .github/workflows/automerge.yml
    • .github/workflows/checkov.yml
    • .github/workflows/pr_checks.yml
    • .github/workflows/stale_pr.yml
    • .github/workflows/tag-release.yml
    • .github/workflows/terraform-diff.yml
    • .github/workflows/tf-checks.yml
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to harden the examples and update documentation. The changes correctly disable public network access for the Key Vault in the examples, which is a great security improvement. I've added a few comments regarding documentation consistency and dependency versions in one of the examples. Specifically, the new documentation in the README and CHANGELOG focuses on MySQL security settings, while the code changes are for the Key Vault. Aligning these would improve clarity. Also, updating module versions in the examples would be beneficial.

CHANGELOG.md Outdated
## Unreleased

- examples: hardened dependent Key Vault configuration (`public_network_access_enabled = false`, `ip_rules = []`).
- examples: aligned MySQL examples with secure-by-default networking (`public_network_access = "Disabled"`) and removed stale public-access flags.

Choose a reason for hiding this comment

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

medium

This changelog entry suggests that MySQL examples were updated to use public_network_access = "Disabled". However, the examples already had this configuration. The actual code change in this PR is for the dependent Key Vault. Please update this line to accurately describe the hardening of the Key Vault configuration to avoid confusion.

README.md Outdated
Comment on lines 271 to 272
Examples are aligned to secure defaults (`public_network_access = "Disabled"` and private DNS/private endpoint patterns).
For public deployments, opt out explicitly by setting `public_network_access = "Enabled"` and configuring firewall rules with least privilege.

Choose a reason for hiding this comment

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

medium

This security note correctly highlights the secure default for public_network_access. However, the code changes in this PR are focused on hardening the associated Key Vault by disabling its public network access. To improve clarity and accurately reflect the PR's changes, consider also mentioning the Key Vault hardening here. As it stands, this note might imply that the MySQL settings were changed, but they were already secure.

location = module.resource_group.resource_group_location
subnet_id = module.subnet.subnet_ids.subnet2
public_network_access_enabled = true
public_network_access_enabled = false

Choose a reason for hiding this comment

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

medium

While you're hardening the security of this example, it's a good opportunity to also update the versions of the modules being used. The key-vault module is at version 1.0.1 here, while the complete example uses 1.0.4. Similarly, the private-dns module is at 1.0.2 here, but 1.0.4 in the other example. Using the latest versions ensures you have the latest features and security fixes. Please consider updating these for consistency.

@anmolnagpal
Copy link
Author

[gemini-followup-2026-02-09]
Thanks @gemini-code-assist — reviewed the feedback. No repository-local code changes are required at this point; feedback is either informational or blocked by org-level workflow policy configuration.

Where CI is red on title validation, the failure is due to the org reusable workflow regex configuration (terraform-az-modules/.github#29), not this branch's module code.

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@anmolnagpal
Copy link
Author

[gemini-followup-2026-02-09]
Reviewed Gemini feedback for this PR. Resolution: addressed/non-blocking for this branch. If PR-title CI fails, it's blocked by org-level workflow regex config (terraform-az-modules/.github#29), not module code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants