Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bb post webhooks #694

Merged
45 commits merged into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d3d99e8
WIP - probably does not compile
lordlezehaf Feb 12, 2021
6af9fc5
fixed the merge so it compiles
lordlezehaf Feb 16, 2021
33336a3
Merge branch 'develop' into feature/bb_post_webhooks
lordlezehaf Feb 16, 2021
8b62c33
full path tested for existing BB server
lordlezehaf Feb 17, 2021
1f48770
remove refactoring comments
lordlezehaf Feb 17, 2021
6811927
Postwebhook push events work
lordlezehaf Feb 17, 2021
6417b45
WIP - probably does not compile
nleach999 Feb 12, 2021
0ffbf25
fixed the merge so it compiles
nleach999 Feb 16, 2021
aa9a068
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Feb 16, 2021
7d781c2
full path tested for existing BB server
nleach999 Feb 17, 2021
c5dff2e
remove refactoring comments
nleach999 Feb 17, 2021
4c6bbb8
Postwebhook push events work
nleach999 Feb 17, 2021
371f73c
Merge branch 'feature/bb_post_webhooks' of https://github.com/nleach9…
nleach999 Feb 17, 2021
f61fa6e
WIP - probably does not compile
nleach999 Feb 18, 2021
56cb6b4
fixed the merge so it compiles
nleach999 Feb 18, 2021
3d382d2
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Feb 16, 2021
619e0a4
full path tested for existing BB server
nleach999 Feb 18, 2021
61d41bd
remove refactoring comments
nleach999 Feb 18, 2021
613ec30
Postwebhook push events work
nleach999 Feb 18, 2021
ef95138
Merge branch 'feature/bb_post_webhooks' of https://github.com/nleach9…
nleach999 Feb 17, 2021
ee83d74
added PR DTOs
nleach999 Feb 18, 2021
12fee49
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Feb 18, 2021
4836fc1
full path working
nleach999 Feb 18, 2021
5a1ba71
fixed some logging outputs
nleach999 Feb 18, 2021
22deaa2
reorg handler namespace
nleach999 Feb 18, 2021
1579b85
added project delete capability for postwebhook
nleach999 Feb 19, 2021
20de44c
clarification of delete impl
nleach999 Feb 19, 2021
f930d32
bug fix
nleach999 Feb 19, 2021
1d33bf0
docs update for post webhook
nleach999 Feb 20, 2021
c8a8bf1
removing MERGED event handler
nleach999 Feb 22, 2021
079b274
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Feb 22, 2021
78bed85
comment cleanup
nleach999 Feb 22, 2021
3cc41cd
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Mar 2, 2021
02be434
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Mar 8, 2021
92df366
Fix issues #674, 675
nleach999 Mar 9, 2021
85b5270
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Mar 9, 2021
eca777c
scm multi-instance for BB
nleach999 Mar 22, 2021
e196513
postwebhook branch creation fix
nleach999 Mar 22, 2021
bd4410b
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Mar 22, 2021
fefc042
docs update
nleach999 Mar 22, 2021
b464964
handle empty commit
nleach999 Mar 24, 2021
27a4951
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Mar 24, 2021
6a349f6
Merge branch 'develop' into feature/bb_post_webhooks
nleach999 Mar 31, 2021
a55a2fb
Fix for issue #699
nleach999 Mar 31, 2021
d110178
Merge branch 'develop' of https://github.com/checkmarx-ltd/cx-flow in…
nleach999 Apr 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/Delete-Branch.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

### Deleting CxSAST Project upon Branch Deletion

xFlow is able to create a new CxSAST project when initiating scan, if the project doesn't exist yet.
CxFlow is able to create a new CxSAST project when initiating scan, if the project doesn't exist yet.

When working with CxFlow in web service mode and using webhook events to trigger CxSAST scan, CxFlow will create a new CxSAST project for each SCM feature branch which open a pull request into scanned branch. This might cause flood of projects on CxSAST for feature branch and unexpected consumption of licenses.

Expand Down Expand Up @@ -59,4 +59,10 @@ if the user delete feature-branch manually without complete pull request - CxFlo
[[/Images/ADO_delete_branch.png|github delete webhook event]]


## Bitbucket Server

Bitbucket Server will delete a SAST project **only when using the Post Webhooks plugin**. The current implementation is limited in that:

* Project delete not work if using Config-As-Code given the settings for team and/or project name have been deleted from the branch.
* Project delete will work if the project name is calculated or scripted and the team assigned to the project matches the default team in the CxFlow YAML configuration.

