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

harden-exports rule for eslint plugin #2369

Merged
merged 3 commits into from
Jul 18, 2024
Merged

harden-exports rule for eslint plugin #2369

merged 3 commits into from
Jul 18, 2024

Conversation

turadg
Copy link
Member

@turadg turadg commented Jul 18, 2024

Refs: Agoric/agoric-sdk#9726

Description

A new lint rule, harden-exports, to support Agoric/agoric-sdk#9726

Includes an autofixer

Security Considerations

Could enhance security

Scaling Considerations

n/a

Documentation Considerations

We don't yet document provided rules: https://endojs.github.io/endo/modules/_endo_eslint_plugin.html

I think that's okay for now. If that is requested I'd file it as a separate issue, out of scope of this one.

Testing Considerations

I temporarily enabled this in the recommended config and ran lint-fix on the repo. All the changes looked correct. However harden() isn't always available so I don't think we should enable it in any of Endo's shared configs.

Compatibility Considerations

n/a

Upgrade Considerations

n/a

Copy link
Member

@kriskowal kriskowal left a comment

Choose a reason for hiding this comment

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

Good one!

Comment on lines +81 to +82
export const a = 'alreadyHardened';
export const b = 'toHarden';
Copy link
Member

Choose a reason for hiding this comment

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

In a handful of cases, it will be somewhat tedious to have to harden primitive literals. Are you up for a little complication?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm all ears. I'd like to land this though because it's useful as is

@kriskowal
Copy link
Member

Rebase to fix the failing CI job. #2366

@turadg turadg enabled auto-merge July 18, 2024 21:57
@turadg turadg merged commit d6a1b13 into master Jul 18, 2024
17 checks passed
@turadg turadg deleted the ta/lint-harden branch July 18, 2024 22:05
mergify bot added a commit to Agoric/agoric-sdk that referenced this pull request Aug 12, 2024
closes: #9693 

## Description

more linting for #9693, using endojs/endo#2369

Also adopts `harden-exports` for `.contract.js` modules,
- #4770

### Security Considerations
none

### Scaling Considerations
none

### Documentation Considerations
none

### Testing Considerations
CI with expected errors

### Upgrade Considerations
n/a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants