Skip to content

Commit 8f6e1dc

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feature/default-request-library
2 parents b3d5e22 + bc58872 commit 8f6e1dc

32 files changed

+820
-95
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "🐛 Bug Report"
2+
description: Something isn't working as expected.
3+
labels: ["bug"]
4+
body:
5+
- type: textarea
6+
id: scenario
7+
attributes:
8+
label: Scenario & Reproduction Steps
9+
description: When do you encounter this problem?
10+
placeholder: "Please share as much context as you can about when you encounter this problem. If possible, sharing the steps to reproduce is immensely helpful."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: actual
15+
attributes:
16+
label: Actual Behavior
17+
description: What is happening?
18+
placeholder: "Please tell us about the problem you're encountering. e.g. an error you're encountering or an unexpected return value"
19+
validations:
20+
required: true
21+
- type: textarea
22+
id: expected
23+
attributes:
24+
label: Expected Behavior
25+
description: What would you have expected happened instead?
26+
placeholder: "Please share what you had expected to happen. How should this have behaved?"
27+
- type: input
28+
id: version
29+
attributes:
30+
label: SDK version
31+
description: "You can find the version you're using by running `npm list @1password/sdk`."
32+
- type: textarea
33+
id: info
34+
attributes:
35+
label: Additional information
36+
description: Any additional information that's relevant to add?
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "↗️ Improvement"
2+
description: Something works but can be made better.
3+
labels: ["improvement"]
4+
body:
5+
- type: textarea
6+
id: current
7+
attributes:
8+
label: Current Behavior
9+
description: How does this currently work?
10+
placeholder: "Please tell us what you're currently doing and what hurdles you're running into with this."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: desired
15+
attributes:
16+
label: Desired Behavior
17+
description: How would you prefer for this to work?
18+
placeholder: "Please share how you'd prefer for this to work."
19+
- type: textarea
20+
id: value
21+
attributes:
22+
label: Benefits & Value
23+
description: What is better about the new behavior? How will this help you?
24+
placeholder: "Please share what benefits you'd like to get out of this improvement. What would you use this for? How does that improve with this change? Why should this change be made?"
25+
- type: textarea
26+
id: info
27+
attributes:
28+
label: Additional information
29+
description: Any additional information that's relevant to add?
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "✨ Feature request"
2+
description: I'd like to request new functionality.
3+
labels: ["feature-request"]
4+
body:
5+
- type: textarea
6+
id: usecase
7+
attributes:
8+
label: Use Case
9+
description: What are you trying to achieve?
10+
placeholder: "Tell us about the problem you're trying to solve. The more context you add, the better we can align a solution with your problem."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: requirements
15+
attributes:
16+
label: Requirements and desired behavior
17+
description: What should the SDK do?
18+
placeholder: If you already have an idea for what you'd like to be available in the SDK to solve your problem, feel free to share that here. How would you expect this to behave?
19+
- type: textarea
20+
id: info
21+
attributes:
22+
label: Additional information
23+
description: Any additional information that's relevant to add?

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: "💬 Chat with us on Slack"
4+
url: https://developer.1password.com/joinslack
5+
about: Chat with us about SDKs in our Developer Slack workspace.
6+
- name: "❓ General 1Password questions"
7+
url: https://1password.community
8+
about: I have a question about 1Password that's not directly related to SDKs.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Check signed commits in PR
2+
on: pull_request_target
3+
4+
jobs:
5+
build:
6+
name: Check signed commits in PR
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check signed commits in PR
13+
uses: 1Password/check-signed-commits-action@main

.github/workflows/ok-to-test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# If someone with write access comments "/ok-to-test" on a pull request, emit a repository_dispatch event
2+
name: Ok To Test
3+
4+
on:
5+
issue_comment:
6+
types: [created]
7+
8+
jobs:
9+
ok-to-test:
10+
runs-on: ubuntu-latest
11+
# required permissions for adding reactions to the pull request comments
12+
permissions:
13+
pull-requests: write
14+
# Only run for PRs, not issue comments
15+
if: ${{ github.event.issue.pull_request }}
16+
steps:
17+
- name: Slash Command Dispatch
18+
uses: peter-evans/slash-command-dispatch@v3
19+
with:
20+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
21+
reaction-token: ${{ secrets.GITHUB_TOKEN }}
22+
issue-type: pull-request
23+
commands: ok-to-test
24+
# The repository permission level required by the user to dispatch commands. Only allows 1Password collaborators to run this.
25+
permission: write

.github/workflows/validate.yml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ on:
88
pull_request:
99
paths-ignore:
1010
- '**.md'
11+
repository_dispatch:
12+
types: [ ok-to-test-command ]
1113

1214
jobs:
1315

