Skip to main content

code_security_configurations

Creates, updates, deletes, gets or lists a code_security_configurations resource.

Overview

Namecode_security_configurations
TypeResource
Idgithub.code_security.code_security_configurations

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerThe ID of the code security configuration
namestringThe name of the code security configuration. Must be unique within the organization.
advanced_securitystringThe enablement status of GitHub Advanced Security (enabled, disabled, code_security, secret_protection)
code_scanning_default_setupstringThe enablement status of code scanning default setup (enabled, disabled, not_set)
code_scanning_default_setup_optionsobjectFeature options for code scanning default setup
code_scanning_delegated_alert_dismissalstringThe enablement status of code scanning delegated alert dismissal (enabled, disabled, not_set)
code_scanning_optionsobjectFeature options for code scanning
created_atstring (date-time)
dependabot_alertsstringThe enablement status of Dependabot alerts (enabled, disabled, not_set)
dependabot_delegated_alert_dismissalstringThe enablement status of Dependabot delegated alert dismissal (enabled, disabled, not_set)
dependabot_security_updatesstringThe enablement status of Dependabot security updates (enabled, disabled, not_set)
dependency_graphstringThe enablement status of Dependency Graph (enabled, disabled, not_set)
dependency_graph_autosubmit_actionstringThe enablement status of Automatic dependency submission (enabled, disabled, not_set)
dependency_graph_autosubmit_action_optionsobjectFeature options for Automatic dependency submission
descriptionstringA description of the code security configuration
enforcementstringThe enforcement status for a security configuration (enforced, unenforced)
html_urlstring (uri)The URL of the configuration
private_vulnerability_reportingstringThe enablement status of private vulnerability reporting (enabled, disabled, not_set)
secret_scanningstringThe enablement status of secret scanning (enabled, disabled, not_set)
secret_scanning_delegated_alert_dismissalstringThe enablement status of secret scanning delegated alert dismissal (enabled, disabled, not_set)
secret_scanning_delegated_bypassstringThe enablement status of secret scanning delegated bypass (enabled, disabled, not_set)
secret_scanning_delegated_bypass_optionsobjectFeature options for secret scanning delegated bypass
secret_scanning_extended_metadatastringThe enablement status of secret scanning extended metadata (enabled, disabled, not_set)
secret_scanning_generic_secretsstringThe enablement status of Copilot secret scanning (enabled, disabled, not_set)
secret_scanning_non_provider_patternsstringThe enablement status of secret scanning non-provider patterns (enabled, disabled, not_set)
secret_scanning_push_protectionstringThe enablement status of secret scanning push protection (enabled, disabled, not_set)
secret_scanning_validity_checksstringThe enablement status of secret scanning validity checks (enabled, disabled, not_set)
target_typestringThe type of the code security configuration. (global, organization, enterprise)
updated_atstring (date-time)
urlstring (uri)The URL of the configuration

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_single_configuration_for_enterpriseselectenterprise, configuration_idGets a code security configuration available in an enterprise.

The authenticated user must be an administrator of the enterprise in order to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.
get_configurationselectorg, configuration_idGets a code security configuration available in an organization.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
get_configurations_for_enterpriseselectenterpriseper_page, before, afterLists all code security configurations available in an enterprise.

The authenticated user must be an administrator of the enterprise in order to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.
get_configurations_for_orgselectorgtarget_type, per_page, before, afterLists all code security configurations available in an organization.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.
attach_enterprise_configurationinsertenterprise, configuration_id, scopeAttaches an enterprise code security configuration to repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.

If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.

The authenticated user must be an administrator for the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
attach_configurationinsertorg, configuration_id, scopeAttach a code security configuration to a set of repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.

If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
create_configuration_for_enterpriseinsertenterprise, name, descriptionCreates a code security configuration in an enterprise.

The authenticated user must be an administrator of the enterprise in order to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
create_configurationinsertorg, name, descriptionCreates a code security configuration in an organization.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
update_enterprise_configurationupdateenterprise, configuration_idUpdates a code security configuration in an enterprise.

The authenticated user must be an administrator of the enterprise in order to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
update_configurationupdateorg, configuration_idUpdates a code security configuration in an organization.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
set_configuration_as_default_for_enterprisereplaceenterprise, configuration_idSets a code security configuration as a default to be applied to new repositories in your enterprise.

This configuration will be applied by default to the matching repository type when created, but only for organizations within the enterprise that do not already have a default code security configuration set.

The authenticated user must be an administrator for the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
set_configuration_as_defaultreplaceorg, configuration_idSets a code security configuration as a default to be applied to new repositories in your organization.

This configuration will be applied to the matching repository type (all, none, public, private and internal) by default when they are created.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
delete_configuration_for_enterprisedeleteenterprise, configuration_idDeletes a code security configuration from an enterprise.
Repositories attached to the configuration will retain their settings but will no longer be associated with
the configuration.

The authenticated user must be an administrator for the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
delete_configurationdeleteorg, configuration_idDeletes the desired code security configuration from an organization.
Repositories attached to the configuration will retain their settings but will no longer be associated with
the configuration.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
detach_configurationdeleteorgDetach code security configuration(s) from a set of repositories.
Repositories will retain their settings but will no longer be associated with the configuration.

