Skip to content

Conversation

@abstractj
Copy link
Contributor

@abstractj abstractj commented Feb 25, 2025

Signed-off-by: Bruno Oliveira da Silva [email protected]

Closes #33544

Note: PR must be merged only after the approval of the assignee, considering the impact of those changes.

Workflows tested in a controlled environment and reporting green

  • Scheduled nightly workflows
  • Keycloak CI
  • Keycloak Documentation
  • Keycloak JavaScript CI
  • Keycloak Operator CI
  • CodeQL
  • Snyk
  • Trivy
  • Aurora Delete
  • Keycloak Guides
  • Labeller
  • Quarkus Next
  • Weblate Sync

Scorecard update based on proposed changes

Screenshot From 2025-02-25 19-50-14

@abstractj
Copy link
Contributor Author

@ahus1 @mhajas whenever you have some time, could you please review the changes in the Aurora workflow? I just want to ensure that this won't be broken.

@abstractj abstractj force-pushed the issue-33544 branch 2 times, most recently from 3f80058 to b9d9509 Compare February 25, 2025 22:48
@abstractj
Copy link
Contributor Author

@keycloak/cloud-native whenever you have the time could you please review the quarkus next workflow?

@abstractj abstractj added the area/ci Indicates an issue on the CI label Feb 25, 2025
@abstractj abstractj requested a review from a team February 25, 2025 22:51
@abstractj abstractj requested a review from a team February 25, 2025 22:51
@abstractj abstractj requested a review from a team February 25, 2025 22:51
@abstractj abstractj requested review from a team February 25, 2025 22:52
@ahus1
Copy link
Contributor

ahus1 commented Feb 26, 2025

@abstractj - this should be fine for the Aurora DB flow. Please proceed.

FYI: This steps will run only on the release branches and in main due to the secrets that they use.

@abstractj abstractj marked this pull request as ready for review February 26, 2025 12:54
@abstractj abstractj requested a review from a team as a code owner February 26, 2025 12:54
contents: read
issues: write

pull-requests: write # Required to add labels to pull-requests
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not adding labels to pull-requests, but rather issues. So guess should be issues: write.

Copy link
Contributor Author

@abstractj abstractj Feb 26, 2025

Choose a reason for hiding this comment

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

@stianst maybe I completely misunderstood it but the following line: https://github.com/keycloak/keycloak/blob/main/.github/workflows/label.yml#L2-L4 and https://github.com/keycloak-poc/keycloak/blob/main/.github/workflows/label.yml#L19, pretty much states that workflow runs when a pull request (PR) is closed (either merged or explicitly closed without merging). That's the reason why pull-requests: write was added instead of issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't need permissions to run on the event, it needs permissions for what actions it takes, which is update issues and create labels

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 this seems like it could use more granular permissions

Copy link
Contributor

@stianst stianst left a comment

Choose a reason for hiding this comment

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

Should we not instead change the default workflow permissions for the repository to Read repository contents and packages permissions and only set additional permissions that is required?

Seems permissions: contents: read addition to all workflows is not needed really.

@stianst
Copy link
Contributor

stianst commented Feb 26, 2025

I would get rid of the permissions: contents: read part. Fix the issue labeller permission that is wrong, then we can merge this PR, and afterwards enable the Read repository contents and packages permissions setting for the repo as the default.

We also need to update active release branches for this to work.

@abstractj
Copy link
Contributor Author

Should we not instead change the default workflow permissions for the repository to Read repository contents and packages permissions and only set additional permissions that is required?

Seems permissions: contents: read addition to all workflows is not needed really.

@stianst I totally get what you mention, but this is based on the recommendations from https://github.com/ossf/scorecard/blob/e3441f48c371470aa9d46aaaed343a74be31f54b/docs/checks.md#token-permissions. I do not disagree on what you say.

In summary:
"The highest score is awarded when the permissions definitions in each workflow's yaml file are set as read-only at the top level and the required write permissions are declared at the run-level."

The argument is: "The check cannot detect if the "read-only" GitHub permission setting is enabled, as there is no API available."