14-
validate:
16+
integration-test-trusted:
17+
# actions that are trusted by default must only be opened from within the repo, and skipped for forks because they'll fail there
18+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
1519
strategy:
1620
matrix:
1721
os: [ubuntu-latest, windows-latest, macos-latest]
@@ -47,5 +51,77 @@ jobs:
4751
- name: Lint with Ruff
4852
run: |
4953
pip install ruff
50-
ruff check --output-format=github --exclude=src/onepassword/lib/ .
54+
ruff check --output-format=github --exclude=src/onepassword/lib/,example/ .
5155
continue-on-error: true
56+
57+
# This action is called by the /ok-to-test command, once the forked PR's code has been security reviewed.
58+
# It will checkout the forked (and now trusted) code and it will run the integration tests on it.
59+
# If the tests are successful this action will proceed to update the status of the forked PR integration check.
60+
integration-test-fork:
61+
# required permissions for updating the status of the pull request checks
62+
permissions:
63+
pull-requests: write
64+
checks: write
65+
strategy:
66+
matrix:
67+
os: [ubuntu-latest, windows-latest, macos-latest]
68+
runs-on: ${{ matrix.os }}
69+
if: |
70+
github.event_name == 'repository_dispatch' &&
71+
github.event.client_payload.slash_command.args.named.sha != '' &&
72+
contains(
73+
github.event.client_payload.pull_request.head.sha,
74+
github.event.client_payload.slash_command.args.named.sha
75+
)
76+
steps:
77+
78+
# Check out merge commit
79+
- name: Fork based /ok-to-test checkout
80+
uses: actions/checkout@v4
81+
with:
82+
ref: ${{ github.event.client_payload.pull_request.head.sha }}
83+
84+
- name: Set up Python
85+
uses: actions/setup-python@v4
86+
with:
87+
python-version: '3.x'
88+
89+
- name: Integration Test
90+
env:
91+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }}
92+
run: |
93+
pip install pytest &&
94+
pip install pytest-asyncio &&
95+
pip install pydantic &&
96+
python -m pytest src/onepassword/test_client.py
97+
98+
- run: |
99+
echo "Integration tests completed successfully!"
100+
101+
# Update check run called "integration-fork" on the forked PR
102+
- uses: actions/github-script@v6
103+
id: update-check-run
104+
if: ${{ always() }}
105+
env:
106+
job: ${{ github.job }}
107+
ref: ${{ github.event.client_payload.pull_request.head.sha }}
108+
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
109+
conclusion: ${{ job.status }}
110+
with:
111+
github-token: ${{ secrets.GITHUB_TOKEN }}
112+
script: |
113+
const { data: checks } = await github.rest.checks.listForRef({
114+
...context.repo,
115+
process.env.ref
116+
});
117+
118+
const check = checks.check_runs.filter(c => c.name === process.env.job);
119+
120+
const { data: result } = await github.rest.checks.update({
121+
...context.repo,
122+
check_run_id: check[0].id,
123+
status: 'completed',
124+
conclusion: process.env.conclusion
125+
});
126+
127+
return result;

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
release:
2+
src/release/scripts/release.sh
3+
4+
prep-release:
5+
src/release/scripts/prep-release.sh
6+
7+

README.md

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<p align="center">
22
<a href="https://1password.com">
3-
<h1 align="center">1Password Python SDK (beta)</h1>
3+
<h1 align="center">1Password Python SDK</h1>
44
</a>
55
</p>
66

77
<p align="center">
8-
<h4 align="center"> ❗ The 1Password SDK project is in beta. Future iterations may bring backwards-incompatible changes.</h4>
8+
<h4 align="center">Build integrations that programmatically access your secrets in 1Password.</h4>
99
</p>
1010

1111
<p align="center">
@@ -14,27 +14,21 @@
1414

1515
---
1616

17-
The 1Password Python SDK offers programmatic access to your secrets in 1Password with Python. During the beta, you can create, retrieve, update, and delete items and resolve secret references.
17+
## Requirements
1818

19-
## 🔑 Authentication
19+
The 1Password Python SDK requires:
2020

