Unique Flags
Traboda Arena supports generating and setting up unique flags for each contestant for supported challenges. Through using this feature, the organizers can stop the contestants from copying flags from other contestants, as every contestant gets a different flag. Now, in case of a flag being shared, not only does the flag doesn't get accepted for the copier, but the incident gets logged - through which both copier and the original flag owner can be identified.
This feature is only supported for challenges that involve deployments. The platform generates a new unique flags every time a contestant starts a challenge instance deployment, the flags are then set as environment variables in the deployment. The author of the challenge should use these environment variable in the challenge to place the flags as required. In challenges that involve multiple flags, the platform generates a unique flag for each flag. The name of the environment variable for each flag is to be specified while creating/editing the challenge, in the flags tab.
Flag Format
- The platform will pickup the flag format from the challenge's flag format field (or the global flag format saved in contest settings).
- The flag format should be a string with the following format:
flag{.*}
. The platform will replace the.*
with the generated flag. - If no flag format is specified, or the flag format is invalid, the platform will use the default flag format:
flag{.*}
.
Setting Up Unique Flags
In the challenge edit/create page, open the flags tab. Here, you will be able to create or edit the flags for the challenge. A challenge can have multiple flags, and a combination of static and unique flags. The platform will generate a unique value for each unique flag when a contestant starts its deployment, and will set the generated flags in the environment variable specified by the author.
Now for the flag you want to set up unique flag (values) for, follow the following steps:
- Select the flag type as
Unique Flag
.
- Specify the name of the environment variable in which the platform will set the generated flag.
That's it!
Now, on the challenge application source code, you should use the environment variable to place the flag as required. You can create multiple such flags and use those environment variables in the challenge application, for using this functionality.
Unique Flags Wont Work, if -
The challenge author does not properly use the environment variable in the challenge application. The platform will generate the flags, and set it only in the environment variable specified by the author. It is the author's responsibility to use the environment variable in the challenge application.
The challenge uses shared instances mode. Unique flags are only supported for challenges that use dedicated instances mode (i.e.
Shared Instance
mode should be turned off in challenge Deployment settings). In case of shared instances mode, the platform will generate the flags, but it will be same for all the contestants, and hence, the rendering the functionality useless.The platform is not configured for on-demand deployments. Unique flags are only supported for challenges that use on-demand deployments. Click here to learn about setting up the platform for on-demand deployments.
Testing Unique Flags
For testing, the platform only spawns a single instance of the challenge for all the organizers (pretty much like
the Shared Instance
mode). Hence, unique flags will not be generated for the organizers. However, the functionality
will work for the contestant accounts.
However, to check if the unique flags are working as expected, you can go to manage > instances
and for individual
instances, click on their names to open the instance details popup. Here, you will be able to see the environment
variables set for the instance, and the generated flags.