Skip to main content

Prevent Long-Lived Tokens

Type: Rule
ID: bb-project-long-live-tokens
Source: v2/rules/bitbucket/project/long-live-tokens.yaml
Rego Source: long-live-tokens.rego
Labels: Bitbucket, Project

Verify Bitbucket API tokens expire before the maximum time to live.

note

This rule requires Bitbucket Project Discovery Evidence. See here for more details.

tip

Signed Evidence for this rule IS NOT required by default but is recommended.

warning

Rule requires evaluation with a target or an asset input. Without one, it will be disabled unless the --all-evidence flag is provided.

info

Rule is scoped by product and target.

Usage example​

uses: bitbucket/project/long-live-tokens@v2
with:
max_days: 30

Mitigation​

Ensure that Bitbucket API tokens expire before the maximum time to live to reduce the risk of unauthorized access.

Description​

This rule ensures that Bitbucket API tokens expire before the maximum time to live. It performs the following steps:

  1. Checks the settings of the Bitbucket project.
  2. Verifies that tokens expire before the maximum time to live.

Evidence Requirements:

  • Evidence must be provided by the Scribe Platform's CLI tool through scanning Bitbucket project resources.

Evidence Requirements​

FieldValue
filter-by['product', 'target']
signedFalse
content_body_typegeneric
predicate_typehttp://scribesecurity.com/evidence/discovery/v0.1
asset_platformbitbucket
asset_typeproject
labels- platform_instance=bitbucket_dc

Input Definitions​

ParameterTypeRequiredDescriptionDefault
max_daysnumberFalseMaximum number of days a token can be valid.30