1 change: 1 addition & 0 deletions docs/Frequently-Asked-Questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The table below lists all the supported integrations, features and states the re
| | Pipelines | |
| | Work Items | |
| **BitBucket** | WebHooks | >= 1.4.3 |
| | Post Webhooks (plugin) | >= 3.14.18 |
| | Merge Requests Scanning | |
| | Pull Events | |
| | Issue Tracker | |
Expand Down
Binary file added docs/Images/bb_multi_scm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/postwebhooks_password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/Prerequisites-and-Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The following applications are required:
* Self-signed certificates must be explicitly trusted by installing them into the Java JRE trustsore (cacerts)
* To enable automated scanning orchestration and project creation (WebHook Web Service integration), the source repository must be capable of supporting WebHooks, specifically:
* GitLab
* BitBucket Servr/Cloud
* BitBucket Server/Cloud
* GitHub
* Azure DevOps
* TFS
Expand Down
17 changes: 13 additions & 4 deletions docs/SCM-Multi-instance.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Cx-Flow supports multiple SCM’s accounts: GitHub, GitLab & Azure Devops (instances)
Cx-Flow supports multiple SCM’s accounts: BitBucket, GitHub, GitLab & Azure Devops (instances)

[[/Images/github_multi_instance.png|thresholds screenshot]]

Expand All @@ -23,8 +23,17 @@ In order to override the default SCM’s properties with an optional properties,
[[/Images/multi_instance_url_payload.png|thresholds screenshot]]

* In this example we are settings the scm-instance parameter key with **‘instance2’** value.
* In case the ‘instance2’ name do exists on the configuration file, the default SCM configuration will be overridden with the ‘instance2’ properties.
* In case a not exists scm-instance is defined an exception will be thrown.
* In case none scm-instance was defined as a webhook query parameter, the default configuration will be used.
* If the optional SCM ‘instance2’ configuration is found, the default SCM configuration will be overridden with the ‘instance2’ properties.
* If the specified scm-instance is not defined, an exception will be thrown.
* The default SCM configuration is used if the **scm-instance** query parameter is not provided.


## BitBucket Multi-Instance Configuration

Configuring SCM multi-instance with BitBucket has a slightly different requirement for configuration.

The default BitBucket SCM configuration uses the **url** and **api-path** configuration options to access the API and form URLs that reference the repository. Using SCM multi-instance would generally imply that the **url** configuration option would be overridden. For BitBucket, it is required that the **api-url** configuration option is also provided in each optional SCM configuration.

The **api-url** configuration option must have the full URL for the BitBucket REST API. The image below shows a default BitBucket server configuration with an optional SCM configuration for a separate on-premise BitBucket server and BitBucket cloud.

[[/Images/bb_multi_scm.png|BitBucket multi-SCM configuration]]
38 changes: 32 additions & 6 deletions docs/WebHook-Registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,39 @@ WebHook Events
* When registering Push Events, use http://<cxflow>/ado/push
**Note** Only Push/Pull Create events are currently supported. Token should be sent as Basic Authentication Header.

## <a name="bitbucketcloud">Bitbucket Cloud</a>
Bitbucket cloud does not support a shared key/secret for digitally signing and verifying the request, so we require the token parameter to be passed:
<br> example: http://cxflow?token=XXXXX
<br>XXXX is the pre-shared token value set for `bitbucket.webhook-token` that the CxFlow webservice is using to validate and authenticate requests.

When configuring the API token in CxFlow YML config using the `bitbucket.token` configuration value, the expected format is `<userid>:<access token>`.


## <a name="bitbucketserver">Bitbucket Server</a>
Similar to cloud, but requires a shared secret field, which is used to sign/authenticate the request.

## <a name="bitbucketcloud">Bitbucket Cloud</a>
Bitbucket cloud does not support a shared key/secret for digitally signing and verifying the request, so we require the token paramater to be passed:
<br> example: http://cxflow?token=XXXXX)
<br>XXXX is the pre-shared token that the CxFlow webservice is using to validate and authenticate requests.
<br>When configuring the API token in CxFlow YML config, the <userid>:<access token> is the expected value.
### Native Webhooks
Similar to cloud, but requires a shared secret field, which is used to sign/authenticate the request. The `token` webhook URL parameter used in Bitbucket Cloud is therefore not necessary.

### Post Webhooks
The [Post Webhooks plugin](https://marketplace.atlassian.com/apps/1215474/post-webhooks-for-bitbucket?hosting=server&tab=overview) for Bitbucket server is supported by appending the path `/postwebhook` to the CxFlow webhook URL in the Post Webhooks configuration.

example: `http://cxflow/postwebhook`


Post Webhooks allows global, per-project and per-repository webhook configurations. The native Bitbucket Server webhook configurations are not as flexible. Using Config As Code with a single global webhook configuration may be an effective way to deploy CxFlow to your development organization.



The Post Webhooks plugin does not support signature authentication, so one of the following two options must be used to present the shared key to CxFlow:

* Use the `token` URL parameter<br>
example: `http://cxflow/postwebhook?token=XXXXX`<br><br>


* Use the "Basic Authentication" feature in the Post Webhooks configuration. The username can be omitted from the configuration; the password should be configured to match the `bitbucket.webhook-token` configured value. Example:

[[/Images/postwebhooks_password.png | Post Webhooks token config]]




Loading