PR Metrics

遵循以下最佳实践的项目将能够自愿的自我认证,并显示他们已经实现了核心基础设施计划(OpenSSF)徽章。

没有一套可以保证软件永远不会有缺陷或漏洞的做法;如果规范或假设是错误的,即使合适的方法也可能失败。也没有哪些做法可以保证一个项目能够维持健康和运作良好的开发者社区。但是,遵循最佳做法可以帮助改善项目的成果。例如,一些做法可以在发布之前进行多人评估,这可以帮助您找到其他难以找到的技术漏洞,并帮助建立信任,并希望不同公司的开发人员之间进行重复的交互。要获得徽章,必须满足所有“必须”和“禁止”的条款,满足所有“应该”条款或有合适的理由,所有“建议”条款必须满足或未满足(至少希望考虑)。欢迎通过 GitHub网站创建问题或提出请求进行反馈。另外还有一个一般讨论邮件列表

如果这是您的项目,请在项目页面上显示您的基准徽章状态!基准徽章状态如下所示: 项目11987的基准徽章等级为baseline-3 以下是如何嵌入基准徽章:
您可以通过将其嵌入到Markdown文件中来显示您的基准徽章状态:
[![OpenSSF Baseline](https://www.bestpractices.dev/projects/11987/baseline)](https://www.bestpractices.dev/projects/11987)
或者将其嵌入到HTML中:
<a href="https://www.bestpractices.dev/projects/11987"><img src="https://www.bestpractices.dev/projects/11987/baseline"></a>


这些是基准等级3的标准。 这些标准来自基准版本 v2025.10.10,并包含来自版本 v2026.02.19 的更新标准文本。版本 v2026.02.19 中新增的标准标记为"未来",将从 2026-06-01 开始强制执行。请在该日期之前提供对"未来"标准的回答。

Baseline Series: 基准等级1 基准等级2 基准等级3

        

 基本

  • 常规

    请注意,其他项目可能使用相同的名称。

    A GitHub Action & Azure Pipelines task for augmenting pull request titles to let reviewers quickly determine PR size and test coverage.

    请使用 SPDX许可证表达格式;例子包括“Apache-2.0”,“BSD-2-Clause”,“BSD-3-Clause”,“GPL-2.0+”,“LGPL-3.0 +”,“MIT”和“(BSD-2-Clause OR Ruby)”。
    如果有多种语言,请将它们列为逗号分隔值(可选空格),并将它们从最多到最少使用。如果有长列表,请至少列出前三个最常见的列表。如果没有语言(例如,这是仅文档或仅测试项目),请使用单个字符“ - ”。请使用每种语言的常规大小写,例如“JavaScript”。
    通用平台枚举(CPE)是用于信息技术系统,软件和软件包的结构化命名方案。在报告漏洞时,它可用于多个系统和数据库。

 控制 20/21

  • 控制


    当在CI/CD管道中为作业分配权限时,源代码或配置必须仅分配相应活动所需的最低权限。 [OSPS-AC-04.02]
    配置项目的CI/CD流水线,默认为用户和服务分配最低可用权限,仅在特定任务需要时才提升权限。在某些版本控制系统中,这可以在组织或代码仓库级别实现。如果不行,请在流水线的顶层设置权限。

    All three GitHub Actions workflow files (build.yml at https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/build.yml, release-initiate.yml at https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/release-initiate.yml, release-publish.yml at https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/release-publish.yml) set permissions: {} at the top level, defaulting all jobs to no permissions. Each job explicitly requests only the specific permissions it requires. For example, the release job in release-publish.yml requests only attestations: write and id-token: write, while the build job in build.yml requests permissions: {} (no permissions). The Azure DevOps pipelines extend the Office.Official.PipelineTemplate and Office.Unofficial.PipelineTemplate templates, which enforce organisational security policies including least-privilege defaults.



    (未来条款) 接受可信协作者输入的 CI/CD 流水线在流水线中使用该输入之前,必须对其进行清理和验证。 [OSPS-BR-01.04]
    CI/CD 流水线应对显式工作流执行中的所有协作者输入进行清理(引用、转义或在期望值时退出)。虽然协作者通常是可信的,但工作流的手动输入无法经过审查,可能被账户劫持或内部威胁所滥用。


    当创建正式发布版本时,该发布版本中的所有资产必须明确关联到发布标识符或资产的其他唯一标识符。 [OSPS-BR-02.02]
    为项目生成的每个软件资产分配唯一的版本标识符,遵循一致的命名约定或编号方案。示例包括SemVer、CalVer或git提交ID。

    Each release is assigned a unique Semantic Versioning (https://semver.org/) identifier (e.g., v1.7.11). The version is maintained consistently across package.json (https://github.com/microsoft/PR-Metrics/blob/main/package.json), task.json (https://github.com/microsoft/PR-Metrics/blob/main/src/task/task.json), and vss-extension.json (https://github.com/microsoft/PR-Metrics/blob/main/src/vss-extension.json). Release assets (the VSIX extension, Sigstore signature bundle, and CycloneDX SBOM) are published as part of the GitHub Release (https://github.com/microsoft/PR-Metrics/releases) tagged with the version identifier. The release-publish.yml workflow (https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/release-publish.yml) reads the version from release-publish-trigger.txt (https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/support/release-publish-trigger.txt) and creates the release with that version tag.



    项目必须定义管理项目使用的秘密和凭证的策略。该策略应包括存储、访问和轮换秘密和凭证的指南。 [OSPS-BR-07.02]
    记录项目内如何管理和使用秘密和凭证。这应包括如何存储秘密(例如,使用秘密管理工具)、如何控制访问以及如何轮换或更新秘密的详细信息。确保敏感信息不会硬编码在源代码中或存储在版本控制系统中。

    The project documents its secrets and credentials management policy in docs/secrets-management.md (https://github.com/microsoft/PR-Metrics/blob/main/docs/secrets-management.md). The policy covers all secrets used by the project (including GITHUB_TOKEN, PR_METRICS_TOKEN, and ESRP service connections), how they are stored (exclusively in GitHub Secrets and Azure DevOps variable groups), how access is controlled (repository-level permissions, fork restrictions, least-privilege workflow permissions), and how secrets are rotated (GITHUB_TOKEN is auto-rotated per workflow run; PATs are reviewed periodically). The policy also describes preventative measures including Gitleaks secret scanning, environment variable usage instead of command-line arguments, and automatic log masking.



    当项目已发布版本时,项目文档必须包含验证发布资产完整性和真实性的说明。 [OSPS-DO-03.01]
    项目中的说明应包含所使用技术、要运行的命令以及预期输出的信息。如果可能,避免将此文档存储在构建和发布流水线的相同位置,以避免单一漏洞同时危及软件和验证软件完整性的文档。

    The docs/verification.md file (https://github.com/microsoft/PR-Metrics/blob/main/docs/verification.md) provides comprehensive instructions for verifying release integrity and authenticity using two independent methods: Build provenance attestation, verified via GitHub CLI (gh attestation verify), confirming the artefact was built by the official release workflow and hasn't been tampered with. Cosign signature, verified via Sigstore cosign (cosign verify-blob), confirming cryptographic integrity using keyless signing backed by GitHub's OIDC tokens. The documentation includes prerequisites, step-by-step verification commands, expected output, and troubleshooting guidance. This documentation is maintained in the repository's docs/ folder, separate from the build and release pipeline configuration.



    当项目已发布版本时,项目文档必须包含验证软件发布作者的预期身份的说明。 [OSPS-DO-03.02]
    预期身份可能采用用于签名的密钥ID、来自sigstore证书的颁发者和身份或其他类似形式。如果可能,避免将此文档存储在构建和发布流水线的相同位置,以避免单一漏洞同时危及软件和验证软件完整性的文档。

    The docs/verification.md file (https://github.com/microsoft/PR-Metrics/blob/main/docs/verification.md) includes instructions to verify the expected identity of the process authoring the release. The cosign verification command specifies the expected identity via: --certificate-identity-regexp matching ^https://github.com/microsoft/PR-Metrics/.github/workflows/release-publish.yml@refs/heads/main$ and --certificate-oidc-issuer matching https://token.actions.githubusercontent.com. This confirms that the release was authored by the release-publish.yml workflow running on the main branch of the microsoft/PR-Metrics repository, using GitHub's OIDC identity provider. The build provenance attestation additionally links the artefact to a specific workflow run and commit. This documentation is maintained separately from the build and release pipeline.



    当项目已发布版本时,项目文档必须包含关于每个发布版本支持范围和持续时间的描述性声明。 [OSPS-DO-04.01]
    为了传达项目发布的软件资产的支持范围和持续时间,项目应有SUPPORT.md文件、SECURITY.md中的"支持"部分或其他文档,说明支持生命周期,包括每个发布版本的预期支持持续时间、提供的支持类型(例如,错误修复、安全更新)以及获取支持的任何相关策略或程序。

    The SUPPORT.md file (https://github.com/microsoft/PR-Metrics/blob/main/.github/SUPPORT.md) documents the support lifecycle for the project. It states that PR Metrics follows a rolling release model where only the latest release is actively supported with bug fixes and security updates. Previous releases do not receive patches. The document also describes the end-of-life policy: should the project become inactive, the last published release will remain available but will not receive further updates. Consumers will be notified of any planned end of life through GitHub Discussions.



    当项目已发布版本时,项目文档必须提供描述性声明说明何时发布版本或版本将不再接收安全更新。 [OSPS-DO-05.01]
    为了传达安全修复的支持范围和持续时间,项目应有SUPPORT.md或其他文档,说明项目的安全更新策略。

    The SUPPORT.md file (https://github.com/microsoft/PR-Metrics/blob/main/.github/SUPPORT.md) provides a clear statement on when releases will no longer receive security updates: "Once a new version is published, the previous version no longer receives security updates." The document further states that critical security issues may result in an expedited patch release, and that consumers should always run the latest version. The end-of-life section clarifies that if the project becomes inactive, the last release will remain available but will not receive security patches.



    在活跃期间,项目文档必须有一个策略,要求在授予对敏感资源的提升权限之前审查代码协作者。 [OSPS-GV-04.01]
    在项目文档中发布可执行的策略,要求在授予对敏感资源(例如合并批准或访问秘密)的提升权限之前审查和批准代码协作者。建议审查包括建立可证明的身份血统,例如确认贡献者与已知可信组织的关联。

    The GOVERNANCE.md file (https://github.com/microsoft/PR-Metrics/blob/main/GOVERNANCE.md) includes a "Collaborator Review Policy" section that requires contributors to be reviewed and approved before being granted escalated permissions to sensitive resources. The policy requires nomination by an existing maintainer based on sustained quality contributions, identity verification through association with a known trusted organisation, and approval by at least one existing maintainer. Permissions are granted at the minimum level required for the contributor's role. Access to signing infrastructure is restricted to automated CI/CD pipelines and cannot be granted to individual contributors.



    当项目已发布版本时,所有编译的已发布软件资产必须附带软件物料清单。 [OSPS-QA-02.02]
    建议在构建时使用经过准确性审查的工具自动生成SBOM。这使用户能够以标准化的方式将此数据与其环境中的其他项目一起提取。

    The release-publish.yml workflow (https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/release-publish.yml) generates a CycloneDX (https://cyclonedx.org/) Software Bill of Materials (SBOM) using "npm sbom --sbom-format cyclonedx --sbom-type library". The SBOM (ms-omex.PRMetrics.sbom.cdx.json) is included as a release asset alongside the VSIX extension and Sigstore signature bundle on the GitHub Releases page (https://github.com/microsoft/PR-Metrics/releases). This enables consumers to ingest dependency data in a standardised format alongside other projects in their environment.



    当项目已发布包含多个源代码仓库的版本时,所有子项目必须执行与主代码库一样严格或更严格的安全要求。 [OSPS-QA-04.02]
    项目生成并编译到发布版本中的任何其他子项目代码仓库必须根据相应代码库的状态和意图执行安全要求。除了遵循相应的OSPS基线要求外,这还可能包括要求进行安全审查、确保其没有漏洞以及确保其没有已知的安全问题。

    The project does not have any subprojects. It is a single codebase that produces artefacts for both GitHub Actions and Azure DevOps Pipelines via shared source code with platform-specific abstraction layers, as described in docs/cross-platform-architecture.md (https://github.com/microsoft/PR-Metrics/blob/main/docs/cross-platform-architecture.md).



    在活跃期间,项目文档必须清楚地记录测试何时以及如何运行。 [OSPS-QA-06.02]
    在贡献文档中添加一个章节,说明如何在本地运行测试以及如何在CI/CD管道中运行测试。文档应说明测试的测试内容以及如何解释测试结果。

    The project's testing procedures are documented across multiple files: docs/development.md (https://github.com/microsoft/PR-Metrics/blob/main/docs/development.md) contains a "Testing" section explaining how to run tests locally ("npm test"), the test framework (Mocha at https://mochajs.org/ with ts-mockito at https://github.com/NagRock/ts-mockito), the Arrange-Act-Assert pattern used, code coverage reporting via c8 (https://github.com/bcoe/c8), and manual test case instructions. CONTRIBUTING.md (https://github.com/microsoft/PR-Metrics/blob/main/.github/CONTRIBUTING.md) describes how to run tests locally and in CI/CD, what the tests cover, and how to interpret results (pass/fail status and coverage percentages). It also documents that all automated checks in build.yml (https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/build.yml) (unit tests, CodeQL, Super-Linter) must pass before a pull request can be merged.



    在活跃期间,项目的文档必须包含一项政策,即对项目生成的软件的所有重大更改都应该在自动化测试套件中添加或更新功能测试。 [OSPS-QA-06.03]
    在贡献文档中添加一个章节,说明添加或更新测试的政策。该政策应说明什么是重大更改以及应该添加或更新哪些测试。

    The CONTRIBUTING.md file (https://github.com/microsoft/PR-Metrics/blob/main/.github/CONTRIBUTING.md) includes a "Test Policy for Major Changes" section requiring that all major changes include corresponding test updates. The policy defines specific requirements for new features (unit tests covering new functionality and edge cases), bug fixes (regression tests), and refactoring (existing tests must continue to pass). A "major change" is defined as any modification that alters extension behaviour, adds configuration parameters, changes metric calculations, or modifies API interactions. The pull request template (https://github.com/microsoft/PR-Metrics/blob/main/.github/pull_request_template.md) includes a testing checklist to enforce compliance.



    当向主分支提交时,项目的版本控制系统必须在合并之前要求至少一名非作者人工审批更改。 [OSPS-QA-07.01]
    配置项目的版本控制系统,要求在合并到发布分支或主分支之前至少有一名非作者人工审批更改。这可以通过要求拉取请求在合并之前必须由至少另一位协作者审查和批准来实现。

    The repository is protected by multiple rulesets (default-ruleset, microsoft-production-ruleset) that prevent direct commits to the main branch and require pull request reviews. At least one non-author approval is required before a pull request can be merged. The CODEOWNERS file (https://github.com/microsoft/PR-Metrics/blob/main/.github/CODEOWNERS) assigns @microsoft/omex as the required reviewer for all files. See repository rulesets at https://github.com/microsoft/PR-Metrics/rules.



    当项目发布版本时,项目必须执行威胁建模和攻击面分析,以理解和防护针对系统内关键代码路径、函数和交互的攻击。 [OSPS-SA-03.02]
    威胁建模是一项活动,其中项目查看代码库、相关流程和基础设施、接口、关键组件,并"像黑客一样思考",集思广益探讨系统可能如何被破坏或受到损害。每个识别的威胁都会被列出,以便项目可以考虑如何主动避免或关闭可能出现的任何漏洞/脆弱点。确保为新功能或破坏性更改更新此分析。

    The project maintains a comprehensive security assessment in docs/security-assessment.md (https://github.com/microsoft/PR-Metrics/blob/main/docs/security-assessment.md), which includes a Mermaid diagram of trust boundaries, an asset sensitivity table, and detailed threat analysis covering five threat categories: access token exposure, injection via untrusted PR content, supply chain attacks on dependencies, CI/CD permission escalation, and Git command injection. Each threat includes likelihood and impact ratings with specific mitigations. The assessment also identifies residual risks and specifies a review cadence.



    在活跃期间,软件组件中不影响项目的任何漏洞必须在VEX文档中予以说明,并以不可利用性细节补充漏洞报告。 [OSPS-VM-04.02]
    建立VEX供给源,传达已知漏洞的可利用性状态,包括评估细节或任何阻止易受攻击代码执行的缓解措施。

    The docs/security-scanning-policy.md file (https://github.com/microsoft/PR-Metrics/blob/main/docs/security-scanning-policy.md) documents the project's VEX policy. When a vulnerability is identified in a dependency that does not affect PR Metrics (e.g., the vulnerable code path is not reachable), the finding is assessed and documented as non-exploitable via GitHub Security Advisories (https://github.com/microsoft/PR-Metrics/security/advisories) and Dependabot alert dismissals with documented reasons. As of the last assessment, no known vulnerabilities in project dependencies have been identified as non-exploitable requiring VEX documentation; all known vulnerabilities are either resolved through dependency updates or actively being addressed per the documented remediation thresholds.



    在活跃期间,项目文档必须包含一项政策,定义与漏洞和许可证相关的SCA发现的修复阈值。 [OSPS-VM-05.01]
    在项目中记录一项政策,定义与漏洞和许可证相关的SCA发现的修复阈值。包括识别、优先级排序和修复这些发现的流程。

    The docs/security-scanning-policy.md file (https://github.com/microsoft/PR-Metrics/blob/main/docs/security-scanning-policy.md) defines remediation thresholds for SCA findings. Critical and high severity findings must be resolved by the next patch release. Medium and low severity findings must be addressed by the next scheduled release. The policy includes a severity-to-remediation-target mapping table and describes the process for identifying, prioritising, and remediating findings via Dependabot alerts, CodeQL, and Component Governance.



    在活跃期间,项目文档必须包含一项政策,在任何发布之前解决SCA违规问题。 [OSPS-VM-05.02]
    在项目中记录一项政策,在任何发布之前解决适用的软件组成分析结果,并添加状态检查以验证在发布之前符合该政策。

    The docs/security-scanning-policy.md file (https://github.com/microsoft/PR-Metrics/blob/main/docs/security-scanning-policy.md) documents a pre-release policy requiring that: (1) no unresolved Dependabot alerts of critical or high severity exist; (2) all npm dependencies are updated to their latest compatible versions via the release workflow; (3) Component Governance detection in the Azure DevOps pipeline completes without blocking findings; and (4) non-exploitable findings are documented. The release-initiate.yml workflow (https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/release-initiate.yml) enforces dependency updates as part of the release process, and the Azure DevOps pipeline applies the M365 Guardian policy.



    在活跃期间,对项目代码库的所有更改必须根据记录的恶意依赖项和依赖项中已知漏洞的政策自动评估,然后在违规的情况下阻止,除非声明并抑制为不可利用。 [OSPS-VM-05.03]
    在项目的版本控制系统中创建一个状态检查,对代码库的所有更改运行软件组成分析工具。要求状态检查在更改可以合并之前必须通过。

    All changes to the codebase are automatically evaluated for malicious dependencies and known vulnerabilities: CodeQL (https://codeql.github.com/) runs on every pull request via the Validate job in build.yml (https://github.com/microsoft/PR-Metrics/blob/main/.github/workflows/build.yml), using security-and-quality, security-experimental, and security-extended query sets. Dependabot alerts (https://docs.github.com/code-security/dependabot/dependabot-alerts/about-dependabot-alerts) are configured at the repository level. Component Governance (https://docs.opensource.microsoft.com/tools/cg/) runs dependency detection in the Azure DevOps PR pipeline. The repository rulesets require that all status checks pass before merging. Non-exploitable findings are documented via Dependabot alert dismissals with justification or in the security scanning policy.



    在活跃期间,项目文档必须包含一项政策,定义SAST发现的修复阈值。 [OSPS-VM-06.01]
    在项目中记录一项政策,定义静态应用程序安全测试(SAST)发现的修复阈值。包括识别、优先级排序和修复这些发现的流程。

    The docs/security-scanning-policy.md file (https://github.com/microsoft/PR-Metrics/blob/main/docs/security-scanning-policy.md) defines remediation thresholds for SAST findings. Critical and high severity findings block pull request merging via required status checks and must be resolved immediately. Medium severity findings must be resolved before the next release. Low severity findings are addressed on a best-effort basis. The policy covers CodeQL, ESLint, CredScan, and PoliCheck findings, and describes how suppressed findings are documented with justification.



    在活跃期间,对项目代码库的所有更改必须根据记录的安全弱点政策自动评估,并在违规的情况下阻止,除非声明并抑制为不可利用。 [OSPS-VM-06.02]
    在项目的版本控制系统中创建一个状态检查,对代码库的所有更改运行静态应用程序安全测试(SAST)工具。要求状态检查在更改可以合并之前必须通过。

    All changes to the codebase are automatically evaluated for security weaknesses: CodeQL (https://codeql.github.com/) is a required status check on every pull request, running extended security query sets against the JavaScript/TypeScript codebase. Super-Linter (https://github.com/super-linter/super-linter) runs ESLint and Gitleaks (https://github.com/gitleaks/gitleaks) on every pull request. CredScan (https://secdevtools.azurewebsites.net/helpcredscan.html) and Guardian PostAnalysis run in the Azure DevOps PR pipeline, enforcing the M365 security policy. The repository rulesets require that all status checks pass before merging. Suppressed findings are documented with justification in configuration files such as CredScanSuppressions.json (https://github.com/microsoft/PR-Metrics/blob/main/.github/azure-devops/CredScanSuppressions.json) and gitleaks.toml (https://github.com/microsoft/PR-Metrics/blob/main/.github/linters/gitleaks.toml).



该数据可在社区数据许可协议 – 许可性,版本 2.0 (CDLA-Permissive-2.0)下获取。这意味着数据接收方可以共享数据,无论是否经过修改,只要数据接收方在共享数据时提供本协议文本。请注明Muiris Woulfe和OpenSSF最佳实践徽章贡献者。

项目徽章条目拥有者: Muiris Woulfe.
最后更新于 2026-02-19 17:32:37 UTC, 最后更新于 2026-02-27 19:06:06 UTC。 最后在2026-02-23 14:15:17 UTC丢失通过徽章。 最后在 2026-02-23 14:43:51 UTC 获得通过徽章。