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

ER: Create documentation for reviewing CodeQL PRs #6904

Open
3 of 5 tasks
elliot-d-kim opened this issue May 28, 2024 · 6 comments
Open
3 of 5 tasks

ER: Create documentation for reviewing CodeQL PRs #6904

elliot-d-kim opened this issue May 28, 2024 · 6 comments
Assignees
Labels
Complexity: Small Take this type of issues after the successful merge of your second good first issue Draft Issue is still in the process of being created ER Emergent Request Feature: Code Alerts Feature: Onboarding/Contributing.md Feature: Wiki role: back end/devOps Tasks for back-end developers role: front end Tasks for front end developers size: 0.25pt Can be done in 0.5 to 1.5 hours

Comments

@elliot-d-kim
Copy link
Member

elliot-d-kim commented May 28, 2024

Emergent Requirement - Problem

When reviewing PRs that are supposed to resolve CodeQL alerts, there is a lack of documentation on how to verify that the code changes resolve the alert. This expends developer resources and may allow improper code reviews.

Issue you discovered this emergent requirement in

Date discovered

4/19/24

Did you have to do something temporarily

  • YES
  • NO

Who was involved

@gaylem, @t-will-gillis, @marioantonini, @Dartis4

What happens if this is not addressed

  1. Reviewers may spend much more time figuring out how to verify that CodeQL alerts are resolved (or are blocked entirely)
  2. Senior contributors must dedicate more time and attention to helping confused contributors
  3. Alternatively, reviewers approve code changes without properly testing

Resources

Recommended Action Items

  • Make a new issue
  • Discuss with team
  • Let a Team Lead know

Potential solutions [draft]

Verify that the code changes flip the target CodeQL alert from 'Open' to 'Fixed'

  1. Capture CodeQL status on personal fork before code changes
    a. Navigate to personal fork remote repo
    b. From fork, create new branch according to following naming scheme: contributorUsername-issueBranchName. This is to match the name of the branch created later in Step 2a.
    c. Set issue branch as default: Settings > General > Default branch > Switch > select newly created issue branch
    d. Run workflow from branch: Actions > CodeQL Scan > Run workflow > Use workflow from 'Branch: [name of the branch]' > Run workflow
    e. Find target alert: Security > Code scanning > (use filters/details like filename to find the same alert)
    • Note: Alert numbers will not be the same across hackforla repo and personal fork
EG: Before code changes applied: note 'Open' label codeql-alert-open
  1. Integrate proposed code changes into branch to verify CodeQL resolution after code changes
    a. Create branch locally and pull proposed code changes from PR (refer to commandline instructions in Step 3 of 'How to Review Pull Requests')
    b. Modify .github/workflow/codeql.yml: Under on: > push:, set branches: ['name of the branch']
    c. git add, commit, push. This should push the code changes to the branch that was previously created in Step 1, making the two branches one.
    d. At this point, a new workflow run should be queued to be run. Check under Actions > CodeQL Scan
    e. Once workflow finishes, check that the CodeQL alert has been closed: Security > Code scanning > Closed
EG: After code changes applied: note 'Fixed' label codeql-alert-fixed

Other common problems encountered when reviewing CodeQL PRs

Great documentation exists for the following, but contributors would benefit from this documentation being more obviously accessible

  • Personal access tokens (Tip 7 from Hack for LA's GitHub Actions)
    • Not having PATs set up causes failed workflows that may be confusing to reviewers
  • Project board: duplicate from hackforla repo (Tip 6 from Hack for LA's GitHub Actions)
    • Not having classic project board set up causes 'Issue Trigger' workflow to fail
    • Note: Classic project boards (like hackforla's) are being sunsetted and duplication is no longer possible until the project is migrated to the new Projects format.
@elliot-d-kim elliot-d-kim added Feature Missing This label means that the issue needs to be linked to a precise feature label. size: 0.25pt Can be done in 0.5 to 1.5 hours ER Emergent Request role missing Complexity: Missing labels May 28, 2024
Copy link

Hi @elliot-d-kim.

Please don't forget to add the proper labels to this issue. Currently, the labels for the following are missing:

  • Complexity, Role, Feature

NOTE: Please ignore this comment if you do not have 'write' access to this directory.

To add a label, take a look at Github's documentation here.

Also, don't forget to remove the "missing labels" afterwards.
To remove a label, the process is similar to adding a label, but you select a currently added label to remove it.

After the proper labels are added, the merge team will review the issue and add a "Ready for Prioritization" label once it is ready for prioritization.

Additional Resources:

@elliot-d-kim elliot-d-kim added role: front end Tasks for front end developers role: back end/devOps Tasks for back-end developers Feature: Wiki Feature: Onboarding/Contributing.md size: 0.5pt Can be done in 3 hours or less Feature Missing This label means that the issue needs to be linked to a precise feature label. size: 0.25pt Can be done in 0.5 to 1.5 hours role missing Complexity: Small Take this type of issues after the successful merge of your second good first issue and removed Feature Missing This label means that the issue needs to be linked to a precise feature label. role missing size: 0.25pt Can be done in 0.5 to 1.5 hours role: front end Tasks for front end developers role: back end/devOps Tasks for back-end developers Feature: Wiki Feature: Onboarding/Contributing.md size: 0.5pt Can be done in 3 hours or less Complexity: Missing labels May 28, 2024
@elliot-d-kim elliot-d-kim added the ready for dev lead Issues that tech leads or merge team members need to follow up on label May 28, 2024
@ExperimentsInHonesty ExperimentsInHonesty added this to the 08. Team workflow milestone Jun 2, 2024

This comment was marked as outdated.

This comment was marked as outdated.

@roslynwythe
Copy link
Member

@elliot-d-kim you raised a good point in this ER. My assumption had been that if CodeQL did not raise any alerts/annotations in the Pull Request process, we could be assured that the updated code would resolve the alert. Do we understand why that would not be the case? I too have seen instances where CodeQL seems to have failed to flag an issue and I would like to understand more about why that happens. We do still have instances of liquid/YAML code in many files, which is not supported by CodeQL so I'm wondering if that might be the cause of CodQL odd behavior.

@ExperimentsInHonesty
Copy link
Member

@elliot-d-kim - Roslyn left you a message on this issue #6904 (comment)

@ExperimentsInHonesty ExperimentsInHonesty added the Draft Issue is still in the process of being created label Sep 15, 2024
@HackforLABot
Copy link
Contributor

Hi @elliot-d-kim, thank you for taking up this issue! Hfla appreciates you :)

Do let fellow developers know about your:-
i. Availability: (When are you available to work on the issue/answer questions other programmers might have about your issue?)
ii. ETA: (When do you expect this issue to be completed?)

You're awesome!

P.S. - You may not take up another issue until this issue gets merged (or closed). Thanks again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Small Take this type of issues after the successful merge of your second good first issue Draft Issue is still in the process of being created ER Emergent Request Feature: Code Alerts Feature: Onboarding/Contributing.md Feature: Wiki role: back end/devOps Tasks for back-end developers role: front end Tasks for front end developers size: 0.25pt Can be done in 0.5 to 1.5 hours
Projects
Status: New Issue Approval
Development

No branches or pull requests

4 participants