Skip to main content

org_custom_patterns

Creates, updates, deletes, gets or lists an org_custom_patterns resource.

Overview

Nameorg_custom_patterns
TypeResource
Idgithub.secret_scanning.org_custom_patterns

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerThe ID of the custom pattern.
namestringThe name of the custom pattern.
created_atstring (date-time)The date and time the custom pattern was created in ISO 8601 format.
custom_pattern_versionstringThe version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update.
end_delimiterstringThe end delimiter regex for the custom pattern.
must_matcharrayList of regexes that the secret must match.
must_not_matcharrayList of regexes that the secret must not match.
patternstringThe regular expression of the custom pattern.
push_protection_enabledbooleanWhether push protection is enabled for this custom pattern.
slugstringA URL-friendly identifier for the custom pattern, derived from its name.
start_delimiterstringThe start delimiter regex for the custom pattern.
statestringThe state of the custom pattern. (published, unpublished)
updated_atstring (date-time)The date and time the custom pattern was last updated in ISO 8601 format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_org_custom_patternsselectorgstate, push_protection, sort, direction, page, per_pageLists secret scanning custom patterns for an organization.

Personal access tokens (classic) need the read:org scope to use this endpoint.
bulk_create_org_custom_patternsinsertorg, patternsBulk creates secret scanning custom patterns for an organization.

Personal access tokens (classic) need the write:org scope to use this endpoint.
update_org_custom_patternupdateorg, pattern_id, custom_pattern_version, pattern, start_delimiter, end_delimiter, must_match, must_not_matchUpdates a secret scanning custom pattern for an organization.

Personal access tokens (classic) need the write:org scope to use this endpoint.
bulk_delete_org_custom_patternsdeleteorgBulk deletes secret scanning custom patterns for an organization.

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
orgstringThe organization name. The name is not case sensitive.
pattern_idintegerThe ID of the custom pattern.
directionstringThe direction to sort the results by.
pageintegerThe page number of the results to fetch. 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."
push_protectionstringFilter custom patterns by whether push protection is enabled. When absent, returns patterns regardless of push protection status.
sortstringThe property to sort the results by.
statestringFilter custom patterns by state. When absent, returns patterns in all states.

SELECT examples

Lists secret scanning custom patterns for an organization.

Personal access tokens (classic) need the read:org scope to use this endpoint.

SELECT
id,
name,
created_at,
custom_pattern_version,
end_delimiter,
must_match,
must_not_match,
pattern,
push_protection_enabled,
slug,
start_delimiter,
state,
updated_at
FROM github.secret_scanning.org_custom_patterns
WHERE org = '{{ org }}' -- required
AND state = '{{ state }}'
AND push_protection = '{{ push_protection }}'
AND sort = '{{ sort }}'
AND direction = '{{ direction }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;

INSERT examples

Bulk creates secret scanning custom patterns for an organization.

Personal access tokens (classic) need the write:org scope to use this endpoint.

INSERT INTO github.secret_scanning.org_custom_patterns (
patterns,
org
)
SELECT
'{{ patterns }}' /* required */,
'{{ org }}'
RETURNING
created_patterns
;

UPDATE examples

Updates a secret scanning custom pattern for an organization.

Personal access tokens (classic) need the write:org scope to use this endpoint.

UPDATE github.secret_scanning.org_custom_patterns
SET
pattern = '{{ pattern }}',
start_delimiter = '{{ start_delimiter }}',
end_delimiter = '{{ end_delimiter }}',
must_match = '{{ must_match }}',
must_not_match = '{{ must_not_match }}',
custom_pattern_version = '{{ custom_pattern_version }}'
WHERE
org = '{{ org }}' --required
AND pattern_id = '{{ pattern_id }}' --required
AND custom_pattern_version = '{{ custom_pattern_version }}' --required
AND pattern = '{{ pattern }}' --required
AND start_delimiter = '{{ start_delimiter }}' --required
AND end_delimiter = '{{ end_delimiter }}' --required
AND must_match = '{{ must_match }}' --required
AND must_not_match = '{{ must_not_match }}' --required
RETURNING
id,
name,
created_at,
custom_pattern_version,
end_delimiter,
must_match,
must_not_match,
pattern,
push_protection_enabled,
slug,
start_delimiter,
state,
updated_at;

DELETE examples

Bulk deletes secret scanning custom patterns for an organization.

Personal access tokens (classic) need the write:org scope to use this endpoint.

DELETE FROM github.secret_scanning.org_custom_patterns
WHERE org = '{{ org }}' --required
;