The consequence of not doing it, is the fact that both scorecard and clomonitor.io will report inaccurate report on Token permissions.

As soon as we agree on the changes here, I can submit a pull-request to other branches.

@abstractj abstractj force-pushed the issue-33544 branch 2 times, most recently from de70de9 to b6ded04 Compare February 26, 2025 15:34
@abstractj
Copy link
Contributor Author

@stianst I had the chance to speak with people on scorecard, and the another solution is to put at the top permissions: {}. Honestly, I'd go with permissions: read and call it a day.

@abstractj abstractj force-pushed the issue-33544 branch 2 times, most recently from 6a00433 to 190026f Compare February 27, 2025 12:01
@keycloak-github-bot
Copy link

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.webauthn.AppInitiatedActionWebAuthnTest#proceedSetupWebAuthnLogoutOtherSessionsChecked

Keycloak CI - WebAuthn IT (chrome)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:307)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
...

Report flaky test

Copy link

@keycloak-github-bot keycloak-github-bot bot left a comment

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@stianst
Copy link
Contributor

stianst commented Mar 11, 2025

Okay, let's go with the default permissions on the top of workflows, we can always in addition enable this enforcement on the repo/org level as a separate thing.

Copy link
Contributor

@jonkoops jonkoops left a comment

Choose a reason for hiding this comment

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

Overall LGMT, I agree with @stianst that some permissions should be different https://github.com/keycloak/keycloak/pull/37643/files#r1971552448

@abstractj
Copy link
Contributor Author

abstractj commented Mar 11, 2025

Copy link
Contributor

@rmartinc rmartinc left a comment

Choose a reason for hiding this comment

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

Thanks @abstractj! LGTM!

Copy link

@keycloak-github-bot keycloak-github-bot bot left a comment

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.webauthn.AppInitiatedActionWebAuthnTest#proceedSetupWebAuthnLogoutOtherSessionsChecked

Keycloak CI - WebAuthn IT (chrome)

java.lang.AssertionError: Event expected
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.keycloak.testsuite.AssertEvents.poll(AssertEvents.java:95)
...

Report flaky test

org.keycloak.testsuite.webauthn.passwordless.AppInitiatedActionPwdLessTest#proceedSetupWebAuthnLogoutOtherSessionsChecked

Keycloak CI - WebAuthn IT (chrome)

java.lang.AssertionError: Event expected
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.keycloak.testsuite.AssertEvents.poll(AssertEvents.java:95)
...

Report flaky test

org.keycloak.testsuite.webauthn.passwordless.AppInitiatedActionPwdLessTest#proceedSetupWebAuthnLogoutOtherSessionsNotChecked

Keycloak CI - WebAuthn IT (chrome)

java.lang.AssertionError: Event expected
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.keycloak.testsuite.AssertEvents.poll(AssertEvents.java:95)
...

Report flaky test

@abstractj abstractj force-pushed the issue-33544 branch 3 times, most recently from a7602cb to 1c7d9be Compare March 13, 2025 12:04
Copy link

@keycloak-github-bot keycloak-github-bot bot left a comment

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.webauthn.passwordless.AppInitiatedActionPwdLessTest#cancelSetupWebAuthn

Keycloak CI - WebAuthn IT (chrome)

java.lang.AssertionError: Event expected
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.keycloak.testsuite.AssertEvents.poll(AssertEvents.java:95)
...

Report flaky test

@abstractj abstractj force-pushed the issue-33544 branch 2 times, most recently from 07d1e1a to 519f288 Compare March 17, 2025 12:31
@stianst stianst merged commit 21c903e into keycloak:main Mar 17, 2025
76 of 77 checks passed
abstractj added a commit to abstractj/keycloak that referenced this pull request Mar 17, 2025
abstractj added a commit to abstractj/keycloak that referenced this pull request Mar 17, 2025
abstractj added a commit to abstractj/keycloak that referenced this pull request Mar 21, 2025
abstractj added a commit to abstractj/keycloak that referenced this pull request Mar 25, 2025
abstractj added a commit to abstractj/keycloak that referenced this pull request Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure that the project’s automated workflows tokens are set to read-only by default

6 participants