21-
1Password SDKs support authentication with [1Password Service Accounts](https://developer.1password.com/docs/service-accounts/get-started/).
21+
- `libssl` 3
22+
- `glibc` 2.32 or later
2223

23-
Before you get started, [create a service account](https://developer.1password.com/docs/service-accounts/get-started/#create-a-service-account) and give it the appropriate permissions in the vaults where the items you want to use with the SDK are saved.
24-
25-
## ❗ Limitations
26-
27-
1Password SDKs don't yet support using secret references with query parameters, so you can't retrieve file attachments or SSH keys, or get more information about field metadata.
28-
29-
1Password SDKs currently only support operations on text and concealed fields. As a result, you can't edit items that include information saved in other types of fields.
30-
31-
When managing items with 1Password SDKs, you must use [unique identifiers (IDs)](https://developer.1password.com/docs/sdks/concepts#unique-identifiers) in place of vault, item, and field names.
24+
If you're running a Linux distribution that still uses `libssl` version 1.1.1, such as Debian 11 or Ubuntu 20.04, you'll need to update to a later version of Linux or install the required dependencies.
3225

3326
## 🚀 Get started
3427

3528
To use the 1Password Python SDK in your project:
3629

37-
1. Provision your [service account](#authentication) token. We recommend provisioning your token from the environment. For example, to export your token to the `OP_SERVICE_ACCOUNT_TOKEN` environment variable:
30+
1. [Create a service account](https://my.1password.com/developer-tools/infrastructure-secrets/serviceaccount/) and give it the appropriate permissions in the vaults where the items you want to use with the SDK are saved.
31+
2. Provision your service account token. We recommend provisioning your token from the environment. For example, to export your token to the `OP_SERVICE_ACCOUNT_TOKEN` environment variable:
3832

3933
**macOS or Linux**
4034

@@ -48,13 +42,13 @@ To use the 1Password Python SDK in your project:
4842
$Env:OP_SERVICE_ACCOUNT_TOKEN = "<your-service-account-token>"
4943
```
5044

51-
2. Install the 1Password Python SDK in your project:
45+
3. Install the 1Password Python SDK in your project:
5246

5347
```bash
54-
pip install git+ssh://[email protected]/1Password/[email protected].0-beta.9
48+
pip install git+ssh://[email protected]/1Password/[email protected].1
5549
```
5650

57-
3. Use the Python SDK in your project:
51+
4. Use the Python SDK in your project:
5852

5953
```python
6054
import asyncio
@@ -77,10 +71,69 @@ if __name__ == '__main__':
7771

7872
```
7973

80-
Make sure to use [secret reference URIs](https://developer.1password.com/docs/cli/secrets-reference-syntax/) with the syntax `op://vault/item/field` to securely load secrets from 1Password into your code.
74+
Make sure to use [secret reference URIs](https://developer.1password.com/docs/cli/secret-reference-syntax/) with the syntax `op://vault/item/field` to securely load secrets from 1Password into your code.
75+
76+
## Supported functionality
77+
78+
1Password SDKs are in active development. We're keen to hear what you'd like to see next. Let us know by [upvoting](https://github.com/1Password/onepassword-sdk-python/issues) or [filing](https://github.com/1Password/onepassword-sdk-python/issues/new/choose) an issue.
79+
80+
### Item management
81+
82+
Operations:
83+
84+
- [x] [Retrieve secrets](https://developer.1password.com/docs/sdks/load-secrets)
85+
- [x] [Retrieve items](https://developer.1password.com/docs/sdks/manage-items#get-an-item)
86+
- [x] [Create items](https://developer.1password.com/docs/sdks/manage-items#create-an-item)
87+
- [x] [Update items](https://developer.1password.com/docs/sdks/manage-items#update-an-item)
88+
- [x] [Delete items](https://developer.1password.com/docs/sdks/manage-items#delete-an-item)
89+
- [x] [List items](https://developer.1password.com/docs/sdks/list-vaults-items/)
90+
- [ ] Add & update tags on items
91+
92+
Field types:
93+
- [x] API Keys
94+
- [x] Passwords
95+
- [x] Concealed fields
96+
- [x] Text fields
97+
- [x] Notes
98+
- [x] SSH private keys (partially supported: supported in resolving secret references, not yet supported in item create/get/update)
99+
- [ ] SSH public keys, fingerprint and key type
100+
- [x] One-time passwords
101+
- [x] URLs
102+
- [ ] Websites (used to suggest and autofill logins)
103+
- [x] Phone numbers
104+
- [x] Credit card types
105+
- [ ] Files attachments and Document items
106+
107+
### Vault management
108+
- [ ] Retrieve vaults
109+
- [ ] Create vaults ([#36](https://github.com/1Password/onepassword-sdk-python/issues/36))
110+
- [ ] Update vaults
111+
- [ ] Delete vaults
112+
- [x] [List vaults](https://developer.1password.com/docs/sdks/list-vaults-items/)
113+
114+
### User & access management
115+
- [ ] Provision users
116+
- [ ] Retrieve users
117+
- [ ] List users
118+
- [ ] Suspend users
119+
- [ ] Create groups
120+
- [ ] Update group membership
121+
- [ ] Update vault access & permissions
122+
123+
### Compliance & reporting
124+
- [ ] Watchtower insights
125+
- [ ] Travel mode
126+
- [ ] Events. For now, use [1Password Events Reporting API](https://developer.1password.com/docs/events-api/) directly.
127+
128+
### Authentication
129+
130+
- [x] [1Password Service Accounts](https://developer.1password.com/docs/service-accounts/get-started/)
131+
- [ ] User authentication
132+
- [ ] 1Password Connect. For now, use [1Password/connect-sdk-go](https://github.com/1Password/connect-sdk-go).
81133

82134
## 📖 Learn more
83135

84136
- [Load secrets with 1Password SDKs](https://developer.1password.com/docs/sdks/load-secrets)
85137
- [Manage items with 1Password SDKs](https://developer.1password.com/docs/sdks/manage-items)
138+
- [List vaults and items with 1Password SDKs](https://developer.1password.com/docs/sdks/list-vaults-items)
86139
- [1Password SDK concepts](https://developer.1password.com/docs/sdks/concepts)

0 commit comments

Comments
 (0)