Update a repository custom pattern
Updates a secret scanning custom pattern for a repository.
OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”The account owner of the repository. The name is not case sensitive.
The name of the repository without the .git extension. The name is not case sensitive.
The ID of the custom pattern.
Request Body required
Section titled “ Request Body required ”Fields to update on a custom pattern. At least one updatable field (pattern, start_delimiter, end_delimiter, must_match, or must_not_match) must also be provided. Only provided fields will be updated.
object
The updated regular expression of the custom pattern.
The updated start delimiter regex for the custom pattern.
The updated end delimiter regex for the custom pattern.
Updated list of regexes that the secret must match.
Updated list of regexes that the secret must not match.
The 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.
Fields to update on a custom pattern. At least one updatable field (pattern, start_delimiter, end_delimiter, must_match, or must_not_match) must also be provided. Only provided fields will be updated.
object
The updated regular expression of the custom pattern.
The updated start delimiter regex for the custom pattern.
The updated end delimiter regex for the custom pattern.
Updated list of regexes that the secret must match.
Updated list of regexes that the secret must not match.
The 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.
Fields to update on a custom pattern. At least one updatable field (pattern, start_delimiter, end_delimiter, must_match, or must_not_match) must also be provided. Only provided fields will be updated.
object
The updated regular expression of the custom pattern.
The updated start delimiter regex for the custom pattern.
The updated end delimiter regex for the custom pattern.
Updated list of regexes that the secret must match.
Updated list of regexes that the secret must not match.
The 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.
Fields to update on a custom pattern. At least one updatable field (pattern, start_delimiter, end_delimiter, must_match, or must_not_match) must also be provided. Only provided fields will be updated.
object
The updated regular expression of the custom pattern.
The updated start delimiter regex for the custom pattern.
The updated end delimiter regex for the custom pattern.
Updated list of regexes that the secret must match.
Updated list of regexes that the secret must not match.
The 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.
Fields to update on a custom pattern. At least one updatable field (pattern, start_delimiter, end_delimiter, must_match, or must_not_match) must also be provided. Only provided fields will be updated.
object
The updated regular expression of the custom pattern.
The updated start delimiter regex for the custom pattern.
The updated end delimiter regex for the custom pattern.
Updated list of regexes that the secret must match.
Updated list of regexes that the secret must not match.
The 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.
Examples
{ "pattern": "updated_secret_[0-9A-Z]{16}", "start_delimiter": "[^0-9A-Za-z]", "end_delimiter": "[^0-9A-Za-z]", "must_match": [ "updated_secret_[0-9]{2}*" ], "must_not_match": [ "updated_secret_1234567890ABCDEF" ], "custom_pattern_version": "0ujsswThIGTUYm2K8FjOOfXtY1K"}Responses
Section titled “ Responses ”Pattern updated successfully.
A custom pattern for secret scanning.
object
The ID of the custom pattern.
The name of the custom pattern.
The regular expression of the custom pattern.
A URL-friendly identifier for the custom pattern, derived from its name.
The state of the custom pattern.
Whether push protection is enabled for this custom pattern.
The start delimiter regex for the custom pattern.
The end delimiter regex for the custom pattern.
List of regexes that the secret must match.
List of regexes that the secret must not match.
The 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.
The date and time the custom pattern was created in ISO 8601 format.
The date and time the custom pattern was last updated in ISO 8601 format.
Examples
{ "id": 1, "name": "Example Custom Pattern", "pattern": "updated_secret_[0-9A-Z]{16}", "slug": "example_custom_pattern", "state": "published", "push_protection_enabled": true, "start_delimiter": "[^0-9A-Za-z]", "end_delimiter": "[^0-9A-Za-z]", "must_match": [ "updated_secret_[0-9]{2}*" ], "must_not_match": [ "updated_secret_1234567890ABCDEF" ], "custom_pattern_version": "0ujsswThIGTUYm2K8FjOOfXtY1K", "created_at": "2024-01-15T10:30:00Z", "updated_at": "2024-06-01T12:00:00Z"}Bad Request
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Scim Error
object
Example generated
{ "message": "example", "documentation_url": "example", "detail": "example", "status": 1, "scimType": "example", "schemas": [ "example" ]}Forbidden
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Resource not found
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Precondition Failed
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Validation failed, or the endpoint has been spammed.
Validation Error
object
object
Example generated
{ "message": "example", "documentation_url": "example", "errors": [ { "resource": "example", "field": "example", "message": "example", "code": "example", "index": 1, "value": [ "example" ] } ]}