CI / CD パイプラインを使用して DAG を環境にデプロイし、DAG コードがリポジトリから取得されるようにします。このようにして、変更がバージョン管理システムにマージされる前に DAG が審査され、承認されます。レビュー プロセス中に、承認者は DAG がチーム内で確立されたセキュリティ基準を満たしていることを確認します。確認のステップは、環境のバケットの内容を変更する DAG のデプロイを防ぐために重要です。
環境にプライベート IP ネットワーキング タイプを使用して、環境の Airflow コンポーネントがインターネットにアクセスできないようにします。また、このようにすることで、プライベート Google アクセスが private.googleapis.com 範囲で構成されるため、この範囲でサポートされている Google API、サービス、ドメインにアクセスできるようになります。
個人情報やパスワードなどのセンシティブ データを渡す場合は注意が必要です。必要に応じて、Secret Manager を使用して、Airflow 接続と Airflow シークレット、API キー、パスワード、証明書を安全に保存します。この情報は DAG や環境変数に保存しないでください。
環境のバケットに対する IAM 権限は、信頼できるユーザーにのみ付与します。可能な場合には、オブジェクトごとの権限を使用します。環境のサービス アカウントのセキュリティに関する考慮事項では、環境のバケットにアクセスできるユーザーが環境のサービス アカウントに代わってアクションを実行するための方法のいくつかが示されています。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-02-19 UTC。"],[[["\u003cp\u003eSecuring Cloud Composer environments involves implementing best practices for network security, Identity and Access Management (IAM), encryption, and environment configuration management to safeguard sensitive data and prevent unauthorized access.\u003c/p\u003e\n"],["\u003cp\u003eUtilize version control with tools like Terraform for environment configuration and CI/CD pipelines for DAG deployment to ensure reviewed and approved changes, reducing the number of users with direct modification permissions.\u003c/p\u003e\n"],["\u003cp\u003eEmploy Private IP networking, disable internet access for PyPI package installation, and configure firewall rules in connected VPC networks to enhance network security and limit external access to Airflow components.\u003c/p\u003e\n"],["\u003cp\u003eIsolate permissions by creating dedicated service accounts for different environments, adhering to the principle of least privilege, and regularly auditing IAM roles to minimize the risk of unauthorized access or unintended permissions.\u003c/p\u003e\n"],["\u003cp\u003eAvoid storing sensitive data in DAGs or environment variables, instead use Secret Manager to securely store Airflow connections, API keys, and other sensitive credentials, and restrict access to the environment's bucket and snapshots to trusted users.\u003c/p\u003e\n"]]],[],null,["# Security best practices\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n**Cloud Composer 3** \\| [Cloud Composer 2](/composer/docs/composer-3/security-practices \"View this page for Cloud Composer 2\") \\| [Cloud Composer 1](/composer/docs/composer-1/security-practices \"View this page for Cloud Composer 1\")\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nSecuring your Cloud Composer environment is crucial for protecting\nsensitive data and preventing unauthorized access. This page outlines key best\npractices, including recommendations for network security, Identity and Access Management,\nencryption, and environment configuration management.\n\nTo get more information about security features available in\nCloud Composer, see [Security overview](/composer/docs/composer-3/composer-security-overview).\n\nManage environment configuration and DAGs using version control\n---------------------------------------------------------------\n\n[](/static/composer/docs/images/composer-airflow-secure-cicd.svg) **Figure 1.** An example of an Airflow CI/CD pipeline (click to enlarge)\n\n- [Create your environment using Terraform](/composer/docs/composer-3/terraform-create-environments).\n In this way, you can store environment's configuration as code in a\n repository. In this way, changes to your environment configuration can be\n reviewed before they are applied, and you can reduce the number of users\n who have permissions to change the configuration by assigning roles with\n less permissions.\n\n- In Identity and Access Management, disable direct access to DAGs and environment's\n configuration to regular users, as detailed in the\n [Identity and Access Management](#iam-security) section.\n\n- [Deploy DAGs in your environment with a CI/CD pipeline](/composer/docs/composer-3/dag-cicd-github),\n so that DAG code is retrieved from a repository. In this way, DAGs are\n reviewed and approved before the changes are merged to the version control\n system. During the review process, approvers make sure that DAGs meet the\n security criteria established within their teams. The review step is\n critical to prevent deployment of DAGs that might perform unwanted actions.\n\n Some important security aspects to take into account when reviewing DAGs\n are:\n - DAGs that modify the content of the environment's bucket must not modify\n the code of other DAGs or access sensitive data, unless intended.\n\n - DAGs must not make direct queries to the Airflow database, unless\n intended. A DAG in a Cloud Composer environment has\n access to all tables in the Airflow database. It is possible to retrieve\n information from any table, process it, and then store it outside of the\n Airflow database.\n\nNetwork security\n----------------\n\n- Use [Private IP networking type](/composer/docs/composer-3/change-networking-type) for your environments so that\n Airflow components of the environment don't have access to the internet and\n their Private Google Access is configured through the\n `private.googleapis.com` range, which enables access to Google APIs,\n services, and domains supported by this range.\n\n- [Disable access to the internet when installing PyPI packages](/composer/docs/composer-3/packages-internet-access).\n Instead, use an Artifact Registry repository\n [as the only source of packages](/composer/docs/composer-3/install-python-dependencies#install-ar-repo).\n\n- Review the firewall rules\n [in the VPC network connected to yor environment](/composer/docs/composer-3/connect-vpc-network) (if\n connected). Depending on the way you configure them, Airflow components of\n your environment, such as Airflow workers that run your DAGs, might access\n the internet through your VPC network.\n\n\nIdentity and Access Management\n------------------------------\n\n- Isolate permissions.\n [Create environment service accounts](/composer/docs/composer-3/access-control#service-account)\n and use different service accounts for different environments. Assign to\n these service accounts only permissions that are strictly necessary to\n operate these environments and perform operations defined in Airflow DAGs\n that they run.\n\n- Avoid using service accounts with broad permissions. While it\n is possible to create an environment that uses an account with broad\n permissions, such as those granted by the **Editor** basic role, this\n creates a risk of DAGs using broader permissions than intended.\n\n- Don't rely on default service accounts of Google services used by\n Cloud Composer. It is often impossible to reduce permissions\n available to these service accounts without also affecting other Google\n services in your project.\n\n- Make sure that you are familiar with\n [security considerations for environment's service accounts](/composer/docs/composer-3/access-control#service-account-security)\n and understand how this account interacts with permissions and roles that\n you grant to individual users in your project.\n\n- Adhere to the principle of least privilege. Grant only the minimum necessary\n permissions to users. For example,\n [assign IAM roles](/composer/docs/composer-3/access-control#user-account), so that only\n administrators can access the environment's bucket\n ,\n and direct access is disabled for regular users. For example, the\n **Composer User** role enables access only to DAG UI and Airflow UI.\n\n- Enforce [Airflow UI Access Control](/composer/docs/composer-3/airflow-rbac), which allows to reduce\n visibility in Airflow UI and DAG UI based on user's Airflow role, and can be\n used to assign DAG-level permissions for individual DAGs.\n\n- Review regularly. Regularly audit IAM permissions and roles\n to identify and remove any excessive or unused privileges.\n\n- Beware of passing and storing sensitive data:\n\n - Exercise caution when passing storing sensitive data like personally\n identifiable information or passwords. Where required,\n [use Secret Manager](/composer/docs/composer-3/configure-secret-manager) to\n securely store Airflow connections and Airflow secrets, API keys,\n passwords, and certificates. Don't store this information in your DAGs\n or environment variables.\n\n - Grant IAM permissions to the environment's bucket only\n to trusted users. Use per-object permissions, if possible.\n [Security considerations for environment's service accounts](/composer/docs/composer-3/access-control#service-account-security)\n list several ways in which users with access to the environment's\n bucket can perform actions on behalf of the environment's service\n account.\n\n - Make sure that you are familiar with\n [what data is stored in the snapshots](/composer/docs/composer-3/save-load-snapshots) and provide\n permissions to create environment snapshots and access the bucket where\n they are stored only to trusted users.\n\n - All Cloud Composer's external interfaces use encryption by\n default. When connecting to external products and services, make sure\n that you use encrypted communication (SSL/TLS).\n\nWhat's next\n-----------\n\n- [Security overview](/composer/docs/composer-3/composer-security-overview)\n- [Access control with IAM](/composer/docs/composer-3/access-control)\n- [Airflow UI Access Control](/composer/docs/composer-3/airflow-rbac)\n- [Airflow summit presentation about DAG security](https://www.youtube.com/watch?v=QhnItssm4yU)"]]