Files
sonr/docs/reference/queries/query-dwn-permissions.mdx
T

99 lines
2.0 KiB
Plaintext
Raw Normal View History

2025-10-03 14:45:52 -04:00
---
title: Query DWN Permissions
description: Audit and manage access control for your data
2026-09-02 16:53:38 -04:00
seo:
title: "DWN Permission Management"
2025-10-03 14:45:52 -04:00
---
2026-09-02 16:53:38 -04:00
:::info
Regular permission audits are essential for maintaining data security and compliance.
:::
2025-10-03 14:45:52 -04:00
## Permission Queries
### Filter Options
- **grantor**: Who gave the permission
- **grantee**: Who received the permission
- **interfaceName**: Scope to interface (Records, Protocols)
- **method**: Specific operation (Write, Query, Delete)
- **includeRevoked**: Show revoked permissions
### Common Queries
```bash
# All active permissions I've granted
?grantor=did:sonr:alice&includeRevoked=false
# Permissions given to specific user
?grantee=did:sonr:bob
# All write permissions
?method=Write
# Protocol-specific permissions
?interfaceName=Records&method=Write
```
## Permission Auditing
2026-09-02 16:53:38 -04:00
:::tip
Schedule regular audits to review and revoke unnecessary permissions.
:::
2025-10-03 14:45:52 -04:00
### Audit Checklist
1. **Review Active Permissions**
```bash
?includeRevoked=false&pagination.limit=100
```
2. **Check Expired Permissions**
2026-09-02 16:53:38 -04:00
- Filter by `expiresAt` < current time
2025-10-03 14:45:52 -04:00
- Revoke if still active
3. **Verify Grantee Activity**
- Check last access times
- Revoke inactive permissions
4. **Protocol Compliance**
- Ensure permissions align with protocols
- Update for protocol changes
## Permission States
### Active Permission
- Not revoked
- Not expired
- Valid conditions met
### Inactive Permission
- Revoked by grantor
- Past expiration time
- Conditions not met
2026-09-02 16:53:38 -04:00
:::warning
Permissions with no expiration should be reviewed more frequently.
:::
2025-10-03 14:45:52 -04:00
## Security Best Practices
### Principle of Least Privilege
- Grant minimum necessary access
- Use specific scopes
- Set expiration times
### Regular Reviews
```bash
# Weekly: Check high-privilege permissions
?interfaceName=Permissions
# Monthly: Full audit
?includeRevoked=true&pagination.countTotal=true
# Quarterly: Protocol permission alignment
?interfaceName=Protocols
```
2026-09-02 16:53:38 -04:00
:::note
Use `pagination.countTotal=true` to track total permission growth over time.
:::