Skip to content

Commit 023956f

Browse files
committed
maintenance - add SECURITY.md for PHP API client && tag_admin example
1 parent 5785a23 commit 023956f

3 files changed

Lines changed: 131 additions & 0 deletions

File tree

SECURITY.asc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----BEGIN PGP PUBLIC KEY BLOCK-----
2+
3+
mDMEZVsi2RYJKwYBBAHaRw8BAQdAIm/0t+RboVPq5syrc0n9hP3UPH7xok7mNCqM
4+
5R39oZi0JVphbW1hZCBTZWN1cml0eSA8c2VjdXJpdHlAemFtbWFkLmNvbT6ImQQT
5+
FgoAQRYhBARIHz68FJQ7lF5Ox7snHWG50ZiEBQJlWyLZAhsDBQkSzAMABQsJCAcC
6+
AiICBhUKCQgLAgQWAgMBAh4HAheAAAoJELsnHWG50ZiEM+MBAMMdppJHzPNRdgke
7+
bv7+z591+LrQqsKJUBUHjlujsxrbAQCF9RRf2CSTaF2SBD9vrGxdL58Bb/AVs1t6
8+
ZX/Xf/ozDLg4BGVbItkSCisGAQQBl1UBBQEBB0DtyQW5YnpS1MQ+umPKax706r+R
9+
RJZRO63fma5e+rhaKgMBCAeIfgQYFgoAJhYhBARIHz68FJQ7lF5Ox7snHWG50ZiE
10+
BQJlWyLZAhsMBQkSzAMAAAoJELsnHWG50ZiE9w8BAKj36yLaf7do05ObiTjpFR5P
11+
iDa6aRHJSWDpdut8Q19jAQCfH1WZ2M/2VK0E03k6zcfc56m+z1gwdkq78dAunte2
12+
BA==
13+
=GDpl
14+
-----END PGP PUBLIC KEY BLOCK-----

SECURITY.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Security fixes are provided for the current stable version of this PHP API client only.
6+
Any older version is not supported and needs to be updated first before reporting security issues.
7+
8+
## Reporting a Vulnerability
9+
10+
If you've found a security vulnerability in Zammad,
11+
please report the vulnerability exclusively via email
12+
to [security@zammad.com](mailto:security@zammad.com).
13+
14+
Please do not combine several independent vulnerabilities,
15+
but send a separate mail for each of them instead.
16+
17+
To send us a secure message, please use [our public key](SECURITY.asc).
18+
19+
We will get back to you as soon as possible and inform
20+
you about the next steps. Accepted vulnerabilities will
21+
be disclosed via patch level release with accompanying
22+
security advisory.
23+
24+
### Reporting Process Overview
25+
26+
- Potential security issues can be reported via [security@zammad.com](mailto:security@zammad.com).
27+
- We evaluate them and provide timely feedback to the reporter.
28+
- There may be security releases created if needed, e.g. [Zammad 6.3.1](https://zammad.com/en/releases/6-3-1).
29+
- We publish security advisories for every acknowledged issue via [GitHub Security Advisories](https://github.com/zammad/zammad/security/advisories).
30+
- After their publication, we request CVE identifiers to be assigned to the advisories.
31+
32+
### Rewards
33+
34+
Every first reporter of a vulnerability may be credited
35+
in the related security advisory.
36+
37+
Zammad does not offer financial compensation through a
38+
security bounty program.
39+
40+
## Security Measures in Development Workflow
41+
42+
### Dependency Management
43+
44+
Dependencies are managed via [Composer](https://getcomposer.org/).
45+
You can check for known security vulnerabilities in dependencies by running:
46+
47+
```bash
48+
composer audit
49+
```

examples/tag_admin.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
3+
/**
4+
* Example for Tag administration scope.
5+
*
6+
* Manage tags globally: list, create, rename and delete tags.
7+
* See https://docs.zammad.org/en/latest/api/ticket/tags.html#administration-scope
8+
*/
9+
10+
use ZammadAPIClient\Client;
11+
use ZammadAPIClient\ResourceType;
12+
13+
require __DIR__ . '/../vendor/autoload.php';
14+
15+
$client = new Client([
16+
'url' => 'https://my.zammad.com',
17+
'username' => 'my-username',
18+
'password' => 'my-password',
19+
]);
20+
21+
// List all tags (administration scope)
22+
$tags = $client->resource(ResourceType::TAG)->all();
23+
echo "All tags:\n";
24+
foreach ($tags as $tag) {
25+
echo sprintf(
26+
" ID: %s, Name: %s, Count: %s\n",
27+
$tag->getID(),
28+
$tag->getValue('name'),
29+
$tag->getValue('count')
30+
);
31+
}
32+
33+
// Create a new tag
34+
$tag = $client->resource(ResourceType::TAG);
35+
$tag->setValue('name', 'example-tag');
36+
$tag->save();
37+
38+
echo "\nTag 'example-tag' created.\n";
39+
40+
// Find the created tag to get its ID
41+
$tag_id = null;
42+
$tags = $client->resource(ResourceType::TAG)->all();
43+
foreach ($tags as $t) {
44+
if ($t->getValue('name') === 'example-tag') {
45+
$tag_id = $t->getID();
46+
break;
47+
}
48+
}
49+
50+
if ($tag_id) {
51+
echo "Tag ID: $tag_id\n";
52+
53+
// Rename the tag (update)
54+
// Set the tag's ID so save() will call update() instead of create()
55+
$tag = $client->resource(ResourceType::TAG);
56+
$tag->setRemoteData(['id' => $tag_id]);
57+
$tag->setValue('name', 'example-tag-renamed');
58+
$tag->save();
59+
60+
echo "Tag renamed to 'example-tag-renamed'.\n";
61+
62+
// Delete the tag
63+
$tag = $client->resource(ResourceType::TAG);
64+
$tag->setRemoteData(['id' => $tag_id]);
65+
$tag->delete();
66+
67+
echo "Tag deleted.\n";
68+
}

0 commit comments

Comments
 (0)