The authenticated user must be an administrator or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
configuration_idintegerThe unique identifier of the code security configuration.
enterprisestringThe slug version of the enterprise name.
orgstringThe organization name. The name is not case sensitive.
afterstringA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
beforestringA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
target_typestringThe target type of the code security configuration

SELECT examples

Gets a code security configuration available in an enterprise.

The authenticated user must be an administrator of the enterprise in order to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.

SELECT
id,
name,
advanced_security,
code_scanning_default_setup,
code_scanning_default_setup_options,
code_scanning_delegated_alert_dismissal,
code_scanning_options,
created_at,
dependabot_alerts,
dependabot_delegated_alert_dismissal,
dependabot_security_updates,
dependency_graph,
dependency_graph_autosubmit_action,
dependency_graph_autosubmit_action_options,
description,
enforcement,
html_url,
private_vulnerability_reporting,
secret_scanning,
secret_scanning_delegated_alert_dismissal,
secret_scanning_delegated_bypass,
secret_scanning_delegated_bypass_options,
secret_scanning_extended_metadata,
secret_scanning_generic_secrets,
secret_scanning_non_provider_patterns,
secret_scanning_push_protection,
secret_scanning_validity_checks,
target_type,
updated_at,
url
FROM github.code_security.code_security_configurations
WHERE enterprise = '{{ enterprise }}' -- required
AND configuration_id = '{{ configuration_id }}' -- required
;

INSERT examples

Attaches an enterprise code security configuration to repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.

If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.

The authenticated user must be an administrator for the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

INSERT INTO github.code_security.code_security_configurations (
scope,
enterprise,
configuration_id
)
SELECT
'{{ scope }}' /* required */,
'{{ enterprise }}',
'{{ configuration_id }}'
;

UPDATE examples

Updates a code security configuration in an enterprise.

The authenticated user must be an administrator of the enterprise in order to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

UPDATE github.code_security.code_security_configurations
SET
name = '{{ name }}',
description = '{{ description }}',
advanced_security = '{{ advanced_security }}',
code_security = '{{ code_security }}',
dependency_graph = '{{ dependency_graph }}',
dependency_graph_autosubmit_action = '{{ dependency_graph_autosubmit_action }}',
dependency_graph_autosubmit_action_options = '{{ dependency_graph_autosubmit_action_options }}',
dependabot_alerts = '{{ dependabot_alerts }}',
dependabot_security_updates = '{{ dependabot_security_updates }}',
code_scanning_default_setup = '{{ code_scanning_default_setup }}',
code_scanning_default_setup_options = '{{ code_scanning_default_setup_options }}',
code_scanning_options = '{{ code_scanning_options }}',
code_scanning_delegated_alert_dismissal = '{{ code_scanning_delegated_alert_dismissal }}',
secret_protection = '{{ secret_protection }}',
secret_scanning = '{{ secret_scanning }}',
secret_scanning_push_protection = '{{ secret_scanning_push_protection }}',
secret_scanning_validity_checks = '{{ secret_scanning_validity_checks }}',
secret_scanning_non_provider_patterns = '{{ secret_scanning_non_provider_patterns }}',
secret_scanning_generic_secrets = '{{ secret_scanning_generic_secrets }}',
secret_scanning_delegated_alert_dismissal = '{{ secret_scanning_delegated_alert_dismissal }}',
secret_scanning_extended_metadata = '{{ secret_scanning_extended_metadata }}',
private_vulnerability_reporting = '{{ private_vulnerability_reporting }}',
enforcement = '{{ enforcement }}'
WHERE
enterprise = '{{ enterprise }}' --required
AND configuration_id = '{{ configuration_id }}' --required
RETURNING
id,
name,
advanced_security,
code_scanning_default_setup,
code_scanning_default_setup_options,
code_scanning_delegated_alert_dismissal,
code_scanning_options,
created_at,
dependabot_alerts,
dependabot_delegated_alert_dismissal,
dependabot_security_updates,
dependency_graph,
dependency_graph_autosubmit_action,
dependency_graph_autosubmit_action_options,
description,
enforcement,
html_url,
private_vulnerability_reporting,
secret_scanning,
secret_scanning_delegated_alert_dismissal,
secret_scanning_delegated_bypass,
secret_scanning_delegated_bypass_options,
secret_scanning_extended_metadata,
secret_scanning_generic_secrets,
secret_scanning_non_provider_patterns,
secret_scanning_push_protection,
secret_scanning_validity_checks,
target_type,
updated_at,
url;

REPLACE examples

Sets a code security configuration as a default to be applied to new repositories in your enterprise.

This configuration will be applied by default to the matching repository type when created, but only for organizations within the enterprise that do not already have a default code security configuration set.

The authenticated user must be an administrator for the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

REPLACE github.code_security.code_security_configurations
SET
default_for_new_repos = '{{ default_for_new_repos }}'
WHERE
enterprise = '{{ enterprise }}' --required
AND configuration_id = '{{ configuration_id }}' --required
RETURNING
configuration,
default_for_new_repos;

DELETE examples

Deletes a code security configuration from an enterprise.
Repositories attached to the configuration will retain their settings but will no longer be associated with
the configuration.

The authenticated user must be an administrator for the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

DELETE FROM github.code_security.code_security_configurations
WHERE enterprise = '{{ enterprise }}' --required
AND configuration_id = '{{ configuration_id }}' --required
;