# aws-s3-bucket-granted-access

Rule `sonarjs/aws-s3-bucket-granted-access`. S3 buckets should not grant access to all users or authenticated users

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1180 by reach, #481 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/aws-s3-bucket-granted-access` | yes | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-6265/) |

## Code examples

### Correct: the rule accepts this

```js
const s3 = require('aws-cdk-lib/aws-s3');

new s3.Bucket(this, 'bucket', {
    accessControl: s3.BucketAccessControl.PRIVATE
});

new s3deploy.BucketDeployment(this, 'DeployWebsite', {
    accessControl: s3.BucketAccessControl.PRIVATE
});
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "sonarjs/aws-s3-bucket-granted-access": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/aws-restricted-ip-admin-access](https://lintradar.dev/rules/sonarjs/aws-restricted-ip-admin-access.md): Administration services access should be restricted to specific IP addresses
- [sonarjs/aws-s3-bucket-insecure-http](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-insecure-http.md): S3 buckets should enforce HTTPS-only access
- [sonarjs/aws-rds-unencrypted-databases](https://lintradar.dev/rules/sonarjs/aws-rds-unencrypted-databases.md): Amazon RDS resources should be encrypted at rest
- [sonarjs/aws-s3-bucket-public-access](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-public-access.md): Amazon S3 bucket public access should be fully blocked
- [sonarjs/aws-opensearchservice-domain](https://lintradar.dev/rules/sonarjs/aws-opensearchservice-domain.md): OpenSearch domains should have encryption at rest enabled
- [sonarjs/aws-s3-bucket-versioning](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-versioning.md): Amazon S3 buckets should have versioning enabled

---

Web page: https://lintradar.dev/rules/sonarjs/aws-s3-bucket-granted-access. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
