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

Dump configuration in the results directory #227

Merged
merged 10 commits into from
Oct 21, 2024
Merged

Conversation

ccronca
Copy link
Collaborator

@ccronca ccronca commented Oct 18, 2024

This PR adds functionality to create a redacted version of a YAML configuration file by removing sensitive information under the path *.authentication.parameters. If a default Rapidast configuration exists, it will also be copied to the target directory.

The directory where the redacted config is saved is determined by the configuration file itself, so the config must be loaded first. If loading fails, the redaction can't proceed, and the file won't be dumped to avoid exposing sensitive information.

If the config can't be dumped due to file system or parsing issues, the scan process will stop, as this signals a critical problem.

ccronca and others added 6 commits July 13, 2024 09:17
* Crawl fail openshift (#187)

* Scanners: group temporary dirs into a same parent

RapidastScanner._create_temp_dir now gather all the temporary
directories under a single one. Easier cleanup

* ZAP: change HOME if it is not writable

Firefox requires a home directory.
When crawling (Ajax spider), in Openshift, Firefox is unable to start if
it can't write a ~/.firefox

This is an issue in Openshift, where the user is created on the fly and
its home directory is '/'.

In that case, create a temporary directory, and assign HOME to it.

* undo pre-commit change, to run on older pythong

* Updated ZAP image url with the latest one (#189)

updated ZAP image url with the latest one

* updated zap default image url with the latest one in ZapPodman (#190)

* require pre-commit for dev (#191)

* Export to Google Cloud Storage (#192)

* Export to Google Cloud Storage

This commit adds a new export.
It re-uses the original DefectDojo export.

configuration:

```yaml
config:
  googleCloudStorage:
    keyFile: "<path-to-ondisk-GCS-key>"
    bucketName: "<bucket-name>"
    directory: "<optional-directory-name>"

general:
  defectDojoExport:
    parameters:
      # values for defectdojo's import-scan endpoint
```

Note: the generic scanner hasn't been tested yet

* remove test description, rephrase example comments

* removed some comment refering to DeDo in GCS

* reworked defectdojo data to make it optional

Latest changes:
Now the defectDojoExport is no longer needed: data will still be exported if either googleCloudStorage or defectDojo are set.
Note: It is still possible to prevent a particular scan to be exported by setting defectDojoExport: False for that scan (e.g.: RapiDAST runs 2 scans, out of which only 1 should be exported)

As explained in the README: if defectDojoExport is missing:

product_name will be derived from either application.productName or application.shortName
engagement_name will be RapiDAST-{product_name}-<date>

* updated the ZAP path in the config template for MacOS since ZAP no longer belong to OWASP (#193)

updated the path since ZAP no longer belong to OWASP

* Gcs tests (#194)

* [unittests] GCS export

* Added unittests for exports/gcs

Note/todo: ideally, it would be great to test the content of the tarball
created.

* [gcs unittest] added engagement and product to unittest

* Readme updated (#195)

readme updated: 1. separated GCS export from DefectDojo 2. removed 'OWASP' in the binary path for MacOS

* [ZAP] Ajax spider requires a lot of shared memory (#196)

* [ZAP] Ajax spider requires a lot of shared memory

The Selenium environment set up by ZAP for the Ajax Spider requires a
lot of shared memory (/dev/shm in Linux)

This commit does the following:
- Update the README troubleshooting section, for when the RapiDAST image
  is used
- In Podman mode: if Ajax is used, automatically ask podman to have 2GB
  of shared memory
- Added corresponding pytest
- Fixed `find_context()`, which broke when context was not found (that
  should happen only in pytest)

---------

Co-authored-by: Cedric Buissart <[email protected]>
Co-authored-by: Jeremy Bonghwan Choi <[email protected]>
@ccronca ccronca marked this pull request as draft October 18, 2024 11:24
…_config_creates_destination_dir_when_config_file_not_found
@ccronca ccronca changed the title Dump configuration in the results directory #226 Dump configuration in the results directory Oct 18, 2024
@ccronca ccronca self-assigned this Oct 18, 2024
@ccronca ccronca marked this pull request as ready for review October 18, 2024 13:12
rapidast.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@jeremychoi jeremychoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. pls merge.

@ccronca ccronca merged commit ee14d55 into development Oct 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants