Skip to content

ilverify: respect IgnoresAccessChecksToAttribute - #136033

Merged
jkotas merged 6 commits into
dotnet:mainfrom
lagudafuadtosin:fix-130959
Oct 20, 2026
Merged

jkotas merged 6 commits into
dotnet:mainfrom
lagudafuadtosin:fix-130959

Conversation

@lagudafuadtosin

Copy link
Copy Markdown
Contributor

fixes #130959

ilverify now allows the access IgnoresAccessChecksToAttribute grants. like the runtime, it is checked last, and the public key only has to match when the attribute names one.

tested: new AccessTestsIgnoreChecks tests fail on main, pass with the fix.

ilverify now allows the access IgnoresAccessChecksToAttribute grants.
like the runtime, it is checked last, and the public key only has to
match when the attribute names one.

tested: new AccessTestsIgnoreChecks tests fail on main, pass with the
fix.

Fix dotnet#130959
@github-actions github-actions Bot added the area-Tools-ILVerification Issues related to ilverify tool and IL verification in general label Oct 18, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 18, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Attribute identity validation differs from CoreCLR, and the key-mismatch fixture uses an invalid identity.

2 open issues
What changed in this PR

Adds IgnoresAccessChecksToAttribute support to ILVerify, addressing #130959.

Changes:

  • Adds attribute-based access after normal visibility checks.
  • Reuses public-key-token comparison logic.
  • Adds IL fixtures for private access and key mismatch.

Validation here was limited to source inspection and attribute-blob decoding; no builds or project tests ran.

File Description
src/​coreclr/​tools/​ILVerification/​AccessVerificationHelpers.cs Implements attribute-based access checks.
src/​coreclr/​tools/​ILVerification.Tests/​ILTests/​AccessTestsIgnoreChecks.ilproj Builds the new test fixture.
src/​coreclr/​tools/​ILVerification.Tests/​ILTests/​AccessTestsIgnoreChecks.il Exercises private access and key mismatch.

Review effort: Balanced

Comment thread src/coreclr/tools/ILVerification/AccessVerificationHelpers.cs Outdated
Comment thread src/coreclr/tools/ILVerification.Tests/ILTests/AccessTestsIgnoreChecks.il Outdated
@jkotas

jkotas commented Oct 18, 2026

Copy link
Copy Markdown
Member

IgnoresAccessChecksToAttribute is not really verifiable code. I am wondering whether it should be respected only under a switch - either a switch that is specific to IgnoresAccessChecksToAttribute or a more general switch that turns of IL verification, and just keeps IL validation (#37391)

@lagudafuadtosin

Copy link
Copy Markdown
Contributor Author

IgnoresAccessChecksToAttribute is not really verifiable code. I am wondering whether it should be respected only under a switch - either a switch that is specific to IgnoresAccessChecksToAttribute or a more general switch that turns of IL verification, and just keeps IL validation (#37391)

that makes sense, i will put it behind an option now

off by default, since code relying on it is not verifiable. also
rejects names with a version, culture, architecture or public key
token, like the runtime does.

Fix dotnet#130959
Comment thread src/coreclr/tools/ILVerification/AccessVerificationHelpers.cs Outdated
IgnoresAccessChecksTo now matches the assembly name the same way as
InternalsVisibleTo, through one shared helper.
Comment thread src/coreclr/tools/ILVerification/AccessVerificationHelpers.cs Outdated
Comment thread src/coreclr/tools/ILVerification/AccessVerificationHelpers.cs
Comment thread src/coreclr/tools/ILVerification/ILVerifyTypeSystemContext.cs Outdated
@jkotas

jkotas commented Oct 20, 2026

Copy link
Copy Markdown
Member

Thanks

@jkotas
jkotas enabled auto-merge (squash) October 20, 2026 04:58
@lagudafuadtosin

Copy link
Copy Markdown
Contributor Author

Thanks

You re welcome

@jkotas
jkotas merged commit eee5433 into dotnet:main Oct 20, 2026
120 of 122 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILVerification Issues related to ilverify tool and IL verification in general community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ilverify doesn't respect IgnoreAccessChecksTo

3 participants