Skip to content

Data Sync - #138

Open
jakub-grzesiowski wants to merge 8 commits into
masterfrom
data-sync
Open

jakub-grzesiowski wants to merge 8 commits into
masterfrom
data-sync

Conversation

@jakub-grzesiowski

Copy link
Copy Markdown
Contributor

No description provided.

@pubnub-ops-terraform

pubnub-ops-terraform commented Sep 22, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

* Two clients are involved: an admin signing its requests with the secret key, which grants the
* tokens and owns the fixtures, and a token-only client that has no credentials beyond the token
* under test. That split is what makes the denials meaningful - a client carrying both a signature
* and a token is rejected outright, so the token is the only thing granting the access asserted

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does it mean "a client carrying both a signature

  • and a token is rejected outright" ?
    Is this server rejecting such request?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes DataSync will reject a request if it has both auth and signature

foreach ($this->sort as $key => $value) {
if (is_int($key)) {
$entries[] = $value;
} elseif ($value === 'asc' || $value === 'desc') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this possible that $value is 'DESC' ?
If so then it seem that else branch will be executed causing ascending sort?

if (in_array($typeName, self::ENTITY_TYPES, true)) {
$entity = PNDataSyncEntity::fromPayload(array_merge($data, [
'entityClass' => $className,
'entityClassVersion' => $classVersion,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't we include also:

'entityClassLevel' => $classLevel

?

} else {
$messageError = null;
try {
$extractedMessage = $this->processMessage($message->getPayload());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There might be a problem when Crypto is configured processMessage() calls decrypt() that takes only string and objects not array DataSync event payload is an array causing TypeError

protected const PATCH_MEDIA_TYPE = "application/json-patch+json";

/** A delete answers 200 with no body. */
protected const RESPONSE_MAY_BE_EMPTY = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should't this apply only to Deleted operations that could return empty body. Other operations should not delete empty body?

/**
* Response of the paginated membership list operation.
*/
class PNDataSyncMembershipsResult

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This class seems very similar to:
PNDataSyncEntitiesResult
PNDataSyncRelationshipsResult
PNDataSyncUsersResult
PNDataSyncChannelsResult

Did you consider creation of base class that those classes can extend. Is such approach we could avoid code duplication?

/**
* Response of the single-entity DataSync operations (create, get, set and update).
*/
class PNDataSyncEntityResult

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seem that this class is very similar to:
PNDataSyncRelationshipResult
PNDataSyncMembershipResult
PNDataSyncUserResult
PNDataSyncChannelResult

Did you consider creating baseClass to avoid duplication?

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.

3 participants