Skip to content

Update diff review process to start with GuardDog and Semgrep#289

Merged
legoktm merged 4 commits intofreedomofpress:mainfrom
ChumOfChance:update-diff-review
Mar 5, 2026
Merged

Update diff review process to start with GuardDog and Semgrep#289
legoktm merged 4 commits intofreedomofpress:mainfrom
ChumOfChance:update-diff-review

Conversation

@ChumOfChance
Copy link

Fixes freedomofpress/securedrop-dev#34

This is an initial stab at adding instructions and guidance for running GuardDog and Semgrep on updated dependencies across SecureDrop projects. I pulled from internal notes from @adaFPF when working on this.

There might be other changes to make. The goal is to deprecate or at least de-prioritize doing manual diff reviews. I left those instructions intact, because a manual diff review may still be warranted in some cases. But perhaps some of the steps should be modified or removed (e.g. adding an entry to the wiki).

I also did not include specific instructions/guidelines for logging results of Guarddog/semgrep scans, for example in a dependency update PR. I think this would be a good idea but I'm not sure if there is a preferred convention.

Checklist

This change accounts for:

  • local preview of changes beyond typo-level edits

@legoktm legoktm self-assigned this Feb 20, 2026
@legoktm legoktm moved this to Ready For Review in SecureDrop Feb 20, 2026
@ChumOfChance ChumOfChance removed the status in SecureDrop Feb 23, 2026
@ChumOfChance ChumOfChance moved this to Under Review in SecureDrop Feb 23, 2026
Copy link
Member

@legoktm legoktm left a comment

Choose a reason for hiding this comment

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

Thanks, this is really great. I primarily have some process questions

alias guarddog='docker run --rm ghcr.io/datadog/guarddog'

.. note:: GuardDog fails quietly, and scans that did not run produce output similar to a successful scan with no findings. For this reason, you should pass ``--log-level debug`` with every invocation.

Copy link
Member

Choose a reason for hiding this comment

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

"If there are no issues, it is safe to proceed with the dependency update. If guarddog does find issues, you should ???"

Maybe: ...you should read the source code and see if it's a false positive. Ask in the security chat for a second opinion/confirmation. ?

Copy link
Author

Choose a reason for hiding this comment

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

I had a similar question myself about how much details the docs should provide for following up/interpreting the results. I could include an example of GuardDog output with a finding.

* Note: we trust packages managed by the `Python Packaging Authority <https://www.pypa.io/en/latest/>`_
(PyPA) and don't diff review them.
3. **Explain version specifiers:** Use comments in ``.in`` or ``pyproject.toml``
- For dependencies with lower trust or otherwise requiring heightened scrutiny, use :ref:`Semgrep <scan-semgrep>` to locally scan the updated version of the dependency. Semgrep is an all-purpose static code analysis tool.
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I would like us to be able to provide specific guidance on what constitutes "lower trust or otherwise requiring heightened scrutiny". Did you have anything in mind on how we evaluate that?

Copy link
Author

Choose a reason for hiding this comment

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

The best guidance I'm aware of that we presently have is the earlier section on criteria for "Adding a dependency" https://developers.securedrop.org/en/latest/dependency_updates.html#adding-a-dependency which probably needs to be updated now that we are in an npm world.

It is mostly qualitative (as any revision would be I think). I think to update that and make it clearer we would want to loop in @redshiftzero

@ChumOfChance
Copy link
Author

I added a small edit to reflect the convention for comments in package.json for pnpm-managed projects established here: freedomofpress/securedrop-client#3133

I don't think it's necessary to document the syntax, anyone adding a comment should be able to follow the convention in the file, as with the dependency files e.g. .in

Copy link
Member

@legoktm legoktm left a comment

Choose a reason for hiding this comment

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

Thanks, I think this is a good start and we can iterate as we gain more experience using guarddog and see what needs further clarification / what questions arise.

@legoktm legoktm added this pull request to the merge queue Mar 5, 2026
Merged via the queue into freedomofpress:main with commit 159aace Mar 5, 2026
2 checks passed
@github-project-automation github-project-automation bot moved this from Under Review to Done in SecureDrop Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Implement changes to diff review process

2 participants