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

Convert Microsoft Secure Score to OHDF #6007

Merged
merged 79 commits into from
Aug 7, 2024
Merged

Convert Microsoft Secure Score to OHDF #6007

merged 79 commits into from
Aug 7, 2024

Conversation

meme112233
Copy link
Contributor

@meme112233 meme112233 commented Jul 18, 2024

This PR introduces the converter for Microsoft SecureScore to OHDF.

Mapping is performed using the output of two Microsoft Graph API endpoints:

The mapper takes the output of the two endpoints as a single json document. Each document is included as an object under the keys profiles and secureScore.

{
   "secureScore":  <The full text of the secureScore endpoint output as JSON object>,
   "profiles":  <The full text of the secureScoreControlProfiles endpoint output as JSON object>
}

This combined file can be built with jq

jq -s '{"secureScore": .[0], "profiles": .[1]}' secureScore.json profiles.json

Sample combined secureScore/profiles document for testing:
combined_msft.json

Mapper design decisions of interest

  • impact: Derived from the maxScore of the Profile matching the controlName
    • When no matching Profile is found, a default impact of 0.5 is used
  • status:
    • success:
      • scoreInPercentage === 100
      • score === max value from maxScore field of any matching Profile
    • error:
      • score field is undefined (per API, should never happen)
    • fail:
      • any other condition
  • tags
    • groups
      • controlCategory field from any matching Profiles
    • threats
      • threat field from any matching Profiles

A matching PR for the SAF-CLI is expected early next week that will support:

  • CLI conversion of combined secureScore endpoints to OHDF.
    • Starting with pre-downloaded REST endpoint outputs
    • Starting from Graph API credentials

@ejaronne
Copy link
Contributor

  1. Profiles.value.title: recommend for controls.title
  2. Perhaps the Impact should be based on Profiles.value.userImpact instead of Profiles.value.maxScore? I can't yet find the Microsoft documentation that explains the difference between these. Impact is intended to be the relative danger should this control be in a failed state.
  3. Remediation: seems like a perfect opportunity as descriptions:[data:””, label:”fix”]
  4. RemediationImpact: seems like a perfect opportunity as descriptions:[data:””, label:”rationale”]

Copy link
Contributor

@charleshu-8 charleshu-8 left a comment

Choose a reason for hiding this comment

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

Part 1 of review, will look at mapper proper later.

libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
combined_msft.json Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
libs/hdf-converters/src/msft-secure-score-mapper.ts Outdated Show resolved Hide resolved
@Amndeep7 Amndeep7 added the ready-to-merge Used by mergify to identify if a PR is ready to merge into master. label Aug 7, 2024
@Amndeep7 Amndeep7 merged commit f5c9fe4 into master Aug 7, 2024
8 of 9 checks passed
@Amndeep7 Amndeep7 deleted the meme-working branch August 7, 2024 01:30
Copy link

sonarcloud bot commented Aug 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 New Code Smells (required ≤ 0)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hdf-converters Issue related to the HDF Converters library ready-to-merge Used by mergify to identify if a PR is ready to merge into